From dbaa06f6e825be058d04130a6ba9bbaf2015f842 Mon Sep 17 00:00:00 2001 From: Marty <49799843+marty0678@users.noreply.github.com> Date: Sat, 28 May 2022 02:17:14 -0400 Subject: [PATCH 1/2] Implemented the changes in https://github.com/NoMore201/googleplay-api/pull/161 Still not working however, getting bad auth --- gpapi/config.py | 5 +++-- gpapi/googleplay.py | 23 ++++++++++++----------- requirements.txt | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/gpapi/config.py b/gpapi/config.py index 24d4df3..4b95db5 100644 --- a/gpapi/config.py +++ b/gpapi/config.py @@ -141,8 +141,9 @@ def getLoginParams(self, email, encrypted_passwd): "device_country": self.locale[0:2], "lang": self.locale, "client_sig": "38918a453d07199354f8b19af05ec6562ced5788", - "callerSig": "38918a453d07199354f8b19af05ec6562ced5788"} - + "callerSig": "38918a453d07199354f8b19af05ec6562ced5788", + "droidguard_results": "dummy123"} + def getAndroidCheckinRequest(self): request = googleplay_pb2.AndroidCheckinRequest() request.id = 0 diff --git a/gpapi/googleplay.py b/gpapi/googleplay.py index 2f8a442..26fe62a 100644 --- a/gpapi/googleplay.py +++ b/gpapi/googleplay.py @@ -244,10 +244,12 @@ def login(self, email=None, password=None, gsfId=None, authSubToken=None): params['service'] = 'ac2dm' params['add_account'] = '1' params['callerPkg'] = 'com.google.android.gms' - headers = self.deviceBuilder.getAuthHeaders(self.gsfId) - headers['app'] = 'com.google.android.gsm' - response = self.session.post(AUTH_URL, data=params, verify=ssl_verify, - proxies=self.proxies_config) + with requests.Session() as s: + s.headers = {'User-Agent': 'GoogleAuth/1.4'} + response = s.post(AUTH_URL, + data=params, + verify=ssl_verify, + proxies=self.proxies_config) data = response.text.split() params = {} for d in data: @@ -286,13 +288,12 @@ def getAuthSubToken(self, email, passwd): requestParams = self.deviceBuilder.getLoginParams(email, passwd) requestParams['service'] = 'androidmarket' requestParams['app'] = 'com.android.vending' - headers = self.deviceBuilder.getAuthHeaders(self.gsfId) - headers['app'] = 'com.android.vending' - response = self.session.post(AUTH_URL, - data=requestParams, - verify=ssl_verify, - headers=headers, - proxies=self.proxies_config) + with requests.Session() as s: + s.headers = {'User-Agent': 'GoogleAuth/1.4', 'device':"{0:x}".format(self.gsfId)} + response = s.post(AUTH_URL, + data=requestParams, + verify=ssl_verify, + proxies=self.proxies_config) data = response.text.split() params = {} for d in data: diff --git a/requirements.txt b/requirements.txt index 20d419f..f80b6b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ protobuf==3.13.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycparser==2.20 -pyinstaller==4.0 +pyinstaller==4.9 pyinstaller-hooks-contrib==2020.9 pytz==2020.1 pywin32-ctypes==0.2.0 From 2339c89a1fd245716a6230bfd35a52db962b9228 Mon Sep 17 00:00:00 2001 From: Marty <49799843+marty0678@users.noreply.github.com> Date: Sat, 28 May 2022 17:34:06 -0400 Subject: [PATCH 2/2] Fixed context options to allow logging in with username and password and updated example with login for username --- example.py | 8 ++++++-- gpapi/googleplay.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/example.py b/example.py index 2290dcf..97353bc 100644 --- a/example.py +++ b/example.py @@ -6,6 +6,8 @@ # Json login file must be placed in the root be structured like: # { # "log_in_name": { +# "username": "username", +# "password": "password", # "deviceName": device_name:str, # "gsfId" : id_number:int, # "authSubToken" : token:str @@ -34,8 +36,10 @@ def resource_path(relative_path): print("Logging in...") server.login( - gsfId=current_log_in['gsfId'], - authSubToken=current_log_in['authSubToken'] + email=current_log_in['username'], + password=current_log_in['password'], + # gsfId=current_log_in['gsfId'], + # authSubToken=current_log_in['authSubToken'] ) print("Complete!") diff --git a/gpapi/googleplay.py b/gpapi/googleplay.py index 26fe62a..5c20ff7 100644 --- a/gpapi/googleplay.py +++ b/gpapi/googleplay.py @@ -60,7 +60,7 @@ def init_poolmanager(self, *args, **kwargs): context = SSLContext() context.set_ciphers(ssl_.DEFAULT_CIPHERS) context.verify_mode = ssl.CERT_REQUIRED - context.options &= ~ssl_.OP_NO_TICKET + context.options &= ~0x4000 self.poolmanager = PoolManager(*args, ssl_context=context, **kwargs)