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
- Start Frida early in order to hook the early functions
- 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?