对某些嵌入式代码进行逆向工程的可行性

发布于 2024-08-31 15:54:51 字数 212 浏览 6 评论 0原文

所有,

我公司的情况是我们正在使用另一个国家另一家公司的嵌入式控制系统。我们没有该系统的源代码或原理图,制造商似乎不想以任何价格或任何条款发布它们。 因此,即使是很小的修改,我们也需要 6 个月的时间才能完成,而他们基本上可以收取任何他们想要的费用。

抛开法律方面不谈,将嵌入代码逆向工程回 C 语言是否可行?有没有公​​司可以为我们做这件事?

谢谢你, 弗雷德

All,

My company is in the situation where we are using an embedded control system from another company in another country. We do not have the source code or the schematics to this system, and the manufacturer doesn't want to release them, seemingly at any price or under any terms.
We are thus stuck with a 6 month turn around to get even a small modification done, and they can basically charge any amount they want.

Legal aspects aside, would it be at all feasible to reverse engineer the embedded code back into C? Do any companies exist that could do this for us?

Thank you,
Fred

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

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

发布评论

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

评论(6

征棹 2024-09-07 15:54:51

只要您了解该系统的要求,许多公司都会重新实现嵌入式控制系统,而无需对您现在使用的系统进行逆向工程。

There are plenty of companies that will re-implement the embedded control system without reverse engineering the one you are using now, as long as you know that system's requirements.

旧瑾黎汐 2024-09-07 15:54:51

相当大的“这取决于”。

来自源的映射->目标代码(从数学上来说)是不可逆的,因此您无法恢复源代码。但是,如果您有目标代码,那么想出某种编译为相同目标代码的源代码并不那么困难,或者至少具有相同的效果 - 这只是反汇编/汇编。

不过,根据反编译过程的创造性,C 代码可能看起来很像汇编程序。因此,我会质疑我可能从第三方获得的代码的质量 - “C 代码”并不意味着“我们的 C 程序员可以轻松维护的 C 代码”,而且它可能真的很难生成后者。

另请注意,“用 C 编写”的嵌入式控制器实际上可能在其源代码中包含相当多的汇编程序。因此,要么在逆向工程版本中允许汇编程序,要么不允许。如果您不这样做,则可能无法在 C 中重现功能。如果您这样做,那么您在哪里划清界限 - 在极端情况下,您可能只是反汇编它们的源代码,而根本没有任何正确的 C 代码。您不一定能通过检查目标代码来判断哪些位是用 C 编写的,哪些不是。

当然,所有这些都暂且不考虑法律问题。抛开法律问题可能是不明智的,尤其是当您似乎将该系统作为物理对象购买时,并且您可能根本没有法律依据将代码与硬件分开。

Quite a big "it depends".

The mapping from source -> object code is (mathematically speaking) not reversible, so you can't recover the source code. But if you have the object code it's not all that hard to come up with some kind of source that compiles to the same object code, or at least which has the same effect - that's just disassembly/assembly.

Depending how creative your decompilation process is, though, the C code might come out looking a lot like assembler. So I'd question the quality of code I'd likely get back from a third-party - "C code" doesn't mean "C code that's easily maintainable by our C programmers", and it might be really quite hard to produce the latter.

Also note that an embedded controller "written in C" might actually have quite a lot of assembler in it in their source code. So either you allow assembler in your reverse-engineered version or you don't. If you don't it may be impossible to reproduce the functionality in C. If you do, then where do you draw the line - in the extreme you could just disassemble their source and not have any proper C code at all. You can't necessarily tell from examining the object code which bits were written in C and which weren't.

All this of course leaving aside the legal issues. It's probably unwise to leave aside the legal issues, especially as it seems you're buying this system as a physical object, and you possibly have no legal basis to separate the code from the hardware at all.

请爱~陌生人 2024-09-07 15:54:51

请参阅逆向工程c程序的答案

特别是,请参阅我引用“猪到香肠”的答案。如果相关汇编程序不执行您无法在 C 中声明的操作(例如“设置堆栈指针寄存器...”),该论文背后的公司可以很好地将汇编程序转换回 C。 。

[我与猪到香肠的人没有任何关系,除了见过他们并非常尊重他们的技术领先。]

See answers to reverse engineering c programs

In particular, see my answer referencing "Pigs to Sausages". The company behind that paper can do a quite good job of converting assembler back to C, if the assembler in question doesn't do things you can't state in C (such as, "Set the Stack Pointer Register...").

[I have nothing to do with the Pigs-to-Sausages guys except having met and having a great deal of respect for their technical lead.]

遇见了你 2024-09-07 15:54:51

假设您能够从系统中检索二进制代码,那么对其进行反汇编和梳理应该没有问题。实际上,将汇编代码转换为可维护的 C 代码会带来一个大问题。根据系统的大小,手动(重新)将代码写入可用的内容将花费大量时间。

据我所知,在某些国家/地区,对系统进行逆向工程以确保与您的软件的兼容性是合法的。但这可能需要洁净室逆向工程。

Assuming you are able to retrieve the binary code out of the system, disassembling and combing through it should be no problem. Actually turning the assembler code into maintainable C code poses a big problem. Depending on the size of the system, this will take a lot of time manually (re-)writing the code into something useable.

To my knowledge, in some countries, it is legal to reverse engineer a system to ensure compatibility with your software. But this may require clean-room reverse engineering.

往日情怀 2024-09-07 15:54:51

如果您正在寻找帮助逆向工程的公司,您可能需要了解一下谁在工作会议上发表文章关于逆向工程。在那里找到一些让你印象深刻的工作,然后询问那些人要雇用谁。

If you are looking for companies to help reverse engineer, you might want to sniff around who publishes in the Working Conference on Reverse Engineering. Find some work there that impresses you and ask those people whom to hire.

许一世地老天荒 2024-09-07 15:54:51

您最好在内部组建一个嵌入式团队。同时,您需要进行 4-5 次软件更改,有了合适的团队,您就可以拥有完全拥有的硬件和软件设计,以及可以快速实施更改的内部专业知识。

...更不用说如果产品有相当大的销量,您可以在加价上节省大量资金。

You might be better off starting an embedded team in house. In the same time it'd take you to do 4-5 software changes, with the right team you could have fully owned hardware and software designs, plus in-house expertise that can implement changes quickly.

... not to mention the amount of money you'd save on markup if the product has any considerable volume.

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