MassResolve 0.1

MassResolve application performs reverse DNS lookups for network blocks or an input file.
MassResolve application performs reverse DNS lookups for network blocks or an input file. The requests can be performed mulit-threaded.

Usage:

./res < subnet or filename to resolve > < forks >

Code:

/*
MassResolve (C) 2000 John Anderson (john@ev6.net)
This program performs reverse dns lookups for network blocks
or an input file and supports multi threading.

*/

#include < stdio.h>
#include < fcntl.h>
#include < netdb.h>
#include < signal.h>
#include < sys/time.h>
#include < unistd.h>
#include < netinet/in.h>
#include < netinet/ip.h>
#include < netinet/ip_icmp.h>
#include < errno.h>
#include < string.h>
#include < getopt.h>
#include < setjmp.h>

char *
rlookup (u_long ip)
{
static char hostname[256];
struct hostent *host;
struct sockaddr_in addr;

addr.sin_addr.s_addr = ip;

host =
gethostbyaddr ((char *) &addr.sin_addr, sizeof (addr.sin_addr), AF_INET);

if (host == NULL)
{
printf ("%s does not resolve.n", inet_ntoa (ip));
fflush (stdout);
}
else
{
printf ("%s resolves to %sn", inet_ntoa (ip), host->h_name);
fflush (stdout);
}
}

int maxforq = 0;

int
main (int argc, char **argv)
{
int pid, k, j, frk, i, mforks;
char *pt;
char mehost[200], sv[3];
FILE *inp;

mforks = 64; /* default */
if (argv[1] == NULL)
{
printf ("Usage: %s n", argv[0]);
exit (0);
}
if (!argv[2] == NULL)
{
mforks = atoi (argv[2]);
}
/* printf ("Resolving all hosts in %s with %d threadsn", argv[1], mforks); */
if((inp=fopen(argv[1],"r"))!=NULL)
{
while(fgets(mehost,sizeof(mehost),inp))
{
sscanf(mehost,"%sn",mehost);
frk = fork ();
if (frk == 0)
{
fflush (stdout);
rlookup (inet_addr (mehost));
exit (0);
}
else
{ /* frk = 0 */
maxforq++;
if (maxforq > mforks)
{
wait (NULL); // waiting until the child died
maxforq--;
}

}

}
fclose(inp);
exit(0);
}

pt = strchr (argv[1], '.');
if (pt == NULL)
{ /* ANET */
for (k = 0; k

last updated on:
August 22nd, 2007, 16:32 GMT
price:
FREE!
developed by:
John Anderson
homepage:
www.bindshell.net
license type:
GPL (GNU General Public License) 
category:
ROOT \ System \ Networking

FREE!

In a hurry? Add it to your Download Basket!

user rating 12

3.2/5
 

0/5

Add your review!

SUBMIT