Skip to content

Instantly share code, notes, and snippets.

@DiegoCaridei
Created January 20, 2023 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DiegoCaridei/9c21502563f48b062509de284aee8b0d to your computer and use it in GitHub Desktop.
Save DiegoCaridei/9c21502563f48b062509de284aee8b0d to your computer and use it in GitHub Desktop.
Frida demo
var bin = Process.enumerateModulesSync()[0]
Module.enumerateSymbolsSync(bin.name)
Interceptor.attach(ptr(0x10368deb0),{
onEnter(args){
console.log("The function add is invoke")
console.log("Arg 0", args[0].toInt32())
console.log("Arg 1", args[1].toInt32())
}
})
Interceptor.attach(ptr(0x10c0bceb0),{
onEnter(args){
console.log("The function add is invoke")
console.log("Arg 0", args[0].toInt32())
console.log("Arg 1", args[1].toInt32())
},
onLeave(retval){
return retval.replace(10)
}
})
var add = Module.findExportByName(null, 'add');
Interceptor.replace(add, new NativeCallback(function (arg1,arg2) {
console.log(arg1,arg2)
return arg1 * arg2;
}, 'int', ['int', 'int']));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment