#!/usr/bin/perl -w
# oct-2001
# scanproxies.pl to proxy-list.txt
use warnings;
use diagnostics;
use Net::HTTP;
use LWP::UserAgent;
use HTML::LinkExtor;
$proa = LWP::UserAgent->new (agent => 'Mozilla/4.0 (compatible; MSIE 4.0; Windows NT 4.0)', timeout=>10);
open ($INPUT, 'proxy-list.txt') || die "can't open $file: $!"; # dumpster is proxy-list.txt file.
@proxy=<$INPUT>;
close($INPUT) || die "can't close $file: $!";
@checkedproxy=();
for (@proxy) {
chomp;
$proa->proxy(['http', 'ftp'], "http://$_/");
($add, $port)= split(/:/, $_);
print $add.':'.$port;
my $url = 'http://www.cnn.com'; # no trailing / char. ok?
my $req = new HTTP::Request 'GET' => $url;
my $htmlcode = $proa->request($req)->content;
if ($htmlcode=~m/<form /i) {print "Okay.n"; push (@checkedproxy, $_);}
}
open ($OUTPUT, ">proxy-list.txt") || die "can't open $file: $!";
for (@checkedproxy) { print $OUTPUT $_."n";}
close($OUTPUT) || die "can't close $file: $!";