murich
Постоялец
- Регистрация
- 10 Фев 2007
- Сообщения
- 143
- Реакции
- 18
- Автор темы
- #1
нуждаюсь в небольшом (около 25) аккаунтов гмейл в сутки, но не хочу покупать аки всевремя и следить затем, есть они или нет. Посему решил написать регистратор. Думал, справлюсь быстро - переписано таких прог уже мной... Но блин с гмейлом этим проблема... говорит плохая каптча. Кстати, каптча разгадывается сервисом Для просмотра ссылки Войди или Зарегистрируйся, разгадывается успешно.
Вобщем, вот код:
captchabot.class.php :
Посмотреть вложение surnames.txt
Посмотреть вложение firstnames.txt

Вобщем, вот код:
Код:
<?
require('captchabot.class.php');
class reggmail
{
var $debug = 1; //debug mode
var $ch;
var $action;
var $dsh;
var $captchaurl;
var $newaccounttoken_audio;
var $newaccounturl_audio;
var $program_policy_url = 'http://mail.google.com/mail/help/intl/en/program_policies.html';
var $privacy_policy_url = 'http://www.google.com/intl/en/privacy.html';
var $login;
var $newaccountcaptcha;
var $pwd;
var $FirstName;
var $LastName;
var $SecondaryEmail = '';
var $newaccounttoken;
function reggmail()
{
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($this->ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, false);
$names = file('firstnames.txt');
$surs = file('surnames.txt');
$this->FirstName = trim($names[mt_rand(0, 999)]);
$this->LastName = trim($surs[mt_rand(0, 499)]);
$rand = rand(0,3);
if($rand == 0) $this->email = strtolower($this->FirstName.".".$this->LastName);
if($rand == 1) $this->email = strtolower($this->FirstName.".".$this->LastName."19".rand(65,86));
if($rand == 2) $this->email = strtolower($this->FirstName.$this->gen_pwd());
if($rand == 3) $this->email = strtolower($this->FirstName.$this->LastName.$this->gen_pwd());
}
function gen_pwd()
{
$chars = 'qwertyuiopasdfghjklzxcvbnm1234567890';
$l = rand(8, 12);
$o = 0;
$pwd = '';
while($o < $l){
$pwd .= $chars[mt_rand(0, 35)];
$o++;
}
return $name;
}
function get_vars()
{
curl_setopt($this->ch, CURLOPT_URL, 'http://mail.google.com/mail/signup');
$regpage = curl_exec($this->ch);
preg_match('!id="dsh"\n.*value="(.*)"!', $regpage, $k);
$this->dsh = $k[1];
preg_match('!id="newaccounttoken_audio"\n.*value="(.*)"!', $regpage, $k);
$this->newaccounttoken_audio = $k[1];
preg_match('!id="newaccounttoken"\n.*value="(.*)"!', $regpage, $k);
$this->newaccounttoken = $k[1];
preg_match('!id="newaccounturl_audio"\n.*value="(.*)"!', $regpage, $k);
$this->newaccounturl_audio = $k[1];
preg_match('!https\:\/\/www\.google\.com\/accounts\/Ca(.*)\'!', $regpage, $k);
$this->captchaurl = 'https://www.google.com/accounts/Ca'.$k[1];
preg_match('!name="createaccount" action=\'(.*)\'!', $regpage, $k);
$this->action = rawurldecode(html_entity_decode($k[1]));
if($this->debug)
{
$f = fopen('gmailregpage.htm', 'w');
fwrite($f, $regpage);
fclose($f);
}
}
function decaptcha()
{
global $oc;
curl_setopt($this->ch, CURLOPT_URL, $this->captchaurl);
curl_setopt($this->ch, CURLOPT_REFERER, 'http://mail.google.com/mail/signup');
$ck = curl_exec($this->ch);
file_put_contents('ch.jpg', $ck);
$this->newaccountcaptcha = $oc->Recognize('ch.jpg');
}
function reg_gmail()
{
$this->pwd = $this->gen_pwd();
$this->get_vars();
$this->decaptcha();
if($this->newaccountcaptcha == '') die(' Получена херовая каптча: '.$this->newaccountcaptcha);
$postfields = 'type=2&loc=US&dsh='.$this->dsh.'&ktl=&ktf=&FirstName='.urlencode($this->FirstName).'&LastName='.urlencode($this->LastName).'&UsernameSelector=header&Email='.urlencode($this->email).'&edk=gmail.com&Passwd='.urlencode($this->pwd).'&PasswdAgain='.urlencode($this->pwd).'&PersistentCookie=yes&rmShown=1&smhck=1&nshk=1&selection='.urlencode('What is your primary frequent flyer number').'&ownquestion=&IdentityAnswer=100500lamo&SecondaryEmail=&loc=US&newaccounttoken='.urlencode($this->newaccounttoken).'&newaccounturl='.urlencode($this->captchaurl).'&newaccounttoken_audio='.urlencode($this->newaccounttoken_audio).'&newaccounturl_audio='.urlencode($this->newaccounturl_audio).'&newaccountcaptcha='.urlencode($this->newaccountcaptcha).'&program_policy_url='.urlencode('http://mail.google.com/mail/help/intl/en/program_policies.html').'&privacy_policy_url='.urlencode('http://www.google.com/intl/ru/privacy.html').'&requested_tos_location=US&requested_tos_language=en&served_tos_location=US&served_tos_language=en&submitbutton='.urlencode('I accept. Create my account.');
echo $this->action;
curl_setopt($this->ch, CURLOPT_URL, $this->action);
curl_setopt($this->ch, CURLOPT_POST, 1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $postfields);
$p = curl_exec($this->ch);
if($this->debug)
{
$f = fopen('regresult.htm', 'w');
fwrite($f, $p);
fclose($f);
}
}
}
$u = new reggmail();
$u->reg_gmail();
echo $u->email.' '.$u->pwd.' '.$u->newaccountcaptcha.' '.$u->captchaurl;
?>
Код:
<?
class OCR {
var $url;
var $host;
var $id;
function OCR()
{
$this->url="http://captchabot.com/xmlrpc/axmlrpc.php";
$this->host="captchabot.com";
$this->Username="";
$this->Password="";
}
function Recognize($file, $language=0)
{
$s2='';
$contents=file_get_contents($file);
//$contents=$file;
if (!$contents) return 200;
$converted=base64_encode($contents);
$request="<methodCall><methodName>ocr_server::analyze</methodName><params>";
$request.="<param><base64>$converted</base64></param>";
$request.="<param><string>".$this->Username."</string></param>";
$request.="<param><string>".$this->Password."</string></param>";
$request.="<param><int>".$language."</int></param>";
$request.="</params></methodCall>";
//return $request;
$header[] = "Host: ".$this->host;
$header[] = "MIME-Version: 1.0";
$header[] = "Content-type: multipart/mixed; boundary=----doc";
$header[] = "Accept: text/xml";
$header[] = "Content-length: ".strlen($request);
$header[] = "Cache-Control: no-cache";
$header[] = "Connection: close \r\n";
$header[] = $request;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$this->url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 140);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$data = curl_exec($ch);
if (curl_errno($ch)) {
return "300";
}
$npos=strpos($data,"<string>");
if ($npos)
{
$start=$npos+strlen("<string>");
$s1=substr($data,$start);
$npos=strpos($s1,"</string>");
if ($npos)
{
$s2=substr($s1,0,$npos);
}
}
$text=$s2;
$npos=strpos($data,"<int>");
if ($npos)
{
$start=$npos+strlen("<int>");
$s1=substr($data,$start);
$npos=strpos($s1,"</int>");
if ($npos)
{
$s2=substr($s1,0,$npos);
}
}
$this->id=$s2;
return $text;
}
function Report($result)
{
$request="<methodCall><methodName>ocr_server::ver</methodName><params><param><string>";
$request.=($result)?"yes":"no";
$request.="</string></param><param><int>".$this->id."</int></param></params></methodCall>";
$header[] = "Host: ".$this->host;
$header[] = "MIME-Version: 1.0";
$header[] = "Content-type: multipart/mixed; boundary=----doc";
$header[] = "Accept: text/xml";
$header[] = "Content-length: ".strlen($request);
$header[] = "Cache-Control: no-cache";
$header[] = "Connection: close \r\n";
$header[] = $request;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$this->url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$data = curl_exec($ch);
if (curl_errno($ch)) {
return false;
}
else
{
return true;
}
}
}
$oc=new OCR();
$oc->Username = "username";
$oc->Password = "pswd";
/*
Language_codes
Default/English: 0
Russian: 1
Russian case-sensetive : 2
Russian capital characters: 3
Russian lowercase characters: 4
English case-sensetive: 5
English capital characters: 6
English lowercase characters: 7
$res=$oc->Recognize('download.gif');
$oc->Report(true);
*/
//echo $res;
?>
Посмотреть вложение firstnames.txt
