#!/usr/bin/perl #Proxy-tester __GiReX__ #Data una lista di proxy IP:PORTA use LWP::UserAgent; sub getip { my $ip = ''; my @content = split('\n', shift); foreach $line(@content) { if($line =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/) { $ip = $1; last; } } return $ip; } if(!$ARGV[0] || !$ARGV[1]) { print "usage: perl $0 \n"; exit 1; } my $ua = new LWP::UserAgent; my $list = shift; my $timeout = shift; my $host = "http://www.myip.dk/"; $ua->timeout($timeout); get_my_ip :{ $res = $ua->get($host); $my_ip = getip($res->content) or die "unable to retrieve real IP from myip.dk\n"; print "Il tuo ip: ${my_ip}\n"; } open(LIST, "<", "$list") or die "cannot read file ${list}\n"; while(chomp($proxy = )) { print "[${proxy}]\t"; $ua->proxy('http', "http://${proxy}/"); $res = $ua->get($host); if($res->is_success) { $proxy_ip = getip($res->content); ($proxy_ip eq $my_ip) ? print "trasparent proxy\n": print "anonymous proxy\n"; } else { print "connection failed\n"; } } close(LIST);