def __init__(self): self.internal_data_path = "/data/data/{}" self.external_data_path = "/sdcard/Android/data/{}" self.internal_data_dump_name = "{}_internal.tar.gz" self.external_data_dump_name = "{}_external.tar.gz" #Dump internal data https://android.stackexchange.com/questions/85564/need-one-line-adb-shell-su-push-pull-to-access-data-from-windows-batch-file self.check_root_command = """{} -s {} shell "su -c 'echo HASROOT'""" self.magic_root_command = """{} -s {} shell "su -c 'cd {} && tar czf - ./ --exclude='./files'| base64' 2>/dev/null" | {} -d""" self.magic_noroot_command = """{} -s {} shell "cd {} && tar czf - ./ --exclude='./files'| base64 2>/dev/null" | {} -d""" if not ( Utils.get_platform().startswith("windows") or Utils.get_platform().startswith("darwin") ): #some linux versions doesn't output if contains errors, so we ignore it. but base64 for windows doesn't have this attribute self.magic_root_command += "i" #add -i flag to base64 decode to avoid some encoding issues self.magic_noroot_command += "i" #add -i flag to base64 decode to avoid some encoding issues self.adb_location = Utils.get_adb_location() self.base64_location = Utils.get_base64_location() self.dumps_path = os.path.join(Utils.get_base_path_folder(), "dumps") Utils.check_and_generate_folder(self.dumps_path) self.path_dump_folder = os.path.join(self.dumps_path, Utils.get_current_time())
def set_header(self): self.report = {} self.report["header"] = { "report_name": Utils.get_current_time(), "report_date": Utils.get_current_millis(), "app_name": self.app_name, "app_id": self.app_id }