Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Your Name

By: a guest on Aug 11th, 2009  |  syntax: C  |  size: 0.86 KB  |  views: 42  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2.  
  3. ##################
  4. #  Virtual Host  #
  5. #     Scanner    #
  6. ##################
  7.  
  8. */
  9.  
  10. #include <stdio.h>
  11. #include <string.h>
  12. #include <netdb.h>
  13.  
  14. #define my_port "80"
  15.  
  16. int main(int argc, char *argv[]) {
  17.  
  18.     if (argc != 3) {
  19.         printf("\nusage: ./dns <host> <list>\n\n");
  20.         return 1; }
  21.  
  22.     FILE *dns_file;
  23.  
  24.     if ((dns_file = fopen(argv[2],"r")) == NULL) {
  25.         printf("\nFile does not exist!\n");
  26.         return 1; }
  27.  
  28.     char guess[50];
  29.  
  30.     while (fscanf(dns_file, "%s", guess) != EOF) {
  31.         int status;
  32.         char dnsbrute[60];
  33.         sprintf(dnsbrute,"%s.%s",guess, argv[1]);
  34.  
  35.         struct addrinfo hints, *res;
  36.         memset(&hints, 0, sizeof hints);
  37.         hints.ai_family = AF_UNSPEC;
  38.         hints.ai_socktype = SOCK_STREAM;
  39.  
  40.         if ((status = getaddrinfo(dnsbrute, my_port, &hints, &res)) == 0) {
  41.             printf("\nFOUND! %s", dnsbrute); } }
  42.  
  43.     fclose(dns_file);
  44.     return 0; }