muhstik

- irc flooding solution
git clone git://git.acid.vegas/muhstik.git
Log | Files | Refs | Archive | README

dns2ip.pl (607B)

      1 #!/usr/bin/perl
      2 
      3 use Net::DNS;
      4   
      5 my $separator=:;
      6 my $res=Net::DNS::Resolver->new;
      7 
      8 while (<>){
      9 	chomp;
     10 	my ($host,$port) = split(/$separator/o,$_);
     11 	unless ($host=~m/^\d+\.\d+\.\d+\.\d+$/o) {
     12 		my $dnspack = $res->query($host,A);
     13 		if ($dnspack){
     14 			foreach my $rdata ($dnspack->answer){
     15 				my $rstr=$rdata->rdatastr;
     16 				print "$rstr$separator$port\n";
     17 			}
     18 		} else {
     19 			print "$host$separator$port\n";
     20 		}
     21 	} else {
     22 		print "$host$separator$port\n";
     23 	}
     24 }
     25 
     26 __END__
     27 
     28 =head1 NAME
     29 
     30 dns2ip - convert proxy list from HOST:PORT fromat to IP:PORT format
     31 
     32 =head1 SYNOPSIS
     33 
     34 dns2ip < host_port.txt > ip_port.txt