Skip to content

Instantly share code, notes, and snippets.

@SimonTheCoder
Last active August 29, 2020 09:24
Show Gist options
  • Save SimonTheCoder/f1966143d395fe06ac61c5efcf815fcb to your computer and use it in GitHub Desktop.
Save SimonTheCoder/f1966143d395fe06ac61c5efcf815fcb to your computer and use it in GitHub Desktop.
Trace libc open function using Frida.
var target_fn = "open"
//target module can be set to null, but it will cause lower speed.
var target_module = "libc.so"
var callback_obj =
{
onEnter: function (args) {
var path = Memory.readUtf8String(args[0]);
path = path.replace("\n","");
console.log("Path:" + path + "\t\t Flag:"+args[1])
},
onLeave: function (retval) {
}
}
{
var target_addr = Module.findExportByName(target_module,target_fn);
Interceptor.attach(target_addr, callback_obj);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment