#!/usr/bin/perl
use Net::DNS;
my $separator=':';
my $res=Net::DNS::Resolver->new;
while (<>){
chomp;
my ($host,$port) = split(/$separator/o,$_);
if ($host=~m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/o){
my $dnspack = $res->query("$4.$3.$2.$1.in-addr.arpa",'PTR');
if ($dnspack){
foreach my $rdata ($dnspack->answer){
my $rstr=$rdata->rdatastr;
$rstr=~s/\.$//o;
print "$rstr$separator$port\n";
}
} else {
print "$host$separator$port\n";
}
} else {
print "$host$separator$port\n";
}
}
__END__
=head1 NAME
ip2dns convert proxy list from IP:PORT fromat to HOST:PORT format
=head1 SYNOPSIS
ip2dns < ip_port.txt > host_port.txt
=1=
THE END |