def wrapInRequest(self, payload, defaults=True): # Grab coords latitude, longitude, altitude = self.getCoordinates() # Add requests if defaults: payload += self.getDefaults() # If we haven't authenticated before info = None signature = None if self.authTicket is None: info = RequestEnvelope.RequestEnvelope.AuthInfo( provider=self.authProvider, token=RequestEnvelope.RequestEnvelope.AuthInfo.JWT( contents=self.accessToken, unknown2=59)) # Otherwise build signature elif self.encryptLib and not self.location.noop: # Generate hashes hashA, hashB = hashLocation(self.authTicket, latitude, longitude, altitude) # Build and hash signature proto = Signature.Signature( location_hash1=hashA, location_hash2=hashB, session_hash=os.urandom(32), timestamp=getMs(), timestamp_since_start=getMs() - self._start, request_hash=hashRequests(self.authTicket, payload), unknown25=-8537042734809897855) signature = hashSignature(proto, self.encryptLib) # Build Envelope req = RequestEnvelope.RequestEnvelope( status_code=2, request_id=PogoSessionBare.getRPCId(), unknown6=Unknown6.Unknown6(request_type=6, unknown2=Unknown6.Unknown6.Unknown2( encrypted_signature=signature)), longitude=longitude, latitude=latitude, altitude=altitude, auth_ticket=self.authTicket, unknown12=741, auth_info=info) req.requests.extend(payload) return req
def __init__(self, authSession, location, old=None): self._authSession = authSession self._location = location if self._location.noop: logging.warning(NO_LOCATION_NOTICE) # Set up Inventory if old is not None: self._inventory = old.inventory self._state = old.state # Start fresh else: self._inventory = None self._state = State() self._start = getMs() self._authTicket = None self._session = self._authSession.requestSession self._endpoint = self.formatEndpoint(self.createApiEndpoint()) if self.encryptLib is None: logging.warning(NO_ENCRYPTION_NOTICE)
def wrapInRequest(self, payload, defaults=True): # Grab coords latitude, longitude, altitude = self.getCoordinates() # Add requests if defaults: payload += self.getDefaults() # If we haven't authenticated before info = None signature = None if self.authTicket is None: info = RequestEnvelope.RequestEnvelope.AuthInfo( provider=self.authProvider, token=RequestEnvelope.RequestEnvelope.AuthInfo.JWT( contents=self.accessToken, unknown2=59 ) ) # Otherwise build signature elif self.encryptLib and not self.location.noop: # Generate hashes hashA, hashB = hashLocation( self.authTicket, latitude, longitude, altitude ) # Build and hash signature proto = Signature.Signature( location_hash1=hashA, location_hash2=hashB, session_hash=os.urandom(32), timestamp=getMs(), timestamp_since_start=getMs() - self._start, request_hash=hashRequests(self.authTicket, payload), unknown25 = -8537042734809897855 ) signature = hashSignature(proto, self.encryptLib) # Build Envelope req = RequestEnvelope.RequestEnvelope( status_code=2, request_id=PogoSessionBare.getRPCId(), unknown6=Unknown6.Unknown6( request_type=6, unknown2=Unknown6.Unknown6.Unknown2( encrypted_signature=signature ) ), longitude=longitude, latitude=latitude, altitude=altitude, auth_ticket=self.authTicket, unknown12=741, auth_info=info ) req.requests.extend(payload) return req