Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some very old dns checking scripts for completeness.
- Loading branch information
1 parent
c91a621
commit a8b3864
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/perl -w | ||
use strict; | ||
use warnings; | ||
use Net::DNS; | ||
|
||
# takes a single domain, retrieves the ns records for it and then | ||
# queries each server to ensure it can answer for that domain | ||
|
||
my $domain = shift; | ||
|
||
my $res = Net::DNS::Resolver->new; | ||
my $query = $res->query( $domain, "NS"); | ||
|
||
if ($query) { | ||
foreach my $rr (grep { $_->type eq 'NS' } $query->answer) { | ||
$res->nameservers( $rr->nsdname); | ||
|
||
my $lookup = $res->query( $domain, "A"); | ||
if ($lookup) { | ||
foreach my $record (grep { $_->type eq 'A' } $lookup->answer) { | ||
print $domain, " ", $rr->nsdname, " ", $record->address, "\n"; | ||
} | ||
} else { | ||
warn "A record query for [$domain] against [", $rr->nsdname, "] failed: ", $res->errorstring, "\n"; | ||
} | ||
} | ||
} else { | ||
warn "NS record query for [$domain] failed : ", $res->errorstring, "\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/perl | ||
use strict; | ||
use warnings; | ||
use Net::DNS; | ||
|
||
die "$0: please supply a subdomain to look for and one or more zones to look in\n" | ||
unless @ARGV >= 2; | ||
|
||
my $domain = shift; | ||
my @zones = @ARGV; | ||
|
||
my $res = Net::DNS::Resolver->new; | ||
|
||
for my $zone ( @zones ) { | ||
my $query = $res->query( "$domain.$zone", "A"); | ||
|
||
if ( $query ) { | ||
foreach my $rr ( grep { $_->type eq 'A' } $query->answer ) { | ||
print "Present - $domain.$zone\n"; | ||
} | ||
} else { | ||
warn "Absent - $domain.$zone - ", $res->errorstring, "\n"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/perl | ||
use strict; | ||
use warnings; | ||
use Net::Domain::ExpireDate; | ||
|
||
die "$0: <file of domainnames>\n" unless @ARGV == 1; | ||
|
||
my $domainfile = shift; | ||
|
||
open( my $domains_fh, '<', $domainfile ) | ||
|| die "Failed to open [$domainfile]: $!\n"; | ||
|
||
my %domain_expiry; | ||
for my $domain ( sort <$domains_fh> ) { | ||
my $expiration = expire_date( $domain, '%Y-%m-%d' ); | ||
|
||
$expiration ||= "unknown"; | ||
|
||
push @{ $domain_expiry{$expiration} }, $domain; | ||
} | ||
|
||
for my $expiry_date (sort keys %domain_expiry) { | ||
print "$expiry_date -\n"; | ||
print " -- $_" for @{ $domain_expiry{$expiry_date} }; | ||
} |