/* * Poepie.c v1.0 mass Domain name resolver by sacrine(C) * http://www.netric.org // sacrine@netric.org * irc.netric.org // #netric * * Greets: all members of Netric, my girlfriend ;) * Sat Jul 20:08:46 CEST 2002 * */ #include #include #include #include #include #include #include #include #include #include #define VERSION 1.0 void help(char *prog) { printf ("%s [options] -h - prints this help function -l - output logfile for resolved hostnames\n",prog); } int main(int argc, char *argv[]) { unsigned long atm; char *atmname; int c,i,y,digit; struct hostent *aap; struct in_addr addr; FILE *out=NULL; while((c=getopt(argc,argv,"hl:")) !=EOF) { switch(c) { case 'h': help(argv[0]); exit(1); break; case 'l': out=fopen(optarg,"w"); if(out==NULL) perror("file()"); fprintf(stdout, "writing results to %s\n",optarg); break; default: fprintf(stderr,"Usage: %s [l:h] \n", argv[0]); fprintf(stderr," %s [l:h] 195.0.0.0 195.0.0.255\n", argv[0]); exit(1); break; } } if (argv[optind+1] == NULL || argv[optind] == NULL) { fprintf(stderr,"Usage: %s [l:h] \n", argv[0]); fprintf(stderr," %s [l:h] 195.0.0.0 195.0.0.255\n", argv[0]); exit(1); } digit=atoi(argv[optind+1]); aap=gethostbyname(argv[optind]); if (!out) out = stdout; if(!aap) { perror("gethostbyname"); return -1; } atm=*((unsigned long *)aap->h_addr); fprintf(out,"--------------------------------------------------------------\n"); fprintf(out,"### Mass DNS resolver ###\n"); fprintf(out," Poepie.c 1.0\n"); fprintf(out," Netric Security\n"); fprintf(out,"### written by sacrine ###\n"); fprintf(out,"--------------------------------------------------------------\n\n"); for (i=0;i\t%s\n",atmname,(aap) ? aap->h_name : atmname); y=0; if (aap) while (aap->h_aliases[y] != NULL) fprintf(out,"\r%s",aap->h_aliases[y++]); atm += 0x01000000; } fprintf(out,"--------------------------------------------------------------\n"); return(0); }