Embed libfrida-core.a into agent instead of using frida-server. #3521
Replies: 2 comments
-
|
The frida-core-example.c code works with Frida version 16.5.7 (Linux and Android). Something has been broken between that Frida version and the latest Frida version [] Found device: "Local System" |
Beta Was this translation helpful? Give feedback.
-
|
Also - the frida-core-example.c code generates a similar error. [] Found device: "Local System" The version included in https://gist.github.com/oleavr/3edc47c9f69eb048de9d70ed45998f9c is shown as working, but that frida-core-example.c code does not compile against the most recent version of Frida. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
There are situations when invoking frida-server is not an option. I am trying to embed libfrida-core.a into an agent process running as root that forks and uses the libfrida-core.a APIs to provide minimal frida-server like capabilities such as attaching to another process and executing a script. My code (attached) is based on frida-core-example.c provided with the frida-core-devkit-17.2.5-xxxxx.tar.xz archives. Everything goes well until the script executes and returns the error below. Although I did specify the FRIDA_SCRIPT_RUNTIME_V8 runtime in the call to frida_script_options_set_runtime(), I suspect the engine may have fallen back to the FRIDA_SCRIPT_RUNTIME_QJS runtime.
Am I using libfrida-core.a as intended to achieve my goal?
The frida-core-example.c code called frida_init(), but not gum_init_embedded(). I also tried calling gum_init_embedded(), but got same result.
Am I missing something in my code?
In case you are wondernig why I commented all calls to g_print(), they were causing the process to crash, so I decided to avoid that issue for now.
[] In do_instrument, calling gum_init_embedded()
[] In do_instrument, calling frida_init()
[] In do_instrument, starting main loop
[] In do_instrument, getting device manager
[] In do_instrument, getting devices
[] In do_instrument, got 3 devices
[] Found device: "Local System"
[] Found device: "Local Socket"
[] Found device: "GDB Remote Stub"
[] In do_instrument, got local device
[] In do_instrument, getting Frida session
[] In do_instrument, got Frida session
[] In do_instrument, attached to Frida session
[] Attached
[] Requested runtime: V8
[+] script loaded
on_message: {"type":"error","description":"TypeError: Module.findExportByName is not a function","stack":"TypeError: Module.findExportByName is not a function\n at /example.js:3:25","fileName":"/example.js","lineNumber":3,"columnNumber":25}
[] Script loaded
frida-lite.txt
Beta Was this translation helpful? Give feedback.
All reactions