Weird question.

Jobe Bittman jobe at tns.net
Wed Mar 13 22:34:32 UTC 2002


Here's what I use. It works for most domains. You need to manually review 
the lines that say "No match." They are expired or the whois output wasn't 
understood. I'm using the system call whois with -Q which on freebsd is 
quicklookup and gives me an output that was easy to parse. I think I had 
some issue getting the whois perl module to give me easily parseable 
output. it does a lookup on www.domain.name to make sure its resolving too.
____________
#!/usr/bin/perl -w

use Net::DNS;

open(FILE,$ARGV[0]);
while(<FILE>) {
    chomp;
    @domains = (@domains,$_);
}
close FILE;

foreach $domain(@domains) {
    @lines=<`whois -Q $domain`>;
    $input = join(" ", at lines);
    print "$domain";
    resolve($domain);
    if ($input =~ /^Whois\sServer\sVersion\s1\.3/ ) {
       while($input =~ s/Name\sServer:\s(\S*)//) {
       @nameservers = (@nameservers,$1);
       }
       foreach $nameserver(@nameservers) { print "\,$nameserver"; }
       print "\n";
       undef (@nameservers);
    } elsif ($input =~ /^Registrant\sInformation:/ ) {
          print ",$lines[9],$lines[10]\n";
    } else {
       print "No match.\n";
    }
}

sub resolve {
$res = Net::DNS::Resolver->new;
$query = $res->search("www.$_[0]");
if ($query) {
     foreach $rr ($query->answer) {
         next unless $rr->type eq "A";
         print "\,", $rr->address;
     }
}
else {
     print "\,ERROR:", $res->errorstring;
}
}
______________

At 04:34 PM 3/13/2002 -0500, Drew Weaver wrote:

>         I have a text file with a list of 726 domains, is there a perl
>module or a program that can do a whois on all of these domains and show me
>the ones that are no longer pointing at our dns server? I'm trying to do a
>little house cleaning and doing that manual seems silly since at one point
>im sure someone more clever than me has run into this issue.
>
>Thanks,
>-Drew

Jobe Bittman
System Administrator
Terracom Network Services
------------------------------------------
858.268.8911 (tel)
858.268.9212 (fax)
jobe at tns.net

confreg 0x2142



More information about the bind-users mailing list