更改已编译二进制文件的部分内容

发布于 2024-10-18 10:36:51 字数 355 浏览 3 评论 0原文

作为第二语言学习英语,对于错误和错误表示歉意。尴尬

我已经给出了一个特殊的项目来进行。该公司丢失了该应用程序的源代码,我必须对其进行更改。现在,对整个事情进行逆向工程对一个人来说是不可能的,它太大了,但是修补单个功能是可行的,因为变化并不是那么巨大。

因此,一种可能的解决方案是编译 C 代码,并以某种方式(在重写地址之后)将其修补到实际的二进制文件中,理想情况下,替换 CALL 指令跳转到的代码,或者将 JMP 插入到我的代码中。

有什么方法可以使用 MingW32 来完成此任务吗?如果是的话,您能提供一个简单的例子吗?我也对可以帮助我完成任务的书籍感兴趣。

感谢您的帮助

learned english as a second lang, sorry for the mistakes & awkwardness

I have given a peculiar project to work on. The company has lost the source code for the app, and I have to make changes to it. Now, reverse engineering the whole thing is impossible for one man, its just too huge, however patching individual functions would be feasible, since the changes are not that monumental.

So, one possible solution would be compiling C code and somehow -after rewriting addresses- patching it into the actual binary, ideally, replacing the code the CALL instruction jumps to, or inserting a JMP to my code.

Is there any way to accomplish this using MingW32? If it is, can you provide a simple example? I'm also interested in books which could help me accomplishing the task.

Thanks for your help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

七婞 2024-10-25 10:36:51

我使用 OllyDBG 来处理这类事情。它允许您查看反汇编并调试它,您可以放置​​断点等,还可以编辑二进制文件。因此,您可以编辑该程序的 PE 标头,添加一个代码部分,其中包含您的(已编译的)代码,然后从原始程序中调用它。
我无法给你任何建议,因为我从未尝试过,尽管我想过很多次。你知道,懒惰..:)

I use OllyDBG for this kind of things. It allows you to see the disassembly and debug it, you can place breakpoints etc, and you can also edit the binary. So, you could edit the PE header of that program adding a code section with your (compiled) code inside, then call it from the original program.
I can't give you any advice since I've never tried, although I thought about it many times. You know, lazyness.. :)

怕倦 2024-10-25 10:36:51

我会使用高质量的反汇编器反汇编该程序,该反汇编器会生成可以重新组装成可运行应用程序的内容,然后用 C 代码替换需要修改的部分。

I would disassemble the program with a high-quality disassembler that produces something that can be assembled back into a runnable app, and then replace the parts you need to modify with C code.

慵挽 2024-10-25 10:36:51

像这样的东西可以让你将机器代码反转为源代码。它不会很漂亮,但确实有效。

http://www.hex-rays.com/idapro/

还有运行时的工具例如,修补 http://www.dyninst.org/ 。它们确实不是为修补而设计的,但它们可以解决问题。

当然,最后的选择是只使用汇编器并编写机器代码:)

Something like this will let you reverse the machine code into source. It won't be pretty but it does work.

http://www.hex-rays.com/idapro/

There are also tools for runtime patching http://www.dyninst.org/ for instance. They really aren't made for patching but they can do the trick.

And of course the last choice is to just use an assembler and write machine code :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文