为什么我们可以轻松反编译.NET程序集?
为什么我们可以轻松反编译.NET程序集?
我们可以轻松反编译.NET EXE 文件的主要原因是什么?
我可以使用很多软件来混淆我的应用程序代码,但为什么需要混淆以进行保护?微软就不能让基本都很难知道吗?主要原因可能是.NET 代码应该变成IL 代码吗?这是真的吗?
Why can we decompile .NET assemblies easily?
What's the main reason we can decompile .NET EXE files easily?
There are much software that I can use to obfuscate my application code, but why does it need to obfuscate for protection? Couldn't Microsoft make it difficult to know basically? May the main reason be that .NET code should turn into IL code? Is this true?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
IL 代码(.NET 程序集包含的内容)是比 CPU 程序集(x86、ARM)更高级(虚拟)机器语言(并且更简单 - 仅基于堆栈,没有寄存器等,就像 CPU 中的那样)等),这是低级得多且不容易(因为有各种寄存器等)。
因此,当 C# 编译器编译为 IL 代码时,构造(猜测)原始 C# 代码要容易得多。
IL code (which is what .NET assemblies contains) is a higher level (virtual) machine language (and much more simpler - stack based only, no registers, etc. as you have in a CPU) than the CPU assembly (x86, ARM, etc.) which is much more low level and not easy (as there are various registers, etc.).
So when the C# compiler compiles to IL code, it is much easier to construct (guess) the original C# code.
微软为什么不这么做呢?因为您无法保护您的代码免受坚定的黑客的攻击。就像最大的软件提供商一样,他们不会制作这样的内置东西,但他们让您拥有一个工具市场,您可以根据自己的需求和口袋大小选择最合适的工具。
Why didn't Microsoft do it? Because you can not protect your code against a determined hacker. Like the biggest software provider, they don't make built-in something like this, but they let you have a market of tools where you can choose the most apropriate tool for you based on your needs and pocket size.
当您使用 DotPeek 或 Reflector 打开 .NET DLL 时,您正在将 IL 转换回您选择的语言的代码。可视化这一点很重要,因为它不会返回与编写的完全相同的代码,而只会返回会生成相同 IL 的代码。
When you open up a .NET DLL with DotPeek or Reflector you are converting IL back into code in the language of your choice. It is important to visualise this as it won't give you back exactly the same code that was written, just code that would produce the same IL.