Author:
biophreak
Description: Распределение тредов, кривое, што пиздец!
Language: Perl
use constant THREADS => 50;
my $sockslist = shift || exit print "[ERROR] Specify sockslist!\n$0 <socks list> [socks4 sorted list] [socks5 sorted list]\n";
open my $S, '<', $sockslist or die "Cannot open file $sockslist: $!\n";
my @socks = <$S> and close $S;
my($answer,@thr,%spl_socks);
my $proxyperthr = (scalar(@socks) / THREADS);
exit print "Threads are more then proxys =)\n" if(THREADS > scalar@socks);
for(my $i = 1;$i <= THREADS;$i++)
{
last if scalar @socks <= 0;
push(@{$spl_socks{"sock".$i}}, shift @socks) for(1..$proxyperthr);
push(@{$spl_socks{"sock".$i}},shift @socks) if(scalar @socks > 0 and scalar @socks > 2*$proxyperthr);
push(@{$spl_socks{"sock".$i}}, @socks) if($i == THREADS and scalar @socks > 0);
}
foreach my $sck(%spl_socks)
{
if(exists $spl_socks{$sck})
{
threads->create(\&ch,@{$spl_socks{$sck}});
}
}
$_->join foreach(threads->list);
|
Recent pastes:
123123123 (PHP)
ksurent (Perl)
ksurent (Bash)
guata (Plain Text)
biophreak (Plain Text)
Raik (PHP)
MUSbKA (Plain Text)
MUSbKA (Plain Text)
nekitozzz (C++)
nekitozzz (Plain Text)
nekitozzz (C++)
ksurent (Perl)
MUSbKA (C++)
stalin_alex (C++)
dzantiev (Plain Text)
unreal (C++)
eug2b (Plain Text)
|