JustAnswer.com

Saturday, January 19, 2008

Tcp Tutorial-23

#define STCP_SLOWFACTOR 10


/* GENERAL ROUTINES ------------------------------------------- */

void banner(void) { printf("\nscantcp\n"); printf("version %s\n",STCP_VERSION); } void usage(const char *progname) { printf("\nusage: \n"); printf("%s [sf]\n\n",progname); printf("\t : 0: half-open scanning (type 0, SYN)\n"); printf("\t 1: stealth scanning (type 1, FIN)\n"); printf("\t 2: stealth scanning (type 2, ACK)\n"); printf("\t : source address (this host)\n"); printf("\t : target to scan\n"); printf("\t : ports/and or ranges to scan - eg: 21-30,113,6000\n"); printf("\t : microseconds to wait between TCP sends\n"); printf("\t : seconds to wait for TCP replies\n"); printf("\t[sf] : slow-factor in case sends are dectected to be too fast\n\n"); } /* OPTION PARSING etc ---------------------------------------- */ unsigned char *dest_name;

struct sockaddr_in destaddr;

unsigned long dest_addr; unsigned long spoof_addr; unsigned long usecdelay; unsigned waitdelay;

int slowfactor = STCP_SLOWFACTOR;

struct portrec /* the port-data structure */ { unsigned n; int state; unsigned char ttl; unsigned short int window; unsigned long int seq; char sends;

} *ports;

char *portstr;

unsigned char scanflags;

int done;

int tcpsock;


int lastidx = 0; /* last sent index */ int maxports; /* total number of ports */

void timeout(int signum) /* timeout handler */ { &