SHARE
TWEET

zone.pl

a guest Apr 10th, 2013 240 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2. #
  3. # Zone Transfer (C) Jakub Zoczek
  4. #
  5.  
  6. use Net::Nslookup;
  7. use Net::DNS;
  8.  
  9. my $z = Net::DNS::Resolver->new();
  10. my @ns = nslookup(type => "NS", domain => $ARGV[0]);
  11. foreach $i (@ns) {
  12.         print "Checking ", $i, "... ";
  13.         $z->nameservers($i);
  14.         my @zone = $z->axfr($ARGV[0]);
  15.         if(@zone) {
  16.                 print "OK!\n";
  17.                 foreach my $record (@zone) {
  18.                         $record->print;
  19.                 }
  20.                 last;
  21.         }
  22.         else {
  23.                 print "failed.\n";
  24.         }
  25.  
  26. }
RAW Paste Data
Top