From 1794877a754720effea01327500c10531a8dd40d Mon Sep 17 00:00:00 2001 From: emi~ Date: Thu, 15 Aug 2019 05:33:28 -0300 Subject: [PATCH] Fixes deadlock at kill_cmd and execute_cmd I don't know the particular reason in which the old command wasn't working, but it was deadlocking on the `Popen(kill_cmd)` line. Even spawning the command on a `adb shell` did not work. If I'd to guess, maybe something related to newer devices, SDK versions, etc.? Notwithstanding, it seems to me that the proposed implementation is more robust, at least based on the little knowledge I have :) --- frida_push/command.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frida_push/command.py b/frida_push/command.py index 069cabd..772e665 100644 --- a/frida_push/command.py +++ b/frida_push/command.py @@ -154,8 +154,8 @@ def push_and_execute(fname, transport_id=None): push_cmd = [ADB_PATH, "-t", transport_id, "push", fname, "/data/local/tmp/frida-server"] chmod_cmd = [ADB_PATH, "-t", transport_id, "shell", "chmod 0755 /data/local/tmp/frida-server"] - kill_cmd = [ADB_PATH, "-t", transport_id, "shell", "su 0 killall frida-server"] - execute_cmd = [ADB_PATH, "-t", transport_id, "shell", "su 0 '/data/local/tmp/frida-server'"] + kill_cmd = [ADB_PATH, "-t", transport_id, "shell", "su", "-c", "killall", "frida-server"] + execute_cmd = [ADB_PATH, "-t", transport_id, "shell", "su", "-c", "/data/local/tmp/frida-server"] res = subprocess.Popen(push_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) res.wait()