Wednesday, May 16, 2007

A Perl Tool To Check HTTP Proxies

Proxy Checker: only support to check http proxies.
#!/usr/bin/perl -w 
#$file:proxy_check.pl - a simple tool to check http proxy

use strict;
use LWP::UserAgent;

my $proxy_list = "/root/proxy_list.txt";
my $test_url = "http://www.mysite.com/";

print "starting...\n";

open(FD,"$proxy_list") || die "can't open file $!";

while() {
  chomp($_);
  my $proxy = $_;
  my $ua = LWP::UserAgent->new;
  $ua->timeout(20);
  $ua->proxy(['http'],$proxy);
  my $response = $ua->get($test_url);

  if ($response->is_success) {
     print "(Yes) $proxy\n";
  }
}
proxy_list.txt: http://200.69.106.161:80 http://200.208.228.52:3128 http://202.143.133.194:8080 http://201.54.163.158:6588 http://201.56.115.242:8080

0 comments:

 
Blogger Template Layout Design by [ METAMUSE ] : Code Name Gadget 1.1 Power By freecode-frecode.blogger.com & blogger.com Programming Blogs - BlogCatalog Blog Directory