@vadikjust

Steam curl авторизация, как избавиться от капчи?

Есть скрипт, который логинится по логину и паролю, но при частом использовании, логин не проходит и выходит капча. Прокси не помогает. Как решить проблему?
header('Content-Type: text/html; charset=utf-8');
$login='логин';vadikjustbutov1996ssword='пасс';
$proxy ='144.217.40.115:8080';
require_once 'Crypt/RSA.php';
    function geturl($url, $ref, $cookie, $postdata, $header, &$info, &$output)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_PROXY, $proxy);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36');
        if ($ref)
        {
            curl_setopt($ch, CURLOPT_REFERER, $ref);
        }
        if ($cookie)
        {
            curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
            curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
            
        }
 
        if ($postdata)
        {
            curl_setopt($ch, CURLOPT_POST, true);
            $postStr = "";
            foreach ($postdata as $key => $value)
            {
                if ($postStr)
                    $postStr .= "&";
                $postStr .= $key . "=" . $value;
            }
            curl_setopt($ch, CURLOPT_POSTFIELDS, $postStr);
        }
 
        curl_setopt($ch, CURLOPT_HEADER, $header);
        $info = curl_getinfo($ch);
        $output = curl_exec($ch);
        curl_close($ch);
        
        
    }
    
geturl("https://store.steamcommunity.com", null , "tmp/cook.txt",  null, 0, $info, $output);
    
geturl("https://store.steampowered.com/login/getrsakey/", null , "tmp/cook.txt",  array('username' => $login,'donotcache' => time()), 0, $info, $output);
$data = json_decode($output, true);
//print_r ($data); 
if ($data['success'] === true)
{
    $publickey_exp = $data['publickey_exp'];
    $publickey_mod = $data['publickey_mod'];
    $RSA = new Crypt_RSA();
    $RSA->setEncryptionMode(CRYPT_RSA_ENCRYPTION_PKCS1);
    define('CRYPT_RSA_PKCS15_COMPAT', true);
    $n = new Math_BigInteger($publickey_mod, 16);
    $e = new Math_BigInteger($publickey_exp, 16);
 
    $key = array("modulus"=>$n, "publicExponent"=>$e);
    $RSA->loadKey($key, CRYPT_RSA_PUBLIC_FORMAT_RAW);
    $encryptedPassword = base64_encode($RSA->encrypt($password, false));
	$encryptedPassword = str_replace('/','%2F',$encryptedPassword);
    $encryptedPassword = str_replace('+','%2B',$encryptedPassword);
    $encryptedPassword = str_replace('=','%3D',$encryptedPassword);

    $captchaGid = -1;
    $captchaText;
    $emailAuth;
    $emailSteamId;
    
        $params = array(
            'username' => $login,
            'password' => $encryptedPassword,
            'rsatimestamp' => $data['timestamp'],
            'captcha_gid' => $captchaGid,
            'captcha_text' => $captchaText,
            'emailauth' => $emailAuth,
            'emailsteamid' => $emailSteamId
        );
        //print_r($params);   
        geturl("https://store.steampowered.com/login/dologin/", null , "tmp/cook.txt",  $params, 0, $info, $output);;
        $data1 = json_decode($output, true);
        //print_r ($data1);
        if ($data['captcha_needed'])
        {
            $captchaGid = $data1['captcha_gid'];
            
            
            echo "<img src='https://store.steampowered.com/public/captcha.php?gid=$captchaGid'>";
        }
if (!$data1['message']) {		
echo 'Аккаунт работает. SteamID: '.$data1['emailsteamid'];
} else{
echo 'Аккаунт не работает. '.$data1['message'];
}
}
  • Вопрос задан
  • 1280 просмотров
Пригласить эксперта
Ответы на вопрос 1
mhthnz
@mhthnz
PHP, YII2, Golang, Linux
Например можно использовать сервисы ввода капч, на подобие https://rucaptcha.com/.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы