Search code examples
javascriptfopenfrida

findExportByName with Frida in libc*.so


I tried to find the address of fopen in libc

But sometimes the libc is libc-2.20.so or libc-2.21.so

So I tried Module.findExportByName("libc*.so", 'fopen');

But that not help, why? is there any solution ?


Solution

  • Module.findExportByName expects a full name of a module, wildcards are not supported.

    If you don't know the exact module name you have to get the list of all modules and pick the correct one:

    for (let m of Process.enumerateModules()) {
        console.log("Checking module " + m.name);
        if (m.name.match("libc.*\\.so")) {
            let x = Module.findExportByName(m.name, 'fopen');
            ...
        }
    }