def pull_package_by_path(device, package_path): package_name = Path(package_path).parts[-2] valid = connection.is_valid(device) path = dir_check(Path.cwd() / 'backup' / package_name) valid.pull(package_path, path)
def show_by_name(device): name = input('Input Package Name : ') valid_device = connection.is_valid(device) for p in get_list(valid_device): if name in p: print(p) input('\npress any key to continue...')
def manual(client): valid_device = connection.is_valid(client) _list = package_list.get(valid_device) print(_list) packages = PackageList(_list) result = write_list(packages) execute(client, result) info_printer('package_manual_end')
def execute(device, package_name): valid_device = connection.is_valid(device) for i in package_name: adb_pull(valid_device, i['path']) adb = valid_device.shell('pm uninstall -k --user 0 ' + i['package']) print(adb) if adb is not 'Success': print(adb.split('\n')[0])
def find_package_by_name(device): name = input('Input Package Name : ') result = [] valid_device = connection.is_valid(device) for p in get_list(valid_device): if name in p: result.append(p) return result
def get(device): valid_device = connection.is_valid(device) check_aapt(valid_device) info_printer('package_list_loading') a = valid_device.shell('pm list packages -s -f') package_list = list() for line in tqdm(a.split('\n')): if len(line) is not 0: package_list.append(Package_Tool.information(line)) return package_list
def show(device): valid_device = connection.is_valid(device) check_aapt(valid_device) a = valid_device.shell('pm list packages -s -f') for line in a.split('\n'): if len(line) is not 0: item = Package_Tool.information(line) if len(item['label']) is 0: print('Package Name : {0}'.format(item['package'])) else: print('Package Name : {0}, Package Label : {1}'.format( item['package'], item['label'])) input('\npress any key to continue...')
def make(device): valid_device = connection.is_valid(device) package_list = get(valid_device) info_printer('config_write_info') config_name = str(input('Please Input config file name : ')) + '.json' config_descriptor = Path(Path.cwd() / 'config' / config_name).open('w', encoding='utf-8') helper = Package.PackageList(package_list) info_printer('list_make_input') packages = write_list(helper) # package_config = config_writer(packages) print(packages) print(json.dumps(packages)) config_descriptor.write(json.dumps(packages)) config_descriptor.close() info_printer('done')
def config_main(device): path = Path.cwd() / 'config' while True: print('\nchoose config setting : ') print('1. SKT') print('2. KT') print('3. LG') print('4. custom') print('5. create config file') print('6. manual mode') print('99. back') i = input_int() if i is 1: package_list = get_config(path / 'skt') break elif i is 2: package_list = get_config(path / 'kt') break elif i is 3: package_list = get_config(path / 'lg') break elif i is 4: custom_path = input('\nPlease input Absolute Path : ') package_list = get_config(custom_path) break elif i is 5: valid = connection.is_valid(device) make(valid) return None elif i is 6: return 'Manual' elif i is 99: return None else: print('Invalid Input!') return package_list
def by_list(device, packages): valid_device = connection.is_valid(device) print('\n\nAre you sure disable this packages? ' 'Please remind package name : \n') for p in packages: print(p) while True: check = input('\nYes(y)/No(n) : ') if check is 'y': for p in packages: execute(valid_device, p) print('\nDisable Complete!') break elif check is 'n': print('Packages are not disabled.') break else: print('Invalid Input!') input('\npress any key to continue...')
print('/ /') print('/ DongjakGuMin([email protected]) /') print('/ /') print('/////////////////////////////////////////////////////////') print('\n') print('1: show package list') print('2: disable package list') print('3: pull package') print('4: push package') print('5: miscellaneous') print('6: exit') print('\n') choice = input_int() if choice is 1: package_list.show(connection.is_valid(client)) elif choice is 2: disable_package.main(connection.is_valid(client)) elif choice is 3: print('Not implemented') elif choice is 4: print('Not implemented') elif choice is 5: print('Not implemented') elif choice is 6: exit(0) else: print('Invalid Input!')