checker (950 bytes)
1 #!/usr/bin/perl 2 use LWP::UserAgent; 3 use LWP::Protocol::socks; 4 for(@ARGV) { 5 if($_ eq '-h' or $_ eq '--help') { 6 die "-h for help\n-t [seconds] for timeout of checks. Default 5 seconds\n-v for verbose output\n"; 7 } 8 if($_ eq '-t') { 9 shift @ARGV; #get -t out of @ARGV 10 $timeout = shift @ARGV; #Get the number after it 11 } 12 if($_ eq '-v') { 13 shift @ARGV; #Get -v out of @ARGV 14 $verbose = 1; 15 } 16 } 17 $timeout = 5 unless(defined($timeout)); 18 my $ua = LWP::UserAgent->new; 19 $ua->timeout($timeout); 20 my $google = 'https://www.google.com'; 21 while(<STDIN>) { #Each input line looks like 1.1.1.1:1111 22 chomp($_); 23 $ua->proxy(['https', 'http', 'ftp'], "socks://$_"); 24 $site = $ua->get($google); 25 print "Checking $_\n" if($verbose); 26 sleep($timeout); 27 if($site->is_success) { 28 print "$_\n"; 29 print "Success\n" if($verbose); 30 } else { 31 print "Failed\n" if($verbose); 32 } 33 }