The following tool is a fast SYN scanner written in C.
Tool source:
/*
This is a fast and portable (i think). 48 bytes syn, w2k emulation, we are still working on it,
drop an email to drbios2000@yahoo.com if something goes wrong.
libnet and libpcap is required, the options are pretty self explanatory,
stripped static binary included for lamers.
Greets to kauggie (kaugex), nebunu, amidax, jhony si la ce tovarasi mai avem noi pe internetu asta.
BAG PULA IN TOTI ADMINII CARE SE CRED DUMNEZEI CA SUNT CU CONSOLA IN FATA
MUIE CUI SE SIMTE LUAT IN VIZOR DE HAITATEAM
*/
unsigned long dstip=0;
unsigned short sport;
char *interface=NULL;
unsigned char bclass=0;
unsigned char aclass=0;
unsigned char rclass=1;
unsigned int a=0,b=0,c=0,d=0;
srand(time(NULL));
sport=rand();
usec=1000000;
if(argc<2)
{
printf("usage: %s <port> [-a <a class> | -b <b class>] [-i <interface] [-s <speed>]\n",argv[0]);
printf("speed 10 -> as fast as possible, 1 -> it will take bloody ages (about 50 syns/s)\n");
printf("by DrBIOS <drbios2000@yahoo.com> & Bagabontu <bagabonturo@yahoo.com>\n");
exit(0x01);
}
for(i=1;i<argc;i++)
{
if(strstr(argv[i],"-s"))
{
if(i+1<argc)
{
switch (atoi(argv[i+1]))
{
case 1:usec=1000000;break;
case 2:usec=500000;break;
case 3:usec=250000;break;
case 4:usec=125000;break;
case 5:usec=60000;break;
case 6:usec=30000;break;
case 7:usec=10000;break;
case 8:usec=1000;break;
case 9:usec=100;break;
case 10:usec=0;burst=65535;
}
}
else
{
printf("-s requires an argument\n");
exit(0x01);
}
}
if(strstr(argv[i],"-i"))
{
if(i+1<argc) interface=argv[i+1];else
{
printf("-i requires an argument\n");
exit(0x01);
}
}
if(strstr(argv[i],"-a"))
{
if(i+1<argc)
{
aclass=1;
bclass=0;
rclass=0;
a=atoi(argv[i+1]);
b=0;
c=0;
d=0;
//printf("%d\n",a);
if((a<1) || (a>254))
{
printf("A must be between 1 and 254\n");
exit(0x02);
}
printf("scanning network %d.*.*.*\n",a);
}
else
{
printf("-a requires an A network as argument\n");
exit(0x01);
}
}
if(strstr(argv[i],"-b"))
{
if(i+1<argc)
{
aclass=0;
bclass=1;
rclass=0;
a=atoi(strtok(argv[i+1],"."));
temp_char=strtok(NULL,".");
if(temp_char==NULL)
b=0;else b=atoi(temp_char);
c=0;
d=0;
//printf("%d\n",a);
if((a<1) || (a>254))
{
printf("A must be between 1 and 254\n");
exit(0x02);
}
printf("scanning network %d.%d.*.*\n",a,b);
}
else
{
printf("-b requires an B network as argument(e.g. 192.168)\n");
exit(0x01);
}
}
}
printf("usec: %ld, burst packets %d\n",usec,burst);
port=(unsigned short)atoi(argv[1]);
if((port<1) || (port>65535)) exit(printf("damn dude, port numbers are in 1 .. 65535\n"));
if(interface!=NULL) printf("using inteface %s\n",interface);