> OK - Thanks for your help on that one, Still need the DNS stuff figured
> out, That's the last piece in what will be an extrodinarilly powerful
> whitelisting system. I'll publish the code once it is tested. I think a
> lot of people will want to use it and improve it.

Using Net::DNS, here is a snip of what I have used in the past. It
returns the PTR record, and if not available, returns the IP.

sub get_ame {

        my $ip = shift;
        my $res = Net::DNS::Resolver->new;
        my $query = $res->search("$ip");

        if ($query) {
                foreach my $rr ($query->answer) {
                        next unless $rr->type eq "PTR";
                        return ($rr->rdatastr);
                }
        } else {
                return ($ip);
        }

}

HTH,

Steve


Reply via email to