DNS Resolver
I had a list of domains that needed their MX records updated. I first wanted to make sure that our DNS servers were authoritative for those zones.
I used Perl and the Net::DNS CPAN module to figure out the NS records for each domain.
[text]
#!/usr/bin/perl
use Net::DNS;
my $resolver = Net::DNS::Resolver->new;
my $query = "";
my $domain = "";
open(FILE, "</tmp/domains.txt");
while(<file>) {
chomp;
$domain = $_;
$query = $resolver->query($domain, "NS");
print $domain;
if($query) {
foreach my $rr ($query->answer) {
next unless $rr->type eq "NS";
print ",", $rr->nsdname;
}
print "\n";
} else {
print ",DOES NOT RESOLVE\n";
}
}
[/text]