simple/dns/axfr.pl

22 lines
400 B
Perl
Raw Permalink Normal View History

2001-10-14 21:43:33 +02:00
#!/usr/bin/perl -w
use strict;
use Net::DNS;
2002-08-14 20:44:08 +02:00
sub usage {
print STDERR "Usage: $0 zone nameserver\n" unless (@ARGV == 2);
exit(1);
}
usage() unless (@ARGV == 2);
2001-10-14 21:43:33 +02:00
my $res = new Net::DNS::Resolver;
$res->nameservers($ARGV[1]);
my @zone = $res->axfr($ARGV[0]);
if (@zone) {
foreach my $rr (@zone) {
$rr->print;
}
} else {
print STDERR "query failed: ", $res->errorstring, "\n";
}