I launch a new container and I expose adb (-s +adb) and frida server port(with adb forward command) but some commands works correctly ex.: frida-ps, instead frida command to spawn an application doesn’t work.
this is the command that i run from my host(local): frida -H 127.0.0.1:27042 --debug -t 5 -f com.whatsapp
this is the command result:
____
/ _ | Frida 16.0.19 - A world-class dynamic instrumentation toolkit
| ( _ | |
> _ | Commands:
/_ / |_| help -> Displays the help system
. . . . object? -> Display information about ‘object’
. . . . exit/quit -> Exit
. . . .
. . . . More info at https://frida.re/docs/home/
. . . .
. . . . Connected to 127.0.0.1:27042 (id=socket@127.0.0.1:27042) Failed to spawn: unexpectedly timed out while waiting for app to launch
So, I received always timeout error, and i see that target app(whatsapp in this case) starts correctly in anbox emulator.
However, when running the frida command to launch an application and hook the process, it ended up with the error message: Failed to spawn: unexpectedly timed out while waiting for the app to launch. The problem appears to be that after the new process is spawned, Frida cannot find the correct PID, as the application runs in a nested container, causing this issue. For example, you probably get the same results when running the following Python script:
To make the frida command work, you can attach to the PID using -p instead of the target process (-f ). The PID is the one found in the nested Android container. So after the application is launched, you can query the PID with the following command on the AMS node:
amc exec <container_id> -- sh -c "anbox-shell pidof <target_process>"
and attach the pid from your host
frida -U --debug -t 20 -p <target_pid>
____
/ _ | Frida 16.1.4 - A world-class dynamic instrumentation toolkit
| (_| |
> _ | Commands:
/_/ |_| help -> Displays the help system
. . . . object? -> Display information about 'object'
. . . . exit/quit -> Exit
. . . .
. . . . More info at https://frida.re/docs/home/
. . . .
. . . . Connected to Anbox (id=10.16.146.162:5559)
Attaching...
Chrome Inspector server listening on port 9229
[Anbox::PID::<pid>]->
Could you give it a try?
BR
Gary
P.S.: you may want to setup the remote access to AMS on your host so that you are able to run the amc command from your host and interact with the AMS service running on the server.
Hi, thanks for your answer.
Yes the problem is that Frida cannot rtrieve process id, because I try -F option(attach to frontmost application) of frida server and spawn works correctly. The spawn timeout problem is only on anbox android 12, while in android 11 and android 10 frida server works correctly.
I try also an android 12 created with android studio and frida server works correctly, so the problem is only on ANBOX android 12
I try also an android 12 created with android studio and frida server works correctly, so the problem is only on ANBOX android 12
I guess this was never working on older versions of Anbox Cloud, correct?
Either way this sounds like there is a bug and we need to investigate where it comes from. Can you file a bug here? We will then investigate and try to fix in on of our next patch releases.