Example #1
0
 private static function handleSMS()
 {
     if (!isset($_POST['sms'])) {
         return;
     }
     $tries = 0;
     while ($tries < 30) {
         $code = SteamGuard::generateSteamGuardCode(self::$authData->shared_secret);
         $res = Net::doRequest('https://api.steampowered.com/ITwoFactorService/FinalizeAddAuthenticator/v0001', [], ['steamid' => self::$authData->steamid, 'access_token' => self::$authData->access_token, 'activation_code' => $_POST['sms'], 'authenticator_code' => $tries == 0 ? '' : $code[0], 'authenticator_time' => $code[1]], 'https://steamcommunity.com/mobilelogin?oauth_client_id=DE45CD61&oauth_scope=read_profile%20write_profile%20read_client%20write_client');
         $data = json_decode($res[1]);
         if ($data->response->status == 89) {
             //die("Bad SMS Code");
             break;
         }
         if (!$data->response->success) {
             //die("Fail");
             break;
         }
         if ($data->response->want_more) {
             $_POST['sms'] = '';
             $tries++;
             continue;
         }
         return ['success' => true];
     }
     return ['success' => false];
 }
Example #2
0
 public function doConf($id, $key, $op)
 {
     $time = time() - $this->getDrift();
     $authKey = urlencode(SteamGuard::getMobileKeyFor($this->oauth->identity_secret, $time, $op));
     $res = Net::doRequest("https://steamcommunity.com/mobileconf/ajaxop?op={$op}&p=escrowtf:{$this->oauth->steamid}&a={$this->oauth->steamid}&k={$authKey}&t={$time}&m=android&tag={$op}&cid={$id}&ck={$key}", $this->generateCookies());
 }