#include #include #include void main(int argc, char *argv[]) { struct in_addr addr; struct sockaddr_in sin; struct hostent *he; unsigned long start,end,counter; int count=0,blah=0,soft,ntcheck,sock; char ntbuff[1024],data[1024],buffer[1024]; char *buff[4],*un[4]; buff[1] = "GET hi and HTTP/1.0\n\n"; buff[2] = "GET welcome HTTP/1.0\n\n"; buff[3] = "GET to HTTP/1.0\n\n"; buff[4] = "GET my site HTTP/1.0\n\n"; un[1] = "GET Now HTTP/1.0\n\n"; un[2] = "GET you are HTTP/1.0\n\n"; un[3] = "GET okay HTTP/1.0\n\n"; un[4] = "GET for scan the world HTTP/1.0\n\n"; if (argc>2) { printf("\nusage : %s host ",argv[0]); exit(0); } if ((he=gethostbyname(argv[1])) == NULL) { herror("gethostbyname"); exit(0); } start=inet_addr(argv[1]); counter=ntohl(start); sock=socket(AF_INET, SOCK_STREAM, 0); bcopy(he->h_addr, (char *)&sin.sin_addr, he->h_length); sin.sin_family=AF_INET; sin.sin_port=htons(80); if (connect(sock, (struct sockaddr*)&sin, sizeof(sin))!=0) { perror("connect"); } while(count++ < 4) { sock=socket(AF_INET,SOCK_STREAM, 0); bcopy(he->h_addr, (char *)&sin.sin_addr, he->h_length); sin.sin_family=AF_INET; sin.sin_port=htons(80); if (connect(sock, (struct sockaddr*)&sin, sizeof(sin))!=0) { perror("connect"); } for(ntcheck=0; ntcheck < 1024; ntcheck++) { ntbuff[ntcheck] = '\0'; } send(sock, buff[count],strlen(buff[count]),0); recv(sock,ntbuff, sizeof(ntbuff),0); close(sock); } start=inet_addr(argv[1]); counter=ntohl(start); sock=socket(AF_INET, SOCK_STREAM, 0); bcopy(he->h_addr, (char *)&sin.sin_addr, he->h_length); sin.sin_family=AF_INET; sin.sin_port=htons(80); if (connect(sock, (struct sockaddr*)&sin, sizeof(sin))!=0) { perror("connect"); } Page 8