frida / frida-gum

Cross-platform instrumentation and introspection library written in C
https://frida.re
Other
753 stars 245 forks source link

process: add get_main_module() #758

Closed mrmacete closed 11 months ago

mrmacete commented 11 months ago

This returns a copy of the details of the module which represents the main executable of the process.

It is exposed to JS via the Process.mainModule property (where it's cached because the main module is constant during the process' lifetime).

For darwin this is implemented by getting the first loaded module for which the Mach-O header's filetype is set to MH_EXECUTE. For all other archs it is currently just the first loaded module (equivalent to Process.enumerateModules()[0]).