/**
  * @param Session $session
  */
 public function __construct(Session $session)
 {
     $this->logger = $session->getLogger();
     $this->session = $session;
     $this->RPCId = mt_rand();
     $this->client = new Client(["headers" => ["User-Agent" => "Niantic App"]]);
 }
Exemple #2
0
 /**
  * @param Logger $logger
  * @param Location $location
  * @param $username
  * @param $password
  */
 public function __construct(Logger $logger, Location $location, $username, $password)
 {
     parent::__construct($logger, $location);
     $this->username = $username;
     $this->password = $password;
     $this->authClient = new Client(["cookies" => true, "verifyPeer" => false, "connect_timeout" => 30]);
 }
Exemple #3
0
 /**
  * @param Session $session
  * @param RequestEnvelope $env
  * @param Request[] $reqs
  * @throws Exception
  */
 public static function sign(Session $session, RequestEnvelope $env, $reqs)
 {
     if (!$session->hasAuthTicket()) {
         return;
     }
     $location = $session->getLocation();
     $rawTicket = $session->getAuthTicket()->toBinary();
     $microTime = MicroTime::get();
     $protoSignature = new ProtoSignature();
     $protoSignature->setTimestampSinceStart($microTime - $session->getStartMicroTime());
     // TODO: LocationFix
     // TODO: AndroidGpsInfo
     // TODO: SensorInfo
     // TODO: DeviceInfo
     // TODO: ActivityStatus
     $protoSignature->setLocationHash1(self::generateLocation1($rawTicket, $location));
     $protoSignature->setLocationHash2(self::generateLocation2($location));
     $protoSignature->setSessionHash($session->getSessionHash());
     $protoSignature->setTimestamp($microTime);
     foreach ($reqs as $req) {
         $protoSignature->addRequestHash(self::generateRequestHash($rawTicket, $req->toProto()->toStream()->getContents()));
     }
     $protoSignature->setUnknown25(9.909701338899655E+18);
     $uk6 = new Unknown6();
     $uk6->setRequestType(6);
     $uk2 = new Unknown2();
     $enc = Encrypt::encrypt($protoSignature->toStream()->getContents(), random_bytes(32));
     $uk2->setEncryptedSignature($enc);
     $uk6->setUnknown2($uk2);
     $env->setUnknown6($uk6);
     $session->getLogger()->debug("Signed request: " . strlen($enc) . " bytes");
 }
 /**
  * @param Logger $logger
  * @param Location $location
  * @param $username
  * @param $password
  * @param string $androidId
  * @param string $service
  * @param string $app
  * @param string $clientSig
  */
 public function __construct(Logger $logger, Location $location, $username, $password, $androidId = "3764d56d68ae549c", $service = "audience:server:client_id:848232511240-7so421jotr2609rmqakceuu1luuq0ptb.apps.googleusercontent.com", $app = "com.nianticlabs.pokemongo", $clientSig = "321187995bc7cdc2b5fc91b11a96e2baa8602c62")
 {
     parent::__construct($logger, $location);
     $this->username = $username;
     $this->password = $password;
     $this->androidId = $androidId;
     $this->service = $service;
     $this->app = $app;
     $this->clientSig = $clientSig;
     $this->authClient = new Client(["base_uri" => "https://android.clients.google.com", "headers" => ["User-Agent" => "POGOAPI/1.0"]]);
 }
Exemple #5
0
 /**
  * @param Session $session
  */
 public function __construct(Session $session)
 {
     $this->logger = $session->getLogger();
     $this->session = $session;
     $this->response = false;
 }