예제 #1
0
 def __update_mad(self):
     if self._madver < self._installed_ver:
         logger.error('Mis-matched version number detected.  Not applying any updates')
     else:
         logger.warning('Performing updates from version {} to {} now',
                        self._installed_ver, self._madver)
         all_patches = list(MAD_UPDATES.keys())
         try:
             last_ver = all_patches.index(self._installed_ver)
             first_patch = last_ver + 1
         except ValueError:
             # The current version of the patch was most likely removed as it was no longer needed.  Determine
             # where to start by finding the last executed
             next_patch = None
             for patch_ver in all_patches:
                 if self._installed_ver > patch_ver:
                     continue
                 next_patch = patch_ver
                 break
             try:
                 first_patch = all_patches.index(next_patch)
             except ValueError:
                 logger.critical('Unable to find the next patch to apply')
         updates_to_apply = all_patches[first_patch:]
         logger.info('Patches to apply: {}', updates_to_apply)
         for patch_ver in updates_to_apply:
             self.__apply_update(patch_ver)
         logger.success('Updates to version {} finished', self._installed_ver)
예제 #2
0
 def __install_schema(self):
     try:
         with open('scripts/SQL/rocketmap.sql') as fh:
             tables = "".join(fh.readlines()).split(";")
             for table in tables:
                 install_cmd = '%s;%s;%s'
                 args = ('SET FOREIGN_KEY_CHECKS=0', 'SET NAMES utf8mb4', table)
                 self.dbwrapper.execute(install_cmd % args, commit=True, suppress_log=True)
         self.__set_installed_ver(self._madver)
         logger.success('Successfully installed MAD version {} to the database', self._installed_ver)
         self.__reload_instance_id()
     except Exception:
         logger.critical('Unable to install default MAD schema.  Please install the schema from '
                         'scripts/SQL/rocketmap.sql')
         sys.exit(1)
예제 #3
0
 def __init__(self, architecture: APK_Arch):
     logger.debug('Creating new Google Play API connection')
     args = parseArgs()
     self.token_list = []
     self.token = None
     self.gsfid = None
     self.email = None
     self.valid = False
     try:
         device_codename = getattr(Device_Codename, architecture.name).value
     except ValueError:
         logger.critical('Device architecture not defined')
         raise
     self.tmp_folder: str = args.temp_path
     self.api: GooglePlayAPI = GooglePlayAPI(
         device_codename=device_codename)
     if args.gmail_user:
         self.connect_gmail(args.gmail_user, args.gmail_passwd)
     else:
         self.token_list = self.generate_token_list(args)
         if not self.check_cached_tokens(args):
             self.generate_new_tokens(args)