Hiya, 

Wonder if someone could help me, I am trying to write
a script to pulls out all the machine names from a
revese DNS file, some how, my script will only print
out the machine names with 1.x.x.in-addr.arpa.... 

$nslookup = '/usr/local/bin/nslookup';
$dig = '/usr/local/bin/dig';

@ZONES = qw/
        1.x.x.in-addr.arpa
        2.x.x.in-addr.arpa
        3.x.x.in-addr.arpa
        4.x.x.in-addr.arpa
        /;

foreach $zone (@ZONES)
{
open (SOA, "$nslookup -timeout=3 -retry=1 -type=SOA
$zone |") or die "Couldn't r
un $nslookup -timeout=3 -retry=1 -type=SOA $zone";

  SOA: while (<SOA>)
  {
    chomp;
    if (/^\S+.in-addr.arpa\s+nameserver = (\S+)$/)
    {
      $soa=$1;
      if (open(DIG, "$dig AXFR $zone \@$soa |"))
      {
        while (<DIG>)
        {
          chomp;
          if (
/\d+\s+1D\s+IN\s+\PTR\s+.+.this.is.my.domain./) 
          {
            ($host) = $_ =~
/\d+\s+1D\s+IN\s+\PTR\s+(.+).this.is.my.domain./;
            push (@all_hosts, $host);
          }
        }
        close (DIG);
      last SOA;
      }
    }
  }
  close(SOA);
}

print "@all_hosts\n";

What have I done wrong?? 

Many thanks,

Regards,

Priss

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to