Exemple #1
0
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)
Exemple #2
0
    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()
Exemple #3
0
 def __init__(self, socketio):
     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("./apk/")
     if os.path.exists(self.apkfile_path) == False:
         os.mkdir(self.apkfile_path)
     self.locale = "en_US"  #'ko_KR'
     self.timezone = None  #'Asia/Seoul'
     self.devices_codenames = GooglePlayAPI.getDevicesCodenames()
     self.devices_codenames.reverse()
     self.proxy = {}
     self.socketio = socketio
     self.namespace = "/apk_download"
Exemple #4
0
def main():
    """
	Main function.
	Parse command line arguments
	"""
    parser = argparse.ArgumentParser(
        description="A Google Play Store Apk downloader"
        " and manager for command line")
    parser.add_argument('-V',
                        '--version',
                        action='store_true',
                        dest='version',
                        help="Print version number and exit")
    parser.add_argument('-y',
                        '--yes',
                        action='store_true',
                        dest='yes_to_all',
                        help="Say yes to all prompted questions")
    parser.add_argument('-l',
                        '--list',
                        action='store',
                        dest='list',
                        metavar="FOLDER",
                        type=str,
                        help="List APKS in the given folder, with details")
    parser.add_argument('-s',
                        '--search',
                        action='store',
                        dest='search_string',
                        metavar="SEARCH",
                        type=str,
                        help="Search the given string in Google Play Store")
    parser.add_argument('-P',
                        '--paid',
                        action='store_true',
                        dest='paid',
                        default=False,
                        help="Also search for paid apps")
    parser.add_argument('-n',
                        '--number',
                        action='store',
                        dest='number_results',
                        metavar="NUMBER",
                        type=int,
                        help="For the search option, returns the given "
                        "number of matching applications")
    parser.add_argument('-d',
                        '--download',
                        action='store',
                        dest='packages_to_download',
                        metavar="AppID",
                        nargs="+",
                        type=str,
                        help="Download the Apps that map given AppIDs")
    parser.add_argument('-av',
                        '--append-version',
                        action='store_true',
                        dest='append_version',
                        help="Append versionstring to APKs when downloading")
    parser.add_argument('-a',
                        '--additional-files',
                        action='store_true',
                        dest='addfiles_enable',
                        default=False,
                        help="Enable the download of additional files")
    parser.add_argument('-F',
                        '--file',
                        action='store',
                        dest='load_from_file',
                        metavar="FILE",
                        type=str,
                        help="Load packages to download from file, "
                        "one package per line")
    parser.add_argument('-u',
                        '--update',
                        action='store',
                        dest='update_folder',
                        metavar="FOLDER",
                        type=str,
                        help="Update all APKs in a given folder")
    parser.add_argument(
        '-f',
        '--folder',
        action='store',
        dest='dest_folder',
        metavar="FOLDER",
        nargs=1,
        type=str,
        default=".",
        help="Where to put the downloaded Apks, only for -d command")
    parser.add_argument('-dc',
                        '--device-codename',
                        action='store',
                        dest='device_codename',
                        metavar="DEVICE_CODENAME",
                        type=str,
                        default="bacon",
                        help="The device codename to fake",
                        choices=GooglePlayAPI.getDevicesCodenames())
    parser.add_argument('-ts',
                        '--token-str',
                        action='store',
                        dest='token_str',
                        metavar="TOKEN_STR",
                        type=str,
                        default=None,
                        help="Supply token string by yourself, "
                        "need to supply GSF_ID at the same time")
    parser.add_argument('-g',
                        '--gsf-id',
                        action='store',
                        dest='gsf_id',
                        metavar="GSF_ID",
                        type=str,
                        default=None,
                        help="Supply GSF_ID by yourself, "
                        "need to supply token string at the same time")
    parser.add_argument(
        '-t',
        '--token',
        action='store_true',
        dest='token_enable',
        default=None,
        help="Instead of classical credentials, use the tokenize version")
    parser.add_argument(
        '-tu',
        '--token-url',
        action='store',
        dest='token_url',
        metavar="TOKEN_URL",
        type=str,
        default=None,
        help="Use the given tokendispenser URL to retrieve a token")
    parser.add_argument('-v',
                        '--verbose',
                        action='store_true',
                        dest='verbose',
                        help="Be verbose")
    parser.add_argument('-c',
                        '--config',
                        action='store',
                        dest='config',
                        metavar="CONF_FILE",
                        nargs=1,
                        type=str,
                        default=None,
                        help="Use a different config file than gplaycli.conf")
    parser.add_argument(
        '-p',
        '--progress',
        action='store_true',
        dest='progress_bar',
        help="Prompt a progress bar while downloading packages")
    parser.add_argument(
        '-L',
        '--log',
        action='store_true',
        dest='logging_enable',
        default=False,
        help="Enable logging of apps status. Downloaded, failed,"
        "not available apps will be written in separate logging files")
    parser.add_argument('-lo',
                        '--locale',
                        action='store',
                        dest='locale',
                        type=str,
                        metavar="LOCALE",
                        help="The locale to use. Ex: en_GB")
    parser.add_argument('-tz',
                        '--timezone',
                        action='store',
                        dest='timezone',
                        type=str,
                        metavar="TIMEZONE",
                        help="The timezone to use. Ex: CEST")

    if len(sys.argv) < 2:
        sys.argv.append("-h")

    args = parser.parse_args()

    if args.version:
        print(__version__)
        return

    cli = GPlaycli(args, args.config)

    if args.list:
        print(util.list_folder_apks(args.list))

    if args.update_folder:
        cli.prepare_analyse_apks()

    if args.search_string:
        cli.verbose = True
        nb_results = 10
        if args.number_results:
            nb_results = args.number_results
        cli.search(args.search_string, nb_results, not args.paid)

    if args.load_from_file:
        args.packages_to_download = util.load_from_file(args.load_from_file)

    if args.packages_to_download is not None:
        if args.dest_folder is not None:
            cli.set_download_folder(args.dest_folder[0])
        cli.download(args.packages_to_download)
Exemple #5
0
def main():
    """
	Main function.
	Parse command line arguments
	"""
    parser = argparse.ArgumentParser(
        description=
        "A Google Play Store Apk downloader and manager for command line")
    parser.add_argument('-V',
                        '--version',
                        help="Print version number and exit",
                        action='store_true')
    parser.add_argument('-v',
                        '--verbose',
                        help="Be verbose",
                        action='store_true')
    parser.add_argument('-s',
                        '--search',
                        help="Search the given string in Google Play Store",
                        metavar="SEARCH")
    parser.add_argument('-d',
                        '--download',
                        help="Download the Apps that map given AppIDs",
                        metavar="AppID",
                        nargs="+")
    parser.add_argument('-y',
                        '--yes',
                        help="Say yes to all prompted questions",
                        action='store_true')
    parser.add_argument('-l',
                        '--list',
                        help="List APKS in the given folder, with details",
                        metavar="FOLDER")
    parser.add_argument('-P',
                        '--paid',
                        help="Also search for paid apps",
                        action='store_true',
                        default=False)
    parser.add_argument(
        '-n',
        '--number',
        help=
        "For the search option, returns the given number of matching applications",
        metavar="NUMBER",
        type=int)
    parser.add_argument('-av',
                        '--append-version',
                        help="Append versionstring to APKs when downloading",
                        action='store_true')
    parser.add_argument('-a',
                        '--additional-files',
                        help="Enable the download of additional files",
                        action='store_true',
                        default=False)
    parser.add_argument(
        '-F',
        '--file',
        help="Load packages to download from file, one package per line",
        metavar="FILE")
    parser.add_argument('-u',
                        '--update',
                        help="Update all APKs in a given folder",
                        metavar="FOLDER")
    parser.add_argument(
        '-f',
        '--folder',
        help="Where to put the downloaded Apks, only for -d command",
        metavar="FOLDER",
        nargs=1,
        default=['.'])
    parser.add_argument('-dc',
                        '--device-codename',
                        help="The device codename to fake",
                        choices=GooglePlayAPI.getDevicesCodenames(),
                        metavar="DEVICE_CODENAME")
    parser.add_argument(
        '-t',
        '--token',
        help="Instead of classical credentials, use the tokenize version",
        action='store_true',
        default=True)
    parser.add_argument(
        '-tu',
        '--token-url',
        help="Use the given tokendispenser URL to retrieve a token",
        metavar="TOKEN_URL")
    parser.add_argument(
        '-ts',
        '--token-str',
        help=
        "Supply token string by yourself, need to supply GSF_ID at the same time",
        metavar="TOKEN_STR")
    parser.add_argument(
        '-g',
        '--gsfid',
        help=
        "Supply GSF_ID by yourself, need to supply token string at the same time",
        metavar="GSF_ID")
    parser.add_argument('-c',
                        '--config',
                        help="Use a different config file than gplaycli.conf",
                        metavar="CONF_FILE",
                        nargs=1)
    parser.add_argument(
        '-p',
        '--progress',
        help="Prompt a progress bar while downloading packages",
        action='store_true')
    parser.add_argument(
        '-L',
        '--log',
        help="Enable logging of apps status in separate logging files",
        action='store_true',
        default=False)

    if len(sys.argv) < 2:
        sys.argv.append("-h")

    args = parser.parse_args()

    if args.version:
        print(__version__)
        return

    cli = GPlaycli(args, args.config)

    if args.list:
        print(util.list_folder_apks(args.list))

    if args.update:
        cli.prepare_analyse_apks()
        return

    if args.search:
        cli.verbose = True
        nb_results = 10
        if args.number:
            nb_results = args.number
        cli.search(args.search, nb_results, not args.paid)

    if args.file:
        args.download = util.load_from_file(args.file)

    if args.download is not None:
        if args.folder is not None:
            cli.download_folder = args.folder[0]
        cli.download(args.download)
Exemple #6
0
def main():
    parser = argparse.ArgumentParser(description="A Google Play Store Apk downloader and manager for command line")
    parser.add_argument('-V', '--version', action='store_true', dest='version', help='Print version number and exit')
    parser.add_argument('-y', '--yes', action='store_true', dest='yes_to_all', help='Say yes to all prompted questions')
    parser.add_argument('-l', '--list', action='store', dest='list', metavar="FOLDER",
                        type=str, help="List APKS in the given folder, with details")
    parser.add_argument('-s', '--search', action='store', dest='search_string', metavar="SEARCH",
                        type=str, help="Search the given string in Google Play Store")
    parser.add_argument('-P', '--paid', action='store_true', dest='paid',
                        default=False, help='Also search for paid apps')
    parser.add_argument('-n', '--number', action='store', dest='number_results', metavar="NUMBER",
                        type=int, help="For the search option, returns the given number of matching applications")
    parser.add_argument('-d', '--download', action='store', dest='packages_to_download', metavar="AppID", nargs="+",
                        type=str, help="Download the Apps that map given AppIDs")
    parser.add_argument('-a', '--additional-files', action='store_true', dest='addfiles_enable',
                        default=False, help="Enable the download of additional files")
    parser.add_argument('-F', '--file', action='store', dest='load_from_file', metavar="FILE",
                        type=str, help="Load packages to download from file, one package per line")
    parser.add_argument('-u', '--update', action='store', dest='update_folder', metavar="FOLDER",
                        type=str, help="Update all APKs in a given folder")
    parser.add_argument('-f', '--folder', action='store', dest='dest_folder', metavar="FOLDER", nargs=1,
                        type=str, default=".", help="Where to put the downloaded Apks, only for -d command")
    parser.add_argument('-dc', '--device-codename', action='store', dest='device_codename', metavar="DEVICE_CODENAME",
                        type=str, default="bacon", help="The device codename to fake", choices=GooglePlayAPI.getDevicesCodenames())
    parser.add_argument('-t', '--token', action='store_true', dest='token_enable', default=None,
                        help='Instead of classical credentials, use the tokenize version')
    parser.add_argument('-tu', '--token-url', action='store', dest='token_url', metavar="TOKEN_URL",
                        type=str, default=None, help="Use the given tokendispenser URL to retrieve a token")
    parser.add_argument('-v', '--verbose', action='store_true', dest='verbose', help='Be verbose')
    parser.add_argument('-c', '--config', action='store', dest='config', metavar="CONF_FILE", nargs=1,
                        type=str, default=None, help="Use a different config file than gplaycli.conf")
    parser.add_argument('-p', '--progress', action='store_true', dest='progress_bar',
                        help='Prompt a progress bar while downloading packages')
    parser.add_argument('-L', '--log', action='store_true', dest='logging_enable', default=False,
                        help='Enable logging of apps status. Downloaded, failed, not available apps will be written in separate logging files')
    parser.add_argument('-ic', '--install-cronjob', action='store_true', dest='install_cronjob',
                        help='Install cronjob for regular APKs update. Use --yes to automatically install to default locations')

    if len(sys.argv) < 2:
        sys.argv.append("-h")

    args = parser.parse_args()

    if args.version:
        print(__version__)
        return

    if args.install_cronjob:
        sys.exit(install_cronjob(args.yes_to_all))

    cli = GPlaycli(args, args.config)
    success, error = cli.connect_to_googleplay_api()
    if not success:
        logger.error("Cannot login to GooglePlay ( %s )" % error)
        sys.exit(ERRORS.CANNOT_LOGIN_GPLAY)

    if args.list:
        print(cli.list_folder_apks(args.list))

    if args.update_folder:
        cli.prepare_analyse_apks()

    if args.search_string:
        cli.verbose = True
        nb_results = 10
        if args.number_results:
            nb_results = args.number_results
        cli.search(list(), args.search_string, nb_results, not args.paid)

    if args.load_from_file:
        args.packages_to_download = load_from_file(args.load_from_file)

    if args.packages_to_download is not None:
        if args.dest_folder is not None:
            cli.set_download_folder(args.dest_folder[0])
        cli.download_packages(args.packages_to_download)