gpt4 book ai didi

ios - 在 frida-trace onEnter 中停止函数调用

转载 作者:行者123 更新时间:2023-12-03 18:33:39 26 4
gpt4 key购买 nike

我正在玩弄 frida,特别是 iOS 上的 frida-trace

当一个方法被 Hook 并且我可以在 onEnter 中记录参数时,有没有办法让这个函数调用提前结束而不调用原始方法?

我已经尝试将 return; 添加到 onEnter 方法,但是 onLeave 仍然会被调用,并且会调用其间的方法。

最佳答案

我有同样的问题,所以在 Github 上提问,这是 oleavr 的回答:

No, that would require Interceptor to know the function's calling convention and signature, e.g. for stdcall. Use Interceptor.replace() instead.

要了解有关 Interceptor.replace() 的更多信息,您可以查找 official documentation ,但正如其名称所说,您可以用自己的实现替换原始函数:

var openPtr = Module.findExportByName("libc.so", "open");
var open = new NativeFunction(openPtr, 'int', ['pointer', 'int']);
Interceptor.replace(openPtr, new NativeCallback(function (pathPtr, flags) {
var path = Memory.readUtf8String(pathPtr);
log("Opening '" + path + "'");
var fd = open(pathPtr, flags);
log("Got fd: " + fd);
return fd;
}, 'int', ['pointer', 'int']));

(文档中的示例。)

关于ios - 在 frida-trace onEnter 中停止函数调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39816238/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com