Vkontakte.ru Groups Spammer
Многопоточный, через акк на anti-captcha.com.
Для работы:
создать папку
tmp с правами на запись
поставить нужные perl модули (
IO::All, LWP::Protocol::Socks и другие)
создать файл с сообщением в
utf-8(без
bom) и файл с группами
также для адекватной работы лучше бронировать капчи.
Код:
#!/usr/bin/perl -w
###############################
# Vkontakte.ru Groups Spammer
# (c) [dei] 369-476-512
###############################
############ Config ###############
$threads = 5; # количество потоков
$use_socks = 0; # 1/0
$socks = 'xxx'; # socks - proxy:port
$key = 'xxx'; # anti-captcha.com key
$groups = 'groups.txt';
$mess = 'mess.txt'; # месага в кодировке UTF-8
$acs = 'acs.txt'; # аккаунты
################################
use LWP::UserAgent;
use HTTP::Cookies;
use HTTP::Request::Common qw(GET POST);
use MIME::Base64 qw(encode_base64);
use IO::All;
use threads;
use threads::shared;
sub login( $$ ) {
my $em = $_[0];
my $cookies = $em;
my $pa = $_[1];
$em =~ s/@/%40/;
my $ua = LWP::UserAgent->new;
if($use_socks) { $ua->proxy([qw(http https)] => 'socks://'.$socks); }
$ua->agent('Opera/9.62 (Windows NT 6.0; U; ru) Presto/2.1.1');
$ua->cookie_jar(HTTP::Cookies->new(file => 'tmp/'.$cookies, autosave => 1));
my $req = HTTP::Request->new(POST=>'http://vkontakte.ru/login.php');
$req->referer('http://vkontakte.ru/');
$req->content_language('ru');
$req->content_type('application/x-www-form-urlencoded');
$req->content("email=$em&pass=$pa");
my $result = $ua->request($req);
if($result->code == 302) { return 1; }
else {
while($result->content =~ /<IMG SRC='http:\/\/vkontakte\.ru\/(captcha\.php\?sid=([^']*))'\/>/i)
{
if(!($code = anticaptcha('http://vkontakte.ru/'.$1))) {
print "captcha problems\n"; return 0; }
my $sid = $2;
$req = HTTP::Request->new(POST=>'http://vkontakte.ru/login.php');
$req->referer('http://vkontakte.ru/login.php');
$req->content_language('ru');
$req->content_type('application/x-www-form-urlencoded');
$req->content('email='.$em.'&pass='.$pa.'&ccode='.$code.'&csid='.$sid);
$result = $ua->request($req);
if($result->code == 302) { return 1; }
elsif($result->content =~ /<div id='message'>/) {
my $u = "http://anti-captcha.com/res.php?key=$key&action=reportbad&id=$cid";
$ua->request(GET $u);
next;
}
else { return 0; }
}
}
}
sub myrand( $ ) {
my $int='';
for(my $i=1;$i<=$_[0];$i++) { $int .= int(rand(10)) }
return $int;
}
sub anticaptcha ( $ ) {
my $url = $_[0];
my $fname = 'tmp/'.myrand(6).'.jpg';
my $ua = LWP::UserAgent->new;
$ua->agent('Opera/9.62 (Windows NT 6.0; U; ru) Presto/2.1.1');
my $count = 1;
while( my $result = $ua->request(HTTP::Request->new(GET=>$url), $fname)) {
my $u = 'http://anti-captcha.com/in.php';
$answ = $ua->request(POST $u,
Content_Type => 'form-data',
Content => [ method => 'base64',
key => $key,
body => encode_base64( io($fname)->all ),
ext => 'jpg'
]);
unlink $fname;
if(!($answ->is_success)) { $count++; redo; }
if($answ->content =~ /^OK\|(\d+)$/) {
$cid = $1;
sleep(7);
if(my $code = getccode($cid)) { return $code; }
}
elsif($answ->content =~ /ERROR_NO_SLOT_AVAILABLE/) { sleep(10); print next; }
elsif($answ->content =~ /ERROR_IMAGE_IS_NOT_JPEG/) { print next; }
elsif($answ->content =~ /ERROR_WRONG_USER_KEY/) { print "\nERROR_WRONG_USER_KEY\n\n"; exit;}
if($count == 5) { print "Cannt connect to Anti-Captcha.\n"; return 0; }
return 0;
}
}
sub getccode ( $ ) {
my $cid = $_[0];
my $count = 1;
my $ua = LWP::UserAgent->new;
$ua->agent('Opera/9.62 (Windows NT 6.0; U; ru) Presto/2.1.1');
while(my $c = $ua->request(HTTP::Request->new(
GET=>"http://anti-captcha.com/res.php?key=$key&action=get&id=$cid")))
{
$cap = $c->content;
if($cap =~ /^OK\|(.+)$/) { return $1; }
elsif($cap =~ /^ERROR.+/) {
print "[error]\n";
return 0;
}
if($count == 10) { return 0; }
$count++;
sleep(5);
}
}
sub spamgroup( $ ) {
my $cookies = $email;
my $group = $_[0];
my $gurl = 'http://vkontakte.ru/club'.$group;
my $ua = LWP::UserAgent->new;
if($use_socks) { $ua->proxy([qw(http https)] => 'socks://'.$socks); }
$ua->max_redirect(0);
$ua->agent('Opera/9.62 (Windows NT 6.0; U; ru) Presto/2.1.1');
$ua->cookie_jar(HTTP::Cookies->new(file => 'tmp/'.$cookies));
my $req = HTTP::Request->new(GET=>$gurl);
$req->referer('http://vkontakte.ru/groups.php?'.myrand(5));
my $result = $ua->request($req);
if($result->code == 302) {
#print "#$c ";
print "[BAD ACC] ".$email."\n";
unlink 'tmp/'.$cookies;
$email = &get_acc;
return 0; }
if($result->content !~ /makeFRequest\('wall\.php\?(act=get10\&wall_hash=[^']*)/) {return 0;}
my $wall = $1;
my $url = 'http://vkontakte.ru/wall.php?'.$wall;
$result->content =~ /"(g\d+)"/;
my $gid = $1;
sleep(3);
$req = HTTP::Request->new(POST=>$url);
$req->referer($gurl);
$req->content_language('ru');
$req->content_type('application/x-www-form-urlencoded');
$req->content('seed='.io($mess)->all.'&fpage=1&mid='.$gid.'&n=3');
$result = $ua->request($req);
if($result->code == 302) {
#print "#$c ";
print "[BAD ACC] ".$email."\n";
unlink 'tmp/'.$cookies;
$email = &get_acc;
return 0; }
if($result->content =~ /<img src="(captcha\.php\?sid=([^"]*))"\/>/) {
if(!($code = anticaptcha('http://vkontakte.ru/'.$1))) {
print "captcha problems\n"; return 0; }
$sid = $2;
$req = HTTP::Request->new(POST=>'http://vkontakte.ru/wall.php');
$req->referer($gurl);
$req->content_language('ru');
$req->content_type('application/x-www-form-urlencoded');
$req->content($wall.'&n=3&seed='.io($mess)->all.
'&code='.$code.'&mid='.$gid.'&sid='.$sid);
$result = $ua->request($req);
if($result->code == 200) { return 1; }
elsif($result->code == 302) {
print "[BAD ACC] ".$email."\n";
unlink 'tmp/'.$cookies;
$email = &get_acc;
return 0; }
} elsif($result->code == 200) { return 1; }
return 0;
}
sub spam( $ ) {
local $c = $_[0];
local $email = &get_acc;
@ids = io($groups)->slurp;
for(my $i=$c;$i<=9;$i+=$threads) {
my $id = $ids[$i];
$id =~ s/[\n\r]//g;
if(spamgroup($id)) {
#print "#$c ";
print "[SPAMED] ".$id."\n"; }
else {
#print "#$c ";
print "[ERROR] ".$id."\n"; }
}
unlink 'tmp/'.$email;
}
sub get_acc {
my $k = 1;
my @a = io($acs)->slurp;
for(my $i=0;$i<=$#a;$i++) {
if(@used) {
my $v = $used[$#used];
if($a[$i] =~ /^$v/) { $k = 0; next; }
else { if($k) { next; } }
}
my $line = $a[$i];
$line =~ s/\n|\r$//g;
my($e,$p)=split(':',$line);
if(login($e,$p)) {
print "[ACC][USE] ".$e."\n";
push (@used,$e);
return $e;
} else {
print "[ACC][BAD] ".$e."\n";
unlink 'tmp/'.$e;
}
}
die("ERROR: end of accounts!\n");
}
my @threadz;
our @used : shared;
for my $i (0..($threads-1)) {
push @threadz, threads->create(\&spam, $i);
sleep(7);
}
foreach my $thread (@threadz) {
$thread->join();
}