Jump to content
XopcX

Socks checker for linux

Recommended Posts

Posted

un mic script perl pentru a verifica socks

#!/usr/bin/perl

use IO::Socket::Socks;

#use strict;

#use warnings;

my $file = 'list.txt';

open (FILE, "$file") || die "Could not open $file\n";

my @data = <FILE>;

close FILE;

my $socksdata;

foreach my $socks (@data) {

eval {

my $status = 'FAILED';

local $SIG{ALRM} = sub {print ' ' . $status . "\n";goto ALARM;};

alarm 5;

chomp $socks;

print $socks;

my ($socks_ip,$socks_port) = split(/\:/,$socks);

my $socket = new IO::Socket::Socks( ProxyAddr=>"$socks_ip", ProxyPort=>"$socks_port", ConnectAddr=>"mail.goldhost.com", ConnectPort=>"25") or next;

if ($socket) {

print $socket "QUIT\r\n";

}

while (my $res = <$socket>) {

if ( $res =~ /^220/) {

$status = 'SUCCESS';

}

}

close($socket);

if ($status eq 'SUCCESS') {

$socksdata .= $socks . "\n";

}

print ' ' . $status . "\n";

alarm 0;

ALARM:

}

}

open FH, ">$file";

print FH $socksdata;

close FH;

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...