For what it's worth, this is my code to detect a likely-looking dynamic
IP address, based on the PTR record.

I won't explain how it works; I'll leave that up to the readers. :-)
It catches all host names that have either the IP address or
reversed IP address somehow embedded in them.  For example,
for the host 11.22.33.44 it catches:

11-22-33-44-dynamic.isp.net
rev-44332211.foo.com
... etc...

Regards,

David.

sub likely_dynamic {
        # $hostname is PTR record; $ipaddr is IP address
        my ($hostname, $ipaddr) = @_;
        my ($a, $b, $c, $d) = split(/\./, $ipaddr);
        $hostname =~ s/[^0-9]//g;
        return (index($hostname, "$a$b$c$d") >= 0) ||
               (index($hostname, "$d$c$b$a") >= 0);
}
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to