将 C 代码注入 *nix 应用程序:替换函数
我有一个新手但对我来说非常重要的问题:我有一个使用 Carbon api 的 Mac Os X 应用程序,但它仍然是一个 C++ 应用程序。我需要调试在执行时调用哪些函数,然后制作一个 C++ 补丁来替换其中一个函数。
真正的目标:我需要将打印到应用程序在无法访问的碳视图中的聊天窗口中打印的所有文本记录下来。我一开始以为是cocoa应用,其实不是,所以fscript和imlib不好注入代码。
是否可以?有什么线索吗?非常感谢。
干杯:)
I have a newbie but really important question for me: I have a Mac Os X application that uses carbon api, but it is still a C++ application. I need to debug which functions are called at execution time and then make a C++ patch to replace one of those functions.
The real goal: I need to log all text printed into a chat window that the application has inside an unnacessible carbon view. I thought at first it was a cocoa application, but it's not, so fscript and imlib are no good to inject code.
Is it possible? Any clues? Thank you very much.
Cheers :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以考虑使用 truss 来确定正在进行哪些系统调用,但我不确定用户调用。
LD_PRELOAD
环境变量可以允许您将方法注入其他应用程序,但 C++ 方法往往在名称修改和调用方法方面具有各种依赖性,因此插入您自己的方法可能会很棘手。您可以让应用程序维护人员添加实际的挂钩来满足您的需要吗?
You could look into using
truss
to figure out what system calls are being made but I'm not sure for user-calls. TheLD_PRELOAD
environment variable can allow you to inject methods into other apps, but C++ methods tend to have various dependencies regarding name mangling and calling method so it would probably be tricky to plug in your own.Can you just have the app maintainer add actual hooks to allow for what you need?