commit e4ea00e926928825bc2b9690fc63c8e4a01fe065 Spenser Truex <spensertruexonline@gmail.com> 2019-03-31 20:03:12 -0700 Added first update.
.gitignore | 2 ++ README.md | 14 ++++++++++++++ checker | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+)
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..07c69d0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +proxies +success.txt diff --git a/README.md b/README.md index 45434c8..a97ec01 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,16 @@ # proxyverif Check socks proxies whether they are alive or non-responsive (ping through them). + +# Install + +``` shell +git clone git@github.com:equwal/proxyverif.git +cd proxyverif +chmod 755 checker +cat example.txt | checker -v +``` +For a more friendly but harder to monitor output: + +``` shell +cat example.txt | checker | tee success.txt +``` diff --git a/checker b/checker new file mode 100755 index 0000000..4c30ad5 --- /dev/null +++ b/checker @@ -0,0 +1,33 @@ +#!/usr/bin/perl +use LWP::UserAgent; +use LWP::Protocol::socks; +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->is_success) { + print "$_\n"; + print "Success\n" if($verbose); + } else { + print "Failed\n" if($verbose); + } +}