home *** CD-ROM | disk | FTP | other *** search
/ Hackers Handbook - Millenium Edition / Hackers Handbook.iso / files / unix / cgiscan2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-04-11  |  4.4 KB  |  165 lines

  1. /*
  2.    See my original code for credits.
  3.    
  4.    This asks a web server (on Unix or NT) if it is running services
  5.    that are known to be exploitable. If it finds them it tells you,
  6.    but it won't exploit them. I updated this so it looks for some new
  7.    holes in diffrent types of web servers, and new web server that are
  8.    coming out on the market.
  9.    
  10.    To complie:
  11.    luser$ gcc cgiscan.c -o cgiscan
  12.    To use:
  13.    luser$ ./cgiscan somedomain.com   (i.e. ./cgiscan antionline.com)
  14.    
  15.    coded by Bronc Buster 
  16.    Jan 1999  
  17.    Updated Feb 1999
  18. */
  19.  
  20. #include <sys/types.h>
  21. #include <netinet/in.h>
  22. #include <string.h>
  23. #include <netdb.h>
  24. #include <ctype.h>
  25. #include <arpa/nameser.h>
  26. #include <strings.h>
  27. #include <stdio.h>
  28. #include <stdlib.h>
  29. #include <unistd.h>
  30. #include <sys/socket.h>
  31. #define MAX_SIZE 24  /* make this the size of temp[] if you change it */
  32.  
  33. int main(int argc, char *argv[])
  34. {
  35.  int s;
  36.  struct in_addr addr;
  37.  struct sockaddr_in victem;
  38.  struct hostent *bad;
  39.  char foundmsg[] = "200";
  40.  char *cgistr;
  41.  char buffer[1024];
  42.  char cgibuff[1024]; 
  43.  int num,i=0;
  44.  char *temp[MAX_SIZE];    
  45.  char *name[MAX_SIZE]; 
  46.  
  47.  temp[1] = "GET /cgi-bin/phf HTTP/1.0\n\n";
  48.  temp[2] = "GET /cgi-bin/Count.cgi HTTP/1.0\n\n";
  49.  temp[3] = "GET /cgi-bin/test-cgi HTTP/1.0\n\n";
  50.  temp[4] = "GET /cgi-bin/php.cgi HTTP/1.0\n\n";
  51.  temp[5] = "GET /cgi-bin/handler HTTP/1.0\n\n";
  52.  temp[6] = "GET /cgi-bin/webgais HTTP/1.0\n\n";
  53.  temp[7] = "GET /cgi-bin/websendmail HTTP/1.0\n\n";
  54.  temp[8] = "GET /cgi-bin/webdist.cgi HTTP/1.0\n\n";
  55.  temp[9] = "GET /cgi-bin/faxsurvey HTTP/1.0\n\n";
  56.  temp[10] = "GET /cgi-bin/htmlscript HTTP/1.0\n\n";
  57.  temp[11] = "GET /cgi-bin/pfdispaly.cgi HTTP/1.0\n\n";
  58.  temp[12] = "GET /cgi-bin/perl.exe HTTP/1.0\n\n";
  59.  temp[13] = "GET /cgi-bin/wwwboard.pl HTTP/1.0\n\n";
  60.  temp[14] = "GET /cgi-bin/www-sql HTTP/1.0\n\n";
  61.  temp[15] = "GET /_vti_pvt/service.pwd HTTP/1.0\n\n";
  62.  temp[16] = "GET /_vti_pvt/users.pwd HTTP/1.0\n\n";
  63.  temp[17] = "GET /cgi-bin/aglimpse HTTP/1.0\n\n";
  64.  temp[18] = "GET /cgi-bin/man.sh HTTP/1.0\n\n";
  65.  temp[19] = "GET /cgi-bin/view-source HTTP/1.0\n\n";
  66.  temp[20] = "GET /cgi-bin/campas HTTP/1.0\n\n";
  67.  temp[21] = "GET /cgi-bin/nph-test-cgi HTTP/1.0\n\n";
  68.  temp[22] = "GET /cgi-dos/args.bat HTTP/1.0\n\n";
  69.  temp[23] = "GET /cgi-win/uploader.exe HTTP/1.0\n\n";
  70.  
  71.  name[1] = "phf";
  72.  name[2] = "Count.cgi";
  73.  name[3] = "test-cgi";
  74.  name[4] = "php.cgi";
  75.  name[5] = "handler";
  76.  name[6] = "webgais";
  77.  name[7] = "websendmail";
  78.  name[8] = "webdist.cgi";
  79.  name[9] = "faxsurvey";
  80.  name[10] = "htmlscript";
  81.  name[11] = "pfdisplay";
  82.  name[12] = "perl.exe";
  83.  name[13] = "wwwboard.pl";
  84.  name[14] = "www-sql";
  85.  name[15] = "service.pwd";
  86.  name[16] = "users.pwd";
  87.  name[17] = "aglimpse";
  88.  name[18] = "man.sh";
  89.  name[19] = "view-source";
  90.  name[20] = "campas";
  91.  name[21] = "nph-test-cgi";
  92.  name[22] = "args.bat";
  93.  name[23] = "uploader.exe";
  94.  
  95.  if (argc!=2)
  96.    {
  97.    exit(printf("\nUsage : %s domain.com\n ",argv[0])); 
  98.    }
  99.  if ((bad=gethostbyname(argv[1])) == NULL)
  100.    {
  101.    exit(printf("Error getting hostname"));
  102.    }
  103.  
  104. printf("New web server hole and info scanner for elite kode kiddies\n");
  105. printf("coded by Bronc Buster - Updated Feb 1999\n");
  106.  
  107. system("sleep 2");
  108.  
  109. s=socket(AF_INET, SOCK_STREAM, 0);
  110.  if(s<0) exit(printf("Socket error"));
  111. bcopy(bad->h_addr, (char *)&victem.sin_addr, bad->h_length);
  112. victem.sin_family=AF_INET;
  113. victem.sin_port=htons(80);
  114.  
  115. if (connect(s, (struct sockaddr*)&victem, sizeof(victem))<0)
  116.   {
  117.   exit(printf("Connect error"));
  118.   }
  119. printf("\nGetting HTTP version\n\n");
  120. send(s, "HEAD / HTTP/1.0\n\n",17,0);
  121. recv(s, buffer, sizeof(buffer),0);
  122. printf("Version:\n%s",buffer);
  123.  
  124. close(s); 
  125. system("sleep 2");
  126.    
  127. while(i++ < MAX_SIZE)   
  128.   {
  129.   s=socket(AF_INET, SOCK_STREAM, 0);
  130.   bcopy(bad->h_addr, (char *)&victem.sin_addr, bad->h_length);
  131.   victem.sin_family=AF_INET;
  132.   victem.sin_port=htons(80);
  133.   if (connect(s, (struct sockaddr*)&victem, sizeof(victem))<0)
  134.     {
  135.     exit(printf("Connect error"));
  136.     }
  137.   printf("Searching for %s : ",name[i]);
  138.   for(num=0; num<1024; num++)
  139.       {
  140.       cgibuff[num] = '\0';
  141.       } 
  142.   
  143.    send(s, temp[i],strlen(temp[i]),0);
  144.    recv(s, cgibuff, sizeof(cgibuff),0);
  145.    cgistr = strstr(cgibuff,foundmsg);
  146.    if(cgistr != NULL)
  147.        printf(" * * Found * * \n");
  148.    else
  149.        printf(". . Not Found . .\n");
  150.       
  151.    close(s);
  152.    }
  153. return 0;
  154.  }
  155. /* EOF */
  156.  
  157. /*
  158.    Fryz, Prophet, Snupe, MostHateD - you are the lamest fucks
  159.    on this planet.
  160.  
  161.    b4b0 - I still have them pics of you guys in a gay orgy you sent me,
  162.    please stop sending them.
  163. */
  164.  
  165.