Here is a simple HTTP proxy checker written in Perl. It tries to connect through the proxy to a proxy judge website to determine whether or not the proxy is anonymous.
#!/usr/bin/env perl
#####################################################
## HTTP Proxy Checker
##
## Usage: ./http_proxy_check.pl -f proxies.txt
##
## Proxy file format: IP:PORT^TYPE
##
## Author: Sam
#####################################################
use strict;
use warnings;
use Getopt::Std;
use LWP::UserAgent;
my @proxy_judge = (
'http://httpheader.net/azenv.php',
'http://mojeip.net.pl/asdfa/azenv.php',
'http://faucet.luis.im/azenv.php',
'http://www.sbjudge4.com/azenv.php',
'http://www.wfuchs.de/azenv.php'
);
print <new(timeout => 10);
while (my $proxy = <$fh>) {
chomp($proxy);
my ($host, $type) = split(/\^/, $proxy);
$type =~ s/\n//g;
$user_agent->proxy(['http','https'] => "http://".$host."/");
print "[*] Checking proxy: ".$host."\n";
my $lag_start = time();
my $response = $user_agent->get($proxy_judge[int(rand(@proxy_judge))]);
my $anonymity;
if ($response->is_success) {
my $lag_end = time();
my @headers = (
'VIA',
'X-FORWARDED-FOR',
'X-FORWARDED',
'FORWARDED-FOR',
'FORWARDED-FOR-IP',
'FORWARDED',
'CLIENT-IP',
'PROXY-CONNECTION' );
foreach my $header (@headers) {
if ($response->decoded_content =~ $header) {
$anonymity = "None";
} else {
$anonymity = "Anonymous";
}
}
print "[+] ".$host." // (".$response->status_line.") // Type: ".$type." // Anonymity Level: ".$anonymity." // Lag: ".($lag_end-$lag_start)."s\n";
} else {
print "[-] ".$host." // (CONNECT ERROR)\n";
}
sleep 1;
}
When we run the script, we get the following result:
C:\Users\Sam\Desktop\Code\proxy>perl proxy.pl -f proxies.txt **************************************** * * * HTTP Proxy Checker * * * * ./http_proxy_check.pl -f proxies.txt * * * **************************************** [*] Checking proxy: 122.155.165.191:3128 [+] 122.155.165.191:3128 // (200 OK) // Type: HTTPS // Anonymity Level: Anonymous // Lag: 1s [*] Checking proxy: 122.50.5.148:10000 [+] 122.50.5.148:10000 // (200 OK) // Type: HTTP // Anonymity Level: Anonymous // Lag: 3s [*] Checking proxy: 122.58.118.224:8080 [-] 122.58.118.224:8080 // (CONNECT ERROR) [*] Checking proxy: 128.199.218.83:8080 [+] 128.199.218.83:8080 // (200 OK) // Type: HTTPS // Anonymity Level: Anonymous // Lag: 1s [*] Checking proxy: 150.109.148.159:8888 [+] 150.109.148.159:8888 // (200 OK) // Type: HTTP // Anonymity Level: Anonymous // Lag: 1s [*] Checking proxy: 182.52.131.40:8080 [+] 182.52.131.40:8080 // (200 OK) // Type: HTTPS // Anonymity Level: Anonymous // Lag: 2s [*] Checking proxy: 183.182.101.32:30531 [-] 183.182.101.32:30531 // (CONNECT ERROR) [*] Checking proxy: 186.149.103.227:999 [+] 186.149.103.227:999 // (200 OK) // Type: HTTP // Anonymity Level: Anonymous // Lag: 12s [*] Checking proxy: 186.251.94.166:8080 [-] 186.251.94.166:8080 // (CONNECT ERROR) [*] Checking proxy: 188.166.216.203:8080 [+] 188.166.216.203:8080 // (200 OK) // Type: HTTPS // Anonymity Level: Anonymous // Lag: 1s [*] Checking proxy: 192.109.165.129:80 [+] 192.109.165.129:80 // (200 OK) // Type: HTTP // Anonymity Level: Anonymous // Lag: 0s C:\Users\Sam\Desktop\Code\proxy>
No comments:
Post a Comment