frida-python icon indicating copy to clipboard operation
frida-python copied to clipboard

Device.spawn() times out, despite successfully launching app

Open une-petite-laitue opened this issue 4 years ago • 3 comments

Hi there,

I'm using Frida 14.2.14 against an A13 device running iOS 14.3, which is jailbroken using unc0ver 6.1.1.

I would expect the following code to spawn a new instance of <app>.

import frida, time

device = frida.get_usb_device()
device.kill("app") # Make sure no instances of "app" are running

time.sleep(3) # give the device a moment to collect its thoughts

device.spawn("com.app")

Doing this does spawn a new instance of <app> on my device in a resumed state, however the script containing this code hangs, before giving the following error:

frida.TimedOutError: unexpectedly timed out while waiting for app to launch

It appears that the script isn't able to acknowledge that <app> has launched - either Frida server is not sending a notification, or the Device object isn't receiving it.

une-petite-laitue avatar Mar 26 '21 17:03 une-petite-laitue

Still bugging, but a (slightly shaky) workaround for anyone experiencing the same:

import frida
device = frida.get_usb_device()
device.kill("App")
try:
    device.spawn("com.app")
except frida.TimedOutError:
    pass
device.attach("App")

une-petite-laitue avatar Mar 30 '21 09:03 une-petite-laitue

Killing/Spawning through frida took forever or didn't do anything, but this workaround worked instantly & every time for me:

import frida
import subprocess

app = 'com.app.name'
subprocess.run(['adb', 'shell', f'am force-stop {app} && monkey -p {app} 1'])

device = frida.get_usb_device()
session = device.attach(app)

j4k0xb avatar Apr 23 '21 19:04 j4k0xb

bump

neomafo88 avatar Apr 12 '23 08:04 neomafo88