what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Pscan.c

Pscan.c
Posted Oct 5, 2002
Authored by Benny T.

Pscan v1.0 is a small Unix TCP port scanner that uses connect().

tags | tool, scanner, tcp
systems | unix
SHA-256 | 083849c2a726c95512fd1ffc2651fa15ab2444c2dd87892be6d50c0f332c2395

Pscan.c

Change Mirror Download
/*
Pscan v1.0 - Simple UNIX based TCP port scanner
Tested on Redhat Linux 7.2

++ Scans all 65535 TCP ports on a 100 Mbps Ethernet LAN in just 15 seconds !!

Compile: gcc -o Pscan Pscan.c

(c) 2002 by Benny T. <allegro16@hotmail.com>

*/


#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <unistd.h>

void Usage();


void main(int argc,char *argv[])
{
int i,dots=0;
int sock,portcount;
struct sockaddr_in sain;

if(argc!=4) {
Usage();
exit(0);
}
for(i=0;i<strlen(argv[1]);i++) {
if(argv[1][i]=='.') {
dots++;
}
}
if(dots!=3) {
printf("Invalid IP address\n");
Usage();
exit(0);
}
if(atoi(argv[2]) > 65535 || atoi(argv[3]) > 65535) {
printf("Invalid port number\n");
Usage();
exit(0);
}
sock = socket(AF_INET,SOCK_STREAM,0);
if(sock<0) {
printf("Error creating socket\n");
exit(0);
}
portcount = 0;
printf("Scanning host ");
printf(argv[1]);
printf(".....\n\n");
sain.sin_family=AF_INET;
sain.sin_addr.s_addr=inet_addr((char *)argv[1]);
for(i=atoi(argv[2]);i<=atoi(argv[3]);i++) {
sain.sin_port=htons(i);
if(connect(sock,(struct sockaddr *)&sain,sizeof(sain))==0) {
portcount++;
printf("Port ");
printf("%d",i);
printf(" open\n");
close(sock);
sock = socket(AF_INET,SOCK_STREAM,0);
if(sock<0) {
printf("Error creating socket\n");
exit(0);
}
}
}
printf("\n");
printf("%d%s",portcount, " TCP port(s) open\n");
close(sock);

}

void Usage()
{
printf("\nPscan v1.0 - Simple UNIX based TCP port scanner\n");
printf("(c) 2002 by Benny T. <mailto:allegro16@hotmail.com>\n");
printf("Usage: Pscan <IP address> <From port> <To port>\n\n");
}
Login or Register to add favorites

File Archive:

December 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Dec 1st
    0 Files
  • 2
    Dec 2nd
    41 Files
  • 3
    Dec 3rd
    25 Files
  • 4
    Dec 4th
    0 Files
  • 5
    Dec 5th
    0 Files
  • 6
    Dec 6th
    0 Files
  • 7
    Dec 7th
    0 Files
  • 8
    Dec 8th
    0 Files
  • 9
    Dec 9th
    0 Files
  • 10
    Dec 10th
    0 Files
  • 11
    Dec 11th
    0 Files
  • 12
    Dec 12th
    0 Files
  • 13
    Dec 13th
    0 Files
  • 14
    Dec 14th
    0 Files
  • 15
    Dec 15th
    0 Files
  • 16
    Dec 16th
    0 Files
  • 17
    Dec 17th
    0 Files
  • 18
    Dec 18th
    0 Files
  • 19
    Dec 19th
    0 Files
  • 20
    Dec 20th
    0 Files
  • 21
    Dec 21st
    0 Files
  • 22
    Dec 22nd
    0 Files
  • 23
    Dec 23rd
    0 Files
  • 24
    Dec 24th
    0 Files
  • 25
    Dec 25th
    0 Files
  • 26
    Dec 26th
    0 Files
  • 27
    Dec 27th
    0 Files
  • 28
    Dec 28th
    0 Files
  • 29
    Dec 29th
    0 Files
  • 30
    Dec 30th
    0 Files
  • 31
    Dec 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close