Sie sind auf Seite 1von 12

<?

php

require_once('gCurl/gcurl.class.php');
//require_once('header.php');

//////////////////////////////////////////////////////////////////////////////////
/////////////////////
$upload_path = 'captcha\captcha.jpg';//�pG8 �n GѼ���� S � ��Gt�
$file_log = 'file_log.txt';//��� ��a���Ga�a�� d�s e��a��
$proxy_url =
'http://bmwlife.net/v3/exports.php?ponline=1&proxycountry=all&proxycity=all&proxop
t=onlyprox&proxyuptime=&cmd=screen&proxystate=all';//�pG8 � � p �a��
$path_to_folder = 'resurs\site1'; //�pG8 � � ��Ѽ��p ��Gp
$key = "2e2edc22c9b0919fd8f59a51687a18ea";//��et �n a� �����Ὤ� ��t�

$file_accs = 'file_acc.txt';
//////////////////////////////////////////////////////////////////////////////////
/////////////////////

set_time_limit(3600);

$max_redirects = 20;
$i=0;
$cookies = array();

/**
* �p����n ���Ga�ѡ�n ��a��� �aѬG�a�� � � � S ��
*
* @param string $path_to_folder - path � �Ử� ��G�ape �p��� � G8
* @param string $parent_folder - �Ử� � ��G�a�� ��s��G�n �aѬG�a�n
*/
function search_tree($path_to_folder, $parent_folder='')
{
global $dir_tree, $file_name;

$array = scandir ($path_to_folder);


for($i = 0; $i<count($array);$i++)
if(substr($array[$i], 0, 1) == '.')
{
continue;
}
elseif(preg_match('/\./i', $array[$i]) > 0)
{
//S

$file_name['name'][] = $array[$i];
$file_name['path'][] = $parent_folder;
$file_name['location'][]= $path_to_folder."/".$array[$i];//--

}
else
{
$num = count($dir_tree);
$dir_tree[$num]['l_folder'] = $array[$i];
$dir_tree[$num]['parent_folder']= $parent_folder;
$dir_tree[$num]['path'] =
$path_to_folder."/".$array[$i];//--
$dir_tree[$num]['parent_path'] = $path_to_folder;
search_tree($path_to_folder."\\".$array[$i],
$parent_folder."/".$array[$i]);//---
}
}

/**
* ���ap��� S �� �� ftp, � �8�� ��� Ѽ curl
*
* @param string $localfile - path � ����apѼ��p S p
* @param string $path_to - path, �p�� ��� � ��G8
* @param string $proxy - ��a��a:��aG
*/
function curl_ftp($localfile, $path_to, $proxy)
{
$ch = curl_init();
$fp = fopen($localfile, 'r');

curl_setopt($ch, CURLOPT_URL, $path_to);


curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));
curl_setopt ($ch, CURLOPT_PROXY, $proxy); //--
curl_exec ($ch);

$error_no = curl_errno($ch);

curl_close ($ch);

if ($error_no == 0) {

$error = 'File uploaded succesfully.';

} else {

$error = 'File upload error.';

}
}

/**
* 櫺� � �aѬG�a��, � �G��G�nG� �Gap�Gpa�� ��a���
*
* @param string $login - ��n e��a�
* @param string $pw - ��a��8
* @param string $chdir_val - �aѬG�a�n � ��G�ape �p��G ����Tѡ� ����n �Ử�
* @param string $dir - ��n ��� �aѬG�a��
*/
function create_dir($login, $pw, $chdir_val, $dir)
{
echo $ftp_server = $login.".chat.ru";
$sch=0;$flag = 0;
do
{
@ftp_close($conn_id);
// ��G�����Ѽ ��ѡ�� � FTP-��a��a��
$conn_id = ftp_connect($ftp_server, 21, 30);
// ����Ga�apѼ�n �� ��a��a�
//echo "|".$login."|".$pw."|";
$login_result = @ftp_login($conn_id, $login, $pw);
// �a���anѼ ��ѡ��
if ((!$conn_id) || (!$login_result))
{
print("FTP connection has failed !");
if($sch < 5)
{
$flag = 0;
$sch++;
}
else $flag = 1;
}
else
{
$flag=1;
}
}while($flag==0);

$dir_arr = explode("/", $chdir_val);//---


for($k=0;$k<count($dir_arr);$k++)
{
if($dir_arr[$k] !='')
{
echo $dir_arr[$k];
if (@ftp_chdir($conn_id, $dir_arr[$k]))
{
echo "Current directory is now: " . ftp_pwd($conn_id) . "\n";
}
else
{
echo "Couldn't change directory\n";
}
}
echo "<br />";
}

if (@ftp_mkdir($conn_id, $dir))
{
echo "successfully created $dir\n";
}
else
{
echo "There was a problem while creating $dir\n";
}

@ftp_close($conn_id);

}
/**
* ���ap��� ���s S �� � ѡ�ds �aѬG�a��
*
* @param string $path_to_abs - �� �eG�d� �pG8 � �aѬG�a�� � ��G�ape ���G � �� S ��
* @param string $login - ��n e��a�
* @param string $pw - ��a��8
* @param string $proxy - ��a��a:��aG
* @param string $folder - ��n a�� �Ga���Ѽ�� �aѬG�a��
*/
function load_tree($path_to_abs, $login, $pw, $proxy, $folder= '')
{
global $dir_tree, $file_name;

//���ap��� S �� �n � �� �aѬG�a��
for($j=0;$j<count($file_name['path']);$j++)
{
if($file_name['path'][$j] == $folder)//--str_replace("/", "\\",
$folder)
{
//�pG8 �n � � S �
$path_to = $path_to_abs."/".$file_name['name'][$j];
curl_ftp($file_name['location'][$j], $path_to, $proxy);
}
}

// �� � ѡ�ds �aѬG�a��
for($i=0;$i<count($dir_tree);$i++)
{
if($dir_tree[$i]['parent_folder'] == $folder)//--str_replace("/", "\\",
$folder)
{
// �� � �aѬG�a��
create_dir($login, $pw, $dir_tree[$i]['parent_folder'],
$dir_tree[$i]['l_folder']);
//aѬpa �d� �d��� Sp����� �n �� �� �Ử�
load_tree($path_to_abs."/".$dir_tree[$i]['l_folder'], $login,
$pw, $proxy, $folder."/".$dir_tree[$i]['l_folder']);
}
}
}

/**
* ����ѡ�� ���GѡG� � S
*
* @param string $file_name - path � S �
* @param string $content - ����nѼ�n �Ga���
*/
function AppendFile( $file_name, $content )
{
$fid = fopen( $file_name , "a+" );
fwrite( $fid, $content );
fclose( $fid );
}

/**
* �p����n �ѡ�a � ��a��Ѭ/����
*
* @return string
*/
function Gen_UN_Login()
{
$num = rand(6, 15);
$b= "";

if(intval($num)&&$num<16)
{
/*�ѽ�Ѽ ��� �*/

$a=array('q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','
l','z','x','c','v','b','n','m',);

/*��F�Ѽ ��� �*/


shuffle($a);
$i = 0;

while($i<$num)
{
$b=$b.$a[$i]; // �a�Ѽ ��F ��a��8 � �Ga��p
$i++;
}

}
return $b;
}

/**
* �p����n �ѡ�a � ��a��Ѭ/����
*
* @return string
*/
function Gen_PW_Login()
{
$num = rand(6, 15);
$b= "";

if(intval($num)&&$num<16)
{
/*�ѽ�Ѽ ��� �*/

$a=array('1','2','3','4','5','6','7','8','9','0','q','w','e','r','t','y','u','i','
o','p',
'a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m','_',);

/*��F�Ѽ ��� �*/


shuffle($a);
$i = 0;

while($i<$num)
{
$b=$b.$a[$i]; // �a�Ѽ ��F ��a��8 � �Ga��p
$i++;
}

}
return $b;
}

/**
* �p����n �d���� a��G� a� ����� n ��t�
*
* @param string $filename - ����d� �pG8 � S p
* @param string $apikey - ��et �n a��Gd
* @param boolean $is_verbose - �et�G8/�d��et�G8 ����ѡG�a�� � �a���s��nT��
* @param integer $rtimeout - ����a��� �Ѫ�p ��a��Ἷ �G�Gp�� ��t�
* @param integer $mtimeout - �aѼn ���� n ���� ��t�

� @param integer $is_phrase - 0 ��� 1 - S��� "� ��t� 2 �


* �� ��"
* @param integer $is_regsense - 0 ��� 1 - S��� "a���Ga �p�� � ��t� ����G ���tѡ��"
* @param integer $is_numeric - 0 ��� 1 - S��� "��t� �G��G G��8�� �� ��Sa"

* @param integer $min_len - 0 (�Ѻ ��a tѡ��), �e��n �ap��n ��Sa� p��d���G
������8�pe p GѬ�G� ��t�
* @param integer $max_len - 0 (�Ѻ ��a tѡ��), �e��n �ap��n ��Sa� p��d���G ��8�� �pe
p GѬ�G� ��t�
* @return string
*/

function recognize($filename, $apikey, $is_verbose = true, $rtimeout = 5,


$mtimeout = 120, $is_phrase = 0, $is_regsense = 0, $is_numeric = 0, $min_len = 0,
$max_len = 0)
{
if (!file_exists($filename))
{
if ($is_verbose) echo "file $filename not found\n";
return false;
}
$postdata = array(
'method' => 'post',
'key' => $apikey,
'file' => '@'.$filename, //����d� �pG8 � S p
'phrase' => $is_phrase,
'regsense' => $is_regsense,
'numeric' => $is_numeric,
'min_len' => $min_len,
'max_len' => $max_len,

);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.anti-captcha.com/in.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
$result = curl_exec($ch);
if (curl_errno($ch))
{
if ($is_verbose) echo "CURL returned error: ".curl_error($ch)."\n";
return false;
}
curl_close($ch);
if (strpos($result, "ERROR")!==false)
{
if ($is_verbose) echo "server returned error: $result\n";
return false;
}
else
{
$ex = explode("|", $result);
$captcha_id = $ex[1];
if ($is_verbose) echo "captcha sent, got captcha ID $captcha_id\n";
$waittime = 0;
if ($is_verbose) echo "waiting for $rtimeout seconds\n";
sleep($rtimeout);
while(true)
{
$result = file_get_contents('http://anti-
captcha.com/res.php?key='.$apikey.'&action=get&id='.$captcha_id);
if (strpos($result, 'ERROR')!==false)
{
if ($is_verbose) echo "server returned error: $result\n";
return false;
}
if ($result=="CAPCHA_NOT_READY")
{
if ($is_verbose) echo "captcha is not ready yet\n";
$waittime += $rtimeout;
if ($waittime>$mtimeout)
{
if ($is_verbose) echo "timelimit ($mtimeout) hit\n";
break;
}
if ($is_verbose) echo "waiting for $rtimeout seconds\n";
sleep($rtimeout);
}
else
{
$ex = explode('|', $result);
if (trim($ex[0])=='OK') return trim($ex[1]);
}
}

return false;
}
}

/**
* �p����n a���Ga �� ���� �p�G�
*
* @param array $accaunt_options - $proxy_options['server'],
$proxy_options['port']
* @param array $proxy_options - $proxy_options['username'], $proxy_options['pw']
* @param string $upload_path - �pG8 � S � ��t�
* @return string
*/
function getAccaunt($accaunt_options, $proxy_options, $upload_path, $key)
{
//��a�d� ��a�� �� ���ptѡ�� ���� � cookies
try{
//initialize the class
$curl = new gCurl('http://chat.ru/user/gencode.php','POST');

$curl->Request->proxy = $proxy_options['server'];
$curl->Request->proxy_port = $proxy_options['port']; //--
/*echo "proxy = ".$proxy_options['server']."<br />";
echo "proxy_port = ".$proxy_options['port']."<br />";*/

$response = $curl->exec();

foreach ($response->cookies as $c)


{
$cookies[$c['name']] = $c['value'];
}

echo "<br />";


//print_r($cookies);

// �� � a��p���.
$upload_file = fopen($upload_path, 'w');
fwrite($upload_file, $response);
fclose($upload_file);

//a� ����� �
$text = recognize($upload_path, $key, true, 5, 120, 0, 0, 1, 6,
6);

echo "<br /><br />text = ".$text."<br /><br />";//--


flush();

}catch (gksException $E){


echo $E->getHtmlMessage();
exit;
}

if( strlen($text) == 6 )
{

//�G�a�� ��a�� �� a���Ga e


try{
$url2 = 'http://chat.ru/user/register.html';
$curl = new gCurl($url2, 'POST');

$curl->Request->proxy = $proxy_options['server'];
$curl->Request->proxy_port = $proxy_options['port'];
//--
/*echo "proxy = ".$proxy_options['server']."<br />";
echo "proxy_port = ".$proxy_options['port']."<br />";*/

$curl->Request->addCookieVar('b','b');
$curl->Request->addCookieVar('code', $cookies['code']);
$curl->Request-
>addCookieVar('__utmz','65365116.1190520546.1.1.utmccn=(direct)|utmcsr=(direct)|
utmcmd=(none)');
$curl->Request->addCookieVar('__utmc','65365116');
$curl->Request->addCookieVar('__utmb','65365116');
$curl->Request-
>addCookieVar('__utma','65365116.540790264.1190520546.1190520546.1190520546.1');

//��a��Gad ��a�����Ѽd� �� S�a�d


$curl->Request-
>addPostVar('personal_key',trim($text));
$curl->Request->addPostVar('username',
$accaunt_options['username']); //ihbid7p@tania2reb
$curl->Request-
>addPostVar('pw1',$accaunt_options['pw']);
$curl->Request-
>addPostVar('pw2',$accaunt_options['pw']);
$curl->Request->addPostVar('confemail','');
$curl->Request->addPostVar('name','');
$curl->Request->addPostVar('name1','');
$curl->Request->addPostVar('name2','');
$curl->Request->addPostVar('day','');
$curl->Request->addPostVar('mounth','');
$curl->Request->addPostVar('year','');
$curl->Request->addPostVar('strana','1');
$curl->Request->addPostVar('city','');
$curl->Request->addPostVar('social','3');
$curl->Request->addPostVar('secret','2');
$curl->Request->addPostVar('anotherpw','');
$curl->Request-
>addPostVar('action','Register/��a���Ga�a���G8');

$response = $curl->exec();

}
catch (gksException $E)
{
echo $E->getHtmlMessage();
exit;
}

return $response;
//echo "<br />�G��G �� � �G�a�� ��a��� ".$response."<br
/>";

}
}

$log_pw = array();
//���ptѡ�� ��a��� � ��Ѽ�� �Ử�
search_tree($path_to_folder);

$proxy_list = file_get_contents($proxy_url);
preg_match_all('/(.*?)(\n)/', $proxy_list, $proxy_arr_a);
$proxy_arr = $proxy_arr_a[1];

//for($i = 0; $i < 3; $i++)


for($i = 0; $i < count($proxy_arr); $i++)//--
{
echo "i=".$i;
echo "<br />";
$server_port = explode(':', $proxy_arr[$i]);

$proxy_options['server'] = $server_port[0];
$proxy_options['port'] = $server_port[1];

$registration = 0;
//���ptѡ�� ��ѡ� ���8����Gѽn � ��a��n
echo $accaunt_options['username'] = Gen_UN_Login();
echo "<br />";
echo $accaunt_options['pw'] = Gen_PW_Login();
echo "<br />";

$sch_cicle = 0;
do
{
//echo "<br /><br /><br /><br />";
$response_txt = getAccaunt($accaunt_options, $proxy_options,
$upload_path, $key);//--
//$output = convert_cyr_string($output, "k", "w");
//echo "<br /><br /><br /><br />";

if( preg_match('/(ū�8����Gѽ8 � ��ѡѼ)(.*?)(p�� �pT��G�p�G)/ims',


$response_txt) > 0
|| preg_match('/� <font color=red><b>��ѡ�<\/b><\/font>
���8����Gѽn �����/ims', $response_txt) > 0)
{
//���G�an�G�n ���
//��G a��aѬG�, $registration = 0
if($sch_cicle == 10)
{
//�� p�Ὣ�8 ��a���Ga�a���G8�n
$registration = 1;
//� �8 � ��� ip:port@error@error\n
AppendFile($file_log,
$proxy_options['server'].":".$proxy_options['port']."@error@error\n");

}else
{
$sch_cicle++;
//�ѡ�a n ���� ����
$accaunt_options['username'] = Gen_UN_Login();
}

}
elseif(preg_match('/(����Ga ����n ��aG�t�� ���8����Gѽn)/ims',
$response_txt) > 0)
{
//��G a��aѬG�, $registration = 0
if($sch_cicle == 10)
{
//�� p�Ὣ�8 ��a���Ga�a���G8�n
$registration = 2;
//� �8 � ��� ip:port@error@error\n
AppendFile($file_log,
$proxy_options['server'].":".$proxy_options['port']."@error@error\n");
}
$sch_cicle++;
}
else
{
//a���Ga n �a����F��
$registration = 1;
//� �8 � ��� ip:port@���@��a��8\n
AppendFile($file_log,
$proxy_options['server'].":".$proxy_options['port']."@".

$accaunt_options['username']."@".$accaunt_options['pw']."\n");

$log_pw['login'][] = $accaunt_options['username'];
$log_pw['pw'][] = $accaunt_options['pw'];

sleep(180);

//Sp����n ��t�� S � �� ftp


echo "��t���Ѽ � �p ��G� �� ��a��a...";
flush();

$login = $log_pw['login'][$i];
$pw = $log_pw['pw'][$i];

$path_to_abs = 'ftp://'.$login.':'.$pw.'@'.$login.'.chat.ru/';

load_tree($path_to_abs, $login, $pw,


$proxy_options['server'].":".$proxy_options['port'], '');
echo "� �� ��G� ����aFѡ�";

AppendFile($file_accs,'ftp://'.$login.':'.$pw.'@'.$login.'.chat.ru/\n');
}

}while($registration == 0);

/*

for($i=0;$i<count($log_pw['login']);$i++)
{

*/

?>

Das könnte Ihnen auch gefallen