def __init__(self, cfg, proxies): self._engine = 'google_engine' self.config = cfg self.server = GooglePlayAPI('en_US', 'America/New York', "hero2lte", proxies) self._download_proxy = proxies
def __init__(self, debug=True, fdroid=False): self.currentSet = [] self.totalNumOfApps = 0 self.debug = debug self.fdroid = fdroid self.firstRun = True self.loggedIn = False self._email = None self._passwd = None self._last_fdroid_update = None # configuring download folder if self.fdroid: self.download_path = os.path.join(os.getcwd(), 'repo') else: self.download_path = os.getcwd() # configuring fdroid data if self.fdroid: self.fdroid_exe = 'fdroid' self.fdroid_path = os.getcwd() self.fdroid_init() # language settings locale = os.environ.get('LANG_LOCALE') if locale is None: locale = locale_service.getdefaultlocale()[0] timezone = os.environ.get('LANG_TIMEZONE') if timezone is None: timezone = 'Europe/Berlin' self.service = GooglePlayAPI(locale, timezone)
def __init__(self, gp_login, gp_password, android_id=None, auth_sub_token=None): self.resetAuthData() self.gp_login = gp_login self.gp_password = gp_password self.android_id = android_id self.auth_sub_token = auth_sub_token self.server = GooglePlayAPI(locale.getdefaultlocale()[0], None)
class TokenDispenser(socketserver.BaseRequestHandler): def login(self): return random.choice(list( open('passwords/passwords.txt'))).strip().split(" ") def setup(self): self.api = GooglePlayAPI(locale="en_GB", timezone="CEST", device_codename="bacon") def handle(self): try: try: no = int( chr(self.request.recv(1024).strip().splitlines()[0] [5])) # read first character of URL print("Getting password number " + str(no)) self.gmail_address, self.gmail_password = list( open('passwords/passwords.txt'))[no].strip().split(" ") except: print('no id provided') self.gmail_address, self.gmail_password = self.login() self.api.login(email=self.gmail_address, password=self.gmail_password) self.token = self.api.authSubToken self.gsfid = hex(self.api.gsfId).replace('0x', '') print("Token: {}, gsfId: {}".format(self.token, self.gsfid)) self.request.sendall( str.encode("HTTP/1.1 200 OK\n\n" + self.token + " " + self.gsfid)) except (LoginError, SecurityCheckError) as e: print("Error: " + str(e)) self.request.sendall(str.encode("HTTP/1.1 200 OK\n\n" + str(e)))
def startdownload(self, pkgid="", logger=""): self.pkgid = pkgid if self.pkgid == "": return self.asset = Assets() self.asset.update_status(self.pkgid, "downloading") print('\nAttempting to download %s\n' % self.pkgid) logger.info(json.dumps({"step":"start","package":self.pkgid})) try: fl = "" for codename in self.devices_codenames: self.server = GooglePlayAPI('ko_KR', 'Asia/Seoul', device_codename=codename) self.server.login(None, None, self.gsfId, self.authSubToken) try: fl = self.server.download(self.pkgid) break except Exception as e: continue if fl == "": raise Exception("No Device") with open(self.apkfile_path + self.pkgid + '.apk', 'wb') as apk_file: for chunk in fl.get('file').get('data'): apk_file.write(chunk) print('\n[+] Download successful\n') logger.info(json.dumps({"step":"finish","package":self.pkgid})) self.asset.update_status(self.pkgid, "downloaded") logger.info(json.dumps({"step":"check","package":self.pkgid})) self.check_aws_sdk_common(self.pkgid, logger) except : print("Unexpected error:", sys.exc_info()[0]) traceback.print_exc() #time.sleep(3) pass
def loginWithUserNameAndPwd(email,password): server = GooglePlayAPI('it_IT', 'Europe/Rome') print('\nLogging in with email and password\n') server.login(email, password, None, None) gsfId = server.gsfId authSubToken = server.authSubToken print("gsfId:",gsfId,"authSubToken:",authSubToken)
def connect_to_googleplay_api(self): self.playstore_api = GooglePlayAPI(device_codename=self.device_codename) error = None email = None password = None authSubToken = None gsfId = None if self.token_enable is False: logger.info("Using credentials to connect to API") email = self.config["gmail_address"] if self.config["gmail_password"]: logger.info("Using plaintext password") password = self.config["gmail_password"] elif self.config["keyring_service"] and HAVE_KEYRING is True: password = keyring.get_password(self.config["keyring_service"], email) elif self.config["keyring_service"] and HAVE_KEYRING is False: print("You asked for keyring service but keyring package is not installed") sys.exit(ERRORS.KEYRING_NOT_INSTALLED) else: logger.info("Using token to connect to API") authSubToken = self.token gsfId = int(self.gsfid, 16) try: self.playstore_api.login(email=email, password=password, authSubToken=authSubToken, gsfId=gsfId) except (ValueError, IndexError, LoginError, DecodeError) as ve: # invalid token or expired logger.info("Token has expired or is invalid. Retrieving a new one...") self.retrieve_token(force_new=True) self.playstore_api.login(authSubToken=self.token, gsfId=int(self.gsfid, 16)) success = True return success, error
def secondlogin(self): print('\nNow trying secondary login with ac2dm token and gsfId saved\n') self.server = GooglePlayAPI('ko_KR', 'Asia/Seoul') self.server.login(None, None, self.gsfId, self.authSubToken) # call DOWNLOAD self.startdownload() return True
def connect(self): """ Connect GplayCli to the Google Play API. If self.token_enable=True, the token from self.retrieve_token is used. Else, classical credentials are used. They might be stored into the keyring if the keyring package is installed. """ self.api = GooglePlayAPI(locale=self.locale, timezone=self.timezone, device_codename=self.device_codename) error = None email = None password = None authsub_token = None gsfid = None if self.token_enable is False: logger.info("Using credentials to connect to API") email = self.creds["gmail_address"] if self.creds["gmail_password"]: logger.info("Using plaintext password") password = self.creds["gmail_password"] elif self.creds["keyring_service"] and HAVE_KEYRING is True: password = keyring.get_password(self.creds["keyring_service"], email) elif self.creds["keyring_service"] and HAVE_KEYRING is False: logger.error( "You asked for keyring service but keyring package is not installed" ) sys.exit(ERRORS.KEYRING_NOT_INSTALLED) else: if self.token_passed: logger.info("Using passed token to connect to API") else: logger.info("Using auto retrieved token to connect to API") authsub_token = self.token gsfid = int(self.gsfid, 16) with warnings.catch_warnings(): warnings.simplefilter('error') try: self.api.login(email=email, password=password, authSubToken=authsub_token, gsfId=gsfid) except LoginError as login_error: logger.error( "Bad authentication, login or password incorrect (%s)", login_error) return False, ERRORS.CANNOT_LOGIN_GPLAY # invalid token or expired except (ValueError, IndexError, LoginError, DecodeError, SystemError): logger.info( "Token has expired or is invalid. Retrieving a new one...") self.refresh_token() success = True return success, error
def connect_to_googleplay_api(): playstore_api = GooglePlayAPI(device_codename='bacon') token, gsfid = retrieve_token() playstore_api.login(authSubToken=token, gsfId=int(gsfid, 16)) return playstore_api # if __name__ == '__main__': # playstore_api = connect_to_googleplay_api() # pprint(playstore_api.details('com.awcogagi.airwar'))
def secondlogin(self): print( '\nNow trying secondary login with ac2dm token and gsfId saved\n') self.server = GooglePlayAPI(self.locale, self.timezone, proxies_config=self.proxy) self.server.login(None, None, self.gsfId, self.authSubToken) return True
def main(): mail = '' password = '' cacheFile = '.cache.ini' locale = 'en_US' timezone = 'UTC' helpString = "login.py -m <mail> -p <password> [-c <save_file>] [-t <timezone] [-l <locale>]" # get options try: opts, args = getopt.getopt( sys.argv[1:], "p:m:c:t:l:h", ["password="******"mail=", "cache=", "timezone=", "locale=", "help"]) except getopt.GetoptError: print(helpString) sys.exit(2) for opt, arg in opts: if opt in ("-h", "--help"): print(helpString) sys.exit() elif opt in ("-p", "--password"): password = arg elif opt in ("-m", "--mail"): mail = arg elif opt in ("-c", "--"): cacheFile = arg elif opt in ("-t", "--"): timezone = arg elif opt in ("-l", "--"): locale = arg if mail == '': print("Missing mail") sys.exit(1) if password == '': print("Missing password") sys.exit(1) # login to GP server server = GooglePlayAPI(locale="en_US", timezone="UTC") server.login(mail, password) gsfId = server.gsfId authSubToken = server.authSubToken # save data in cacheFile tokenCache = configparser.ConfigParser() tokenCache['DEFAULT'] = { 'mail': mail, 'password': password, 'locale': locale, 'timezone': timezone, 'authSubToken': authSubToken, 'gsfId': gsfId } with open(cacheFile, 'w') as configFile: tokenCache.write(configFile)
def download_google_apk(storage, handle, tmp_dir, apk_name, apk_tmp): """ Download the APK from Google Play for the given handle. :param storage: minio storage helper :param handle: application handle to download :param tmp_dir: directory to save the APK in :param apk_name: name of the APK in Minio storage :param apk_tmp: apk temporary name :return: True if succeed, False otherwise """ DEVICE_CODE_NAMES = [ 'walleye', # Google Pixel 2 (2017) 't00q', # Asus Zenfone 4 (2017) 'bullhead', # Nexus 5X (2015) 'bacon', # OnePlus One (2014) 'manta', # Nexus 10 (2012) 'cloudbook', # Acer Aspire One Cloudbook (2015) 'hero2lte', # Samsung Galaxy S7 Edge (2016) 'gtp7510', # Samsung Galaxy Tab 10.1 (2011) 'sloane', # Amazon Fire TV 2 (2018?) 'BRAVIA_ATV2' # Sony Bravia 4K GB (2016) ] for device in DEVICE_CODE_NAMES: logging.info("Download with device {}".format(device)) try: api = GooglePlayAPI(device_codename=device) api.login(email=settings.GOOGLE_ACCOUNT_USERNAME, password=settings.GOOGLE_ACCOUNT_PASSWORD) if not os.path.exists(tmp_dir): os.mkdir(tmp_dir) download = api.download(handle) with open(apk_tmp, 'wb') as first: for chunk in download.get('file').get('data'): first.write(chunk) except RequestError as e: logging.warning(e) continue except Exception as e: logging.error(e) break apk = Path(apk_tmp) if apk.is_file(): try: storage.put_file(apk_tmp, apk_name) return True except ResponseError as err: logging.error(err) return False return False
def connect(self): ''' Connect aabc to the Google Play API. Credentials might be stored into the keyring if the keyring package is installed. ''' self.gpapi = GooglePlayAPI(locale=self.locale, timezone=self.timezone, device_codename=self.device_codename) ok, err = self.connect_credentials() if ok: self.token = self.gpapi.authSubToken self.gsfid = self.gpapi.gsfId return ok, err
def startdownload(self, pkgid): self.pkgid = pkgid self.asset = Assets() self.asset.update_status(self.pkgid, "downloading") print('\nAttempting to download %s\n' % self.pkgid) self.emit("download_step", {"step": "start", "package": self.pkgid}) try: fl = "" for codename in self.devices_codenames: self.server = GooglePlayAPI(self.locale, self.timezone, device_codename=codename, proxies_config=self.proxy) self.server.login(None, None, self.gsfId, self.authSubToken) try: fl = self.server.download(self.pkgid) if fl == "": raise Exception("No Device") with open(self.apkfile_path + self.pkgid + '.apk', 'wb') as apk_file: for chunk in fl.get('file').get('data'): apk_file.write(chunk) print('\n[+] Download successful\n') self.emit("download_step", { "step": "finish", "package": self.pkgid }) self.asset.update_status(self.pkgid, "downloaded") self.emit("download_step", { "step": "check", "package": self.pkgid }) self.check_aws_sdk_common(self.pkgid) break except requests.exceptions.SSLError: self.emit("download_step", { "step": "error", "msg": "sslerror", "package": self.pkgid }) print("requests.exceptions.SSLError") break except Exception: traceback.print_exc() continue except: print("Unexpected error:", sys.exc_info()[0]) traceback.print_exc() #time.sleep(3) pass
def connect_to_googleplay_api(self): api = GooglePlayAPI() error = None try: if self.token is False: logging(self, "Using credentials to connect to API") username = self.config["gmail_address"] passwd = None if self.config["gmail_password"]: logging(self, "Using plaintext password") passwd = self.config["gmail_password"] elif self.config["keyring_service"] and HAVE_KEYRING == True: passwd = keyring.get_password(self.config["keyring_service"], username) elif self.config["keyring_service"] and HAVE_KEYRING == False: print("You asked for keyring service but keyring package is not installed") sys.exit(ERRORS.KEYRING_NOT_INSTALLED) api.login(email=username, password=passwd) else: logging(self, "Using token to connect to API") api.login(authSubToken=self.token, gsfId=int(self.gsfid,16)) except LoginError as exc: error = exc.value success = False else: self.playstore_api = api try: self.raw_search(list(), 'firefox', 1) except (ValueError, IndexError) as ve: # invalid token or expired logging(self, "Token has expired or is invalid. Retrieving a new one...") self.retrieve_token(self.token_url, force_new=True) api.login(authSubToken=self.token, gsfId=int(self.gsfid,16)) success = True return success, error
def GET_APP(gsfId, authSubToken, package): server = GooglePlayAPI("it_IT", "Europe/Rome") # LOGIN print("\nLogin with ac2dm token and gsfId saved\n") server.login(None, None, gsfId, authSubToken) # DOWNLOAD docid = package print("\nAttempting to download {}\n".format(docid)) fl = server.download(docid) with open(docid + ".apk", "wb") as apk_file: for chunk in fl.get("file").get("data"): apk_file.write(chunk) print("\nDownload successful\n")
def connect(self): """ Connect GplayCli to the Google Play API. If self.token_enable=True, the token from self.retrieve_token is used. Else, classical credentials are used. They might be stored into the keyring if the keyring package is installed. """ self.api = GooglePlayAPI(locale=self.locale, timezone=self.timezone, device_codename=self.device_codename) if self.token_enable: self.retrieve_token() return self.connect_token() else: return self.connect_credentials()
def connect_to_googleplay_api(self): self.playstore_api = GooglePlayAPI( device_codename=self.device_codename) error = None email = None password = None authSubToken = None gsfId = None if self.token_enable is False: logger.info("Using credentials to connect to API") email = self.config["gmail_address"] if self.config["gmail_password"]: logger.info("Using plaintext password") password = self.config["gmail_password"] elif self.config["keyring_service"] and HAVE_KEYRING is True: password = keyring.get_password(self.config["keyring_service"], email) elif self.config["keyring_service"] and HAVE_KEYRING is False: print( "You asked for keyring service but keyring package is not installed" ) sys.exit(ERRORS.KEYRING_NOT_INSTALLED) else: if self.token_passed: logger.info("Using passed token to connect to API") else: logger.info("Using auto retrieved token to connect to API") authSubToken = self.token gsfId = int(self.gsfid, 16) with warnings.catch_warnings(): warnings.simplefilter('error') try: self.playstore_api.login(email=email, password=password, authSubToken=authSubToken, gsfId=gsfId) except LoginError as le: logger.error( "Bad authentication, login or password incorrect (%s)" % le) return False, ERRORS.CANNOT_LOGIN_GPLAY except (ValueError, IndexError, LoginError, DecodeError, SystemError) as ve: # invalid token or expired logger.info( "Token has expired or is invalid. Retrieving a new one...") self.refresh_token() success = True return success, error
def __init__(self): self.gid = "" self.gwd = "" self.authSubToken = "" self.options = Options() self.options.headless = False self.chrome_driver = "./chromedriver" if platform.system() == "Windows": self.chrome_driver = "./chromedriver.exe" self.request_url = "https://accounts.google.com/b/0/DisplayUnlockCaptcha" self.apkfile_path = os.path.join("./tmp/") if os.path.exists(self.apkfile_path) == False: os.mkdir(self.apkfile_path) self.server = GooglePlayAPI('ko_KR', 'Asia/Seoul') self.devices_codenames = GooglePlayAPI.getDevicesCodenames() self.devices_codenames.reverse()
def test_reproducible_signal_from_play_store(signal_apk): gsfId = int(os.getenv("GPAPI_GSFID", 0)) authSubToken = os.getenv("GPAPI_TOKEN") if not gsfId or not authSubToken: pytest.skip("GPAPI_GSFID or GPAPI_TOKEN missing") from gpapi.googleplay import GooglePlayAPI, RequestError server = GooglePlayAPI() try: server.login(None, None, gsfId, authSubToken) except RequestError as err: pytest.skip("Couldn't login to Play Store: {}".format(err)) try: server.log(SIGNAL_DOCID) except RequestError as err: pytest.skip("Couldn't fetch APK information from Play Store: {}".format(err)) fl = server.download(SIGNAL_DOCID) with open(signal_apk, "wb") as apk_file: for chunk in fl.get("file").get("data"): apk_file.write(chunk) popen = Popen( ["./reproducible-signal.sh", "--play", signal_apk], stdout=PIPE, universal_newlines=True, bufsize=1 ) for line in popen.stdout: current_line = line.rstrip() print(current_line) popen.wait() assert current_line == "APKs match!" assert popen.returncode == 0
def __init__(self, config, proxies): self.delay = 18000 # self.delay = 4000 self.mode = 'proactive' self.config = config self.proxies = proxies self.server = GooglePlayAPI('en_US', 'America/New York', "hero2lte", self.proxies) self.category_refresh_frequency = 168
def main(): parser = argparse.ArgumentParser( description='A tool for checking if apps on the Google Play \ Store use Android App Bundles') parser.add_argument('apps', nargs='*', help='Apps to check if using Android App Bundles') parser.add_argument('-c', '--config', help='Use a different config file than gplaycli.conf', metavar='CONF_FILE', nargs=1) parser.add_argument('-dc', '--device-codename', help='The device codename to fake', choices=GooglePlayAPI.getDevicesCodenames(), metavar='DEVICE_CODENAME') parser.add_argument('-i', '--input-file', help='File containing a list of app IDs to \ check if using Android App Bundles') parser.add_argument('-r', '--report-file', help='The file to write the report to') parser.add_argument('-v', '--verbose', help='Be verbose', action='store_true') parser.add_argument('-V', '--version', help='Print version and exit', action='store_true') args = parser.parse_args() if args.version: print(__version__) exit(0) # Combine app IDs from positional args and input file into one list apps = args.apps if args.input_file: apps += get_apps_from_input_file(args.input_file) # Remove duplicates apps = set(apps) # Ensure there is at least one app specified to check if len(apps) == 0: logger.error( 'Must specify at least one app to check using positional arguments or --input-file.\n' ) parser.print_help(sys.stderr) exit(1) checker = aabchecker(args, args.config) checker.check_aab(apps)
def __init__(self, debug=True, fdroid=False): self.currentSet = [] self.debug = debug self.fdroid = fdroid self.loggedIn = False self.firstRun = True # configuring download folder if self.fdroid: self.download_path = os.path.join(os.getcwd(), 'repo') else: self.download_path = os.getcwd() # configuring fdroid data if self.fdroid: self.fdroid_exe = 'fdroid' self.fdroid_path = os.getcwd() self.fdroid_init() self.service = GooglePlayAPI(self.debug)
def parse_config_l(config_file): global USER, PASSWORD, FIRST_TIME assert os.path.isfile( config_file), '%s is not a valid file or path to file' % config_file config = configparser.ConfigParser() config.read(config_file) assert 'user' in config[ 'login'], 'Config file %s does not have an User value in the sdk section' % config_file assert 'password' in config[ 'login'], 'Config file %s does not have a Password value in the section' % config_file assert 'first_time' in config[ 'login'], 'Config file %s does not have a FT value in the section' % config_file USER = config['login']['user'] print('\n %s \n' % USER) PASSWORD = config['login']['password'] print('\n %s \n' % PASSWORD) FIRST_TIME = config['login']['first_time'] print('\n %s \n' % FIRST_TIME) server = GooglePlayAPI('es_ES', 'Europe/Spain') if FIRST_TIME is True: print('\nLogging in with email and password\n') server.login(USER, PASSWORD, None, None) gsfId = server.gsfId print(gsfId) authSubToken = server.authSubToken print(authSubToken) with open('server.pkl', 'wb') as f: pickle.dump(server, f, pickle.HIGHEST_PROTOCOL) with open('server.pkl', 'rb') as f: server = pickle.load(f) gsfId = server.gsfId print(gsfId) authSubToken = server.authSubToken print(authSubToken) print('\nNow trying secondary login with ac2dm token and gsfId saved\n') server = GooglePlayAPI('es_ES', 'Europe/Spain') server.login(None, None, gsfId, authSubToken) return server
class ServerAPI(): def __init__(self, ConfigFile): self._config = ConfigFile self._server = GooglePlayAPI(self._config.get_locale(), self._config.get_timezone()) def login_with_token(self): self._server.login(None, None, self._config.get_gsfId(), self._config.get_authSubToken()) def get_token(self): self._server.login(self._config.get_mail(), self._config.get_password()) self._config.set_gsfId = self._server.gsfId self._config.set_authSubToken = self._server.authSubToken def download_app(self, appName): details = self._server.details(appName) docId = details.get('docId') filename = details.get('filename') if filename is None: filename = details.get('docId') + '.apk' if details is None: print('Package ', docid, ' does not exist on the server') else: print(docid, ' , ', filename, ' , ', details['versionCode']) data_gen = self._server.download(docid, details['versionCode']) data_gen = data_gen.get('file').get('data') filepath = filename with open(filepath, 'wb') as apk_file: for chunk in data_gen: apk_file.write(chunk)
def main(): # get args sys.argv.pop(0) appNames = sys.argv # read token cache tokenCache = configparser.ConfigParser() tokenCache.read('.cache.ini') try: gsfId = int(tokenCache['DEFAULT'] ['gsfId']) # does not get saved as int, but as str! authSubToken = tokenCache['DEFAULT']['authSubToken'] timezone = tokenCache['DEFAULT']['timezone'] locale = tokenCache['DEFAULT']['locale'] except configparser.NoSectionError: print( "Missing login data. Please, check your cache file, or run login.py" ) sys.exit(1) except configparser.ParsingError: print( "The cache file could not be read correctly. Please, check it, or run login.py" ) sys.exit(1) except configparser.Error as e: print("Error ", e, " while reading cache file") sys.exit(1) server = GooglePlayAPI(locale, timezone) # log in with saved credentials try: server.login(None, None, gsfId, authSubToken) except: print("Error while trying to login to GP servers") sys.exit(2) for app in appNames: try: details = server.details(app) docid = details.get('docId') filename = details.get('filename') if filename is None: filename = details.get('docId') + '.apk' if details is None: print('Package ', docid, ' does not exist') continue except: print("Error while trying to get details for", app) else: print(docid, ' , ', filename, details['versionCode']) data_gen = server.download(docid, details['versionCode']) data_gen = data_gen.get('file').get('data') filepath = filename with open(filepath, 'wb') as apk_file: for chunk in data_gen: apk_file.write(chunk)
def firstlogin(self, gid, gpw): self.server = GooglePlayAPI(self.locale, self.timezone, proxies_config=self.proxy) self.gid = gid self.gpw = gpw for i in range(10): try: print("try : " + str(i + 1) + "/10") print('\nLogging in with email and password\n') self.server.login(self.gid, self.gpw, None, None) self.gsfId = self.server.gsfId self.authSubToken = self.server.authSubToken return self.secondlogin() except SecurityCheckError: #traceback.print_exc() print("SecurityCheckError") return False except Exception: time.sleep(0.5) pass print("UNKNOWNERROR") return False
def get(self, device=None): if device and device not in config.getDevicesCodenames(): self.write("Error: no such device %s" % device) return if device is None: device = 'bacon' email, pwd = random.choice(self.credentials_list) print("Using", email) need_login = False if device in self.apis[email]: # check token not expired and return api = self.apis[email][device] try: api.search('drv') except Exception: need_login = True elif device not in self.apis[email] or need_login: # need fresh login api = GooglePlayAPI(device_codename = device) api.login(email, pwd) self.apis[email][device] = api # wait for login to propagate time.sleep(5) self.write("%s %s" % (api.authSubToken, hex(api.gsfId)[2:]))
def __init__(self, debug=True, fdroid=False): self.currentSet = [] self.totalNumOfApps = 0 self.debug = debug self.fdroid = fdroid self.firstRun = True self.loggedIn = False self._email = None self._passwd = None self._last_fdroid_update = None # configuring download folder if self.fdroid: self.download_path = os.path.join(os.getcwd(), 'repo') else: self.download_path = os.getcwd() # configuring fdroid data if self.fdroid: self.fdroid_exe = 'fdroid' self.fdroid_path = os.getcwd() self.fdroid_init() self.service = GooglePlayAPI(self.debug)
from gpapi.googleplay import GooglePlayAPI import argparse ap = argparse.ArgumentParser(description='Test download of expansion files') ap.add_argument('-e', '--email', dest='email', help='google username') ap.add_argument('-p', '--password', dest='password', help='google password') args = ap.parse_args() server = GooglePlayAPI('it_IT', 'Europe/Rome') # LOGIN print('\nLogging in with email and password\n') server.login(args.email, args.password, None, None) docid = 'com.pixel.gun3d' print('\nDownloading apk\n') download = server.download(docid, expansion_files=True) with open(download['docId'] + '.apk', 'wb') as first: for chunk in download.get('file').get('data'): first.write(chunk) print('\nDownloading additional files\n') for obb in download['additionalData']: name = obb['type'] + '.' + str(obb['versionCode']) + '.' + download['docId'] + '.obb' with open(name, 'wb') as second: for chunk in obb.get('file').get('data'): second.write(chunk)
from gpapi.googleplay import GooglePlayAPI, RequestError import sys import argparse ap = argparse.ArgumentParser(description='Test download of expansion files') ap.add_argument('-e', '--email', dest='email', help='google username') ap.add_argument('-p', '--password', dest='password', help='google password') args = ap.parse_args() server = GooglePlayAPI('it_IT', 'Europe/Rome') # LOGIN print('\nLogging in with email and password\n') server.login(args.email, args.password, None, None) gsfId = server.gsfId authSubToken = server.authSubToken print('\nNow trying secondary login with ac2dm token and gsfId saved\n') server = GooglePlayAPI('it_IT', 'Europe/Rome') server.login(None, None, gsfId, authSubToken) # SEARCH apps = server.search('telegram', 34, None) print('\nSearch suggestion for "fir"\n') print(server.searchSuggest('fir'))