DNS All The Things

By Ziddykins on Apr 03, 2013

DNS's a range of ip addresses.
Saves the nameservers returned to a file.
Multi-threaded to increase speed.
Not much of a purpose, I was bored.

You'll need Parallel::ForkManager.

    #!/usr/bin/perl
    use Parallel::ForkManager;
    use strict;
    use warnings;

    my $one = 0; my $two = 0; my $three = 0; my $four = 0; my $sip = "0.0.0.0";

    my $pm = new Parallel::ForkManager(100);

    while($sip ne "255.255.255.255") {
        $one++;
        if ($one eq 256) { $one = 0; $two++; }
        if ($two eq 256) { $two = 0; $three++; }
        if ($three eq 256) { $three = 0; $four++; }
        if ($four > 255) { $sip = "255.255.255.255"; }
        my $pid = $pm->start and next;
        $sip = "$four.$three.$two.$one";
        print "Looking up: $sip\n";
        chomp(my $host = `host $sip`);
        if($host =~ /domain name pointer(.*)/) {
            my $dnsd = $1;
            print "$sip = $dnsd\n";
            `echo "$dnsd" >>dnsout.log`;
        }
        $pm->finish;
    }
    print "Finished.\n";

Comments

Sign in to comment.
Hawkee   -  Apr 05, 2013

Hard to consider a practical application of this. Maybe a web tool to guess registrars for domains?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.