Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ##################
- # Virtual Host #
- # Scanner #
- ##################
- */
- #include <stdio.h>
- #include <string.h>
- #include <netdb.h>
- #define my_port "80"
- int main(int argc, char *argv[]) {
- if (argc != 3) {
- printf("\nusage: ./dns <host> <list>\n\n");
- return 1; }
- FILE *dns_file;
- if ((dns_file = fopen(argv[2],"r")) == NULL) {
- printf("\nFile does not exist!\n");
- return 1; }
- char guess[50];
- while (fscanf(dns_file, "%s", guess) != EOF) {
- int status;
- char dnsbrute[60];
- sprintf(dnsbrute,"%s.%s",guess, argv[1]);
- struct addrinfo hints, *res;
- memset(&hints, 0, sizeof hints);
- hints.ai_family = AF_UNSPEC;
- hints.ai_socktype = SOCK_STREAM;
- if ((status = getaddrinfo(dnsbrute, my_port, &hints, &res)) == 0) {
- printf("\nFOUND! %s", dnsbrute); } }
- fclose(dns_file);
- return 0; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement