Advertisement
Guest User

Your Name

a guest
Aug 11th, 2009
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.86 KB | None | 0 0
  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; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement