Detecting hosts with dynamic addresses (was Re: [Mimedefang] Another silly idea)
David F. Skoll
dfs at roaringpenguin.com
Wed May 3 08:43:37 EDT 2006
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);
}
More information about the MIMEDefang
mailing list