Hack Forums
>>SOCKS proxy checker SOURCE RELEASE<< - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45)
+--- Forum: Blackhat • Red Team • Offensive Security (https://hackforums.net/forumdisplay.php?fid=447)
+---- Forum: Hacking Tools and Programs (https://hackforums.net/forumdisplay.php?fid=10)
+---- Thread: >>SOCKS proxy checker SOURCE RELEASE<< (/showthread.php?tid=4769050)



>>SOCKS proxy checker SOURCE RELEASE<< - Brasil - Apr 8, 2015

I made a program that you feed proxies like this:
Code
1.1.1.1:1111
2.2.2.2:2222
3.3.3.3:3333
et cetera
and it checks them against GOOGLE. You can specify the timeout for each proxy. When it is done it prints out something like this:
Code
1.1.1.1:1111
3.3.3.3:3333
So you know that those two proxies worked, and that
Code
2.2.2.2:2222
didn't work.
The code
Code
#!/usr/bin/perl
use LWP::UserAgent;
for(@ARGV) {
    if($_ eq '-h' or $_ eq '--help') {
        die "-h for help\n-t [seconds] for timeout of checks. Default 5 seconds\n-v for verbose output\n";
    }
    if($_ eq '-t') {
        shift @ARGV; #get -t out of @ARGV
        $timeout = shift @ARGV; #Get the number after it
    }
    if($_ eq '-v') {
        shift @ARGV; #Get -v out of @ARGV
        $verbose = 1;
    }
}
$timeout = 5 unless(defined($timeout));
my $ua = LWP::UserAgent->new;
$ua->timeout($timeout);
my $google = 'https://www.google.com';
while(<STDIN>) { #Each input line looks like 1.1.1.1:1111
    chomp($_);
    $ua->proxy(['https', 'http', 'ftp'], "socks://$_");
    $site = $ua->get($google);
    print "Checking $_\n" if($verbose);
    sleep($timeout);
    if($site->content =~ /<!doctype html>/) {
        print "$_\n";
        print "Success\n" if($verbose);
    } else {
        print "Failed\n" if($verbose);
    }
}
Installation:

Linux
  • Create file 'checker' you can:
    Code
    user@box$ touch checker
  • chmod checker you can:
    Code
    user@box$ chmod 755 checker
  • install LWP::UserAgent and LWP::Protocol::socks
    Code
    user@box$ cpan LWP::UserAgent LWP::Protocol::socks
  • edit checker and put my source in there. Here is how to open gedit from command line, but you can use any basic text editor. DON'T USE A WORD PROCESSOR LIKE LIBRE OFFICE OR MS WORD!
    Code
    user@box$ gedit checker
  • execute checker in CLI by feeding it proxies in the specified format. If you need a scraper I can hook you up with one, PM me. Here is how I do it with my scrapers (which are coded by me to output in the proper format.)
    Code
    user@box$ ./scraper_name | ./checker -t 3 | tee out_proxies.txt
    If you don't know what that meant, it just pipes the output from scraper_name to checker and pipes the output of checker to tee which is a built in linux command that prints the piped input into a file AND your standard output. In other words, you see it on your screen and it goes into out_proxies.txt at the same time.
    an alternative is
    Code
    user@box$ ./scraper_name | ./checker -t 3 > out_proxies.txt
    which writes to out_proxies.txt and doesn't print anything to your screen. (I like to watch it, so tee is for me)
Windows
(can be done, but requires lots of effort)
Interpreting the source in windows is alot different, and this post is really targeted towards savvy linux users, not lazy windozers (sorry guys). That being said you can still interpret it in windows with something like activestate of strawberry perl. You can even compile it with PAR::Packer, but you don't need to.
Here is a link:
http://strawberryperl.com/

I am selling scrapers to go with this, as well as my own scraper-checker windows executables; that being said you are free to make your own scrapers or do pretty much whatever you want with the above code.


* - Pseudonym - Apr 8, 2015

It should be noted, that this won't work without installing LWP::Protocol::socks


* - Brasil - Apr 9, 2015

(Apr 8, 2015 03:38 PM)Pseudonym Wrote:  It should be noted, that this won't work without installing LWP::Protocol::socks
Yep, I changed the installation instructions, thanks!
I like your sig too, they are the #1 reason why I learned perl in the first place.


* - j0hncart3r - Nov 23, 2016

Hello Brasil,
so this tool is capable to test http, https, ftp and socks proxy?
And why I need scrapers? If I`ve a list of ip address and port how can I check with this tool?

Thanks