I am trying to hook functions with Frida where one .so file (x.so) is loaded early and another .so file (z.so) is loaded slightly later, after some processing is done by the application.

This is what I want to do

  1. Start Frida early in order to hook the early functions
  2. Start Frida late in order to hook the late functions

So if I used Frida script to start the application, I can hook the early functions but Frida will show an error that it cannot find the late functions (unable to find export).

Currently, what I did was use one Frida script to start the application and then used another Frida script to attach to the already running process to hook the late function.

Starts Frida early

frida -U -f com.myapplication.file -l frida_script.js --no-pause

Attach Frida to running process

frida -U -l frida_script2.js -p 4444

Are there better ways to perform early and late hooking in one script such that some hooks are started early and some hooks can start once the .so file is loaded?

  • You can start the Android in mode "waiting for debugger". In this case the process exists but the app does not starts running until the debugger (-> Frida) has been attached. See for example this question.
    – Robert
    Commented Jan 15, 2020 at 18:25
  • Thanks @Robert I will take a look at that
    – localacct
    Commented Jan 17, 2020 at 3:49


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.