From 89b5487d3181462f48fec962cdbe763cc439f800 Mon Sep 17 00:00:00 2001 From: Jean-Marie Mineau Date: Thu, 15 May 2025 14:33:04 +0200 Subject: [PATCH] why do I even need to do this? --- frida/theseus_frida/__init__.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/frida/theseus_frida/__init__.py b/frida/theseus_frida/__init__.py index 5371515..45bc773 100644 --- a/frida/theseus_frida/__init__.py +++ b/frida/theseus_frida/__init__.py @@ -371,10 +371,19 @@ def collect_runtime( app = get_apkid(apk)[0] - if device.enumerate_applications([app]): - # Uninstall the APK if it already exist - subprocess.run([adb, "uninstall", app], env=env) - subprocess.run([adb, "install", "-g", str(apk.absolute())], env=env) + i = 0 + while not device.enumerate_applications([app]): + time.sleep(i) + subprocess.run([adb, "install", "-r", "-g", str(apk.absolute())], env=env) + i += 1 + if i == 10: + print("[!] Failled to install apk") + e = RuntimeError("Failled to install apk") + e.add_note(f"apk: {app} ({str(apk.absolute())})") + e.add_note( + f"installed apk: {' '.join(map(str, device.enumerate_applications()))}" + ) + raise e with FRIDA_SCRIPT.open("r") as file: jsscript = file.read()