#!/usr/bin/perl
# ProxyHunter 0.4
# By Sock (http://www.socklabs.com)
# ChangeLog
# 18.5.2004 First release
use strict;
#use warnings;
use LWP::UserAgent;
use HTTP::Request::Common;
use Getopt::Long;
my $opt_page = 1;
our %info = (version => "0.4",
format => 0,
agent => "Sock's Proxy Hunter/0.3",
clear => 0,
anonymous => 0,
spranonymous => 1,
elite => 1
);
our @data;
our @marks;
# Lets define the data structure for the proxy array
# ip/host, port, type, country, anon level, use (0 no:1 yes)
push @data, {
host => '127.0.0.1',
port => 8080,
type => "http",
country => "USA",
level => "http",
use => 0,
};
# Name, target page, clear all whitespace (1 yes, 0 no)
push @marks, [1, "Stayinvisible.com", "http://www.stayinvisible.com/in
+dex.pl/proxy_list?order=&offset=0", 1];
push @marks, [1, "PublicProxyServer.com", "http://www.publicproxyserve
+rs.com/page1.html", 1];
push @marks, [1, "Proxy4Free.com", "http://www.proxy4free.com/page1.ht
+ml", 1];
print <<"EOF";
ProxyHunter $info{version}
(c) 2003-2004 Sock
Released without warranty under the terms of the Artistic License.
EOF
our $opt_debug;
our $opt_format;
our $opt_verbose;
GetOptions("help|?",\&showhelp, "debug", \$opt_debug, "page=s", \$opt_
+page, "output=s", \$opt_format, "verbose|v", \$opt_verbose);
sub showhelp() {
print << "EOF" ;
Usage: $0 [options] dir1 dir2 file1 file2 ...
Options:
--debug Show extra debug information
--spage=x Set the page to read from on the stayinvis website. Not U
+sed
--output=x Set the output format. See examples:
[0] 192.168.1.1 80
[1] http 192.168.1.1 8080 # Highly Anonymous - Russia
[2] 192.168.1.1:80\@http
--help Display this help message
EOF
exit;
}
our $debug = $opt_debug;
our $format = $opt_format ? $opt_format : $info{format};
our $t = 0;
print "Debug option set.\n" if ($debug);
#stayinvis();
markloop();
sub markloop() {
foreach my $m (@marks) {
if ($m->[0] == 1) {
print "[+Scan] Starting engine for $m->[1]\n";
print " [Debug] Initilizing agent.\n" if ($debug);
my $proxhunter = LWP::UserAgent->new();
$proxhunter->agent($info{agent});
print " [Debug] Retrieving site: $m->[2].\n" if ($debug);
my $http_res = $proxhunter->request(POST $m->[2]);
my $stuff = $http_res->content;
print " [Debug] Error pulling site contents.\n" and return
+ unless ($http_res->is_success);
if ($m->[3] == 1){
print " [Debug] Removing white spaces.\n" if ($debug);
$stuff =~ s/\s//g;
}
print " [Debug] Sifting through results.\n" if ($debug);
while ($stuff =~ m/<td[^>]*>(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d
+{1,3})<\/td><td[^>]*>(\d{1,5})<\/td><td[^>]*>(\w*)<\/td><td[^>]*>(\w*
+)<\/td>/g) {
$t++;
my $use_this;
for ($3) {
/transparent/ && $info{clear} == 1 && do {$use_thi
+s = 1; last;};
/anonymous/ && $info{anonymous} == 1 && do {$use_t
+his = 1; last;};
/highanonymity/ && $info{spranonymous} == 1 && do
+ {$use_this = 1; last;};
}
print " [Debug] Found: $1, $2, $3, $4, use $use_this\n
+" if ($debug);
push @data, {
host => $1,
port => $2,
type => "http",
country => $3,
level => $4,
use => $use_this,
};
# push @data, [$1, $2, "http", $3, $4, "$use_this"];
}
print "[-Scan] Stopping engine for $m->[1]\n\n";
}
}
}
(my $sec, my $min, my $hour, my $mday, my $mon, my $year, my $wday, my
+ $yday, my $isdst)=localtime(time);
$mon++;
my $g;
my $outfile = "n$min"."h$hour"."d$mday"."m$mon".".proxylist";
print "Setting output file as $outfile.\n" if ($debug);
open(fileOUT, ">>$outfile");
foreach my $d (@data) {
if ($d->{use} == 1) {
$g++;
if ($format == 0) {print fileOUT "$d->{host}:$d->{port}\n";}
if ($format == 1) {print fileOUT "$d->{type}\t$d->{host}:$d->{port
+} #$d->{country} - $d->{level}\n";}
if ($format == 2) {print fileOUT "$d->{host}:$d->{port}\@$d->{type
+}\n";}
}
}
close(fileOUT);
print "All tasks complete. Loaded $g out of $t proxies.\n";
exit;
|