如何反编译 .dll 文件?
我有一个 .dll 我想反编译以对代码进行一些改进。有哪些工具可以让我做到这一点?
我相信它是用VB编写的。
I have a .dll I would like to decompile to make some improvements to the code. What are some tools out there that will allow me to do this?
It's written in VB, I believe.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
答案取决于 DLL 是用什么语言编写的。
如果它是 .NET 语言,那么正如所指出的,您可以使用 .NET Reflector。
如果它是较旧的 Visual Basic(.NET 之前),则 DLL 会编译为所谓的 p 代码,并且有一些 用于反编译的一些变体的选项。
最后,如果是用C++这样的语言编写的,则没有直接的方法来获取源代码。这样的DLL被编译为机器语言,只能直接反编译为汇编语言。
因此,这又取决于所使用的语言。答案可能是不可能获得任何类似于原始源代码的东西。
The answer depends on what language the DLL was written in.
If it was a .NET language then, as pointed out, you can use .NET Reflector.
If it's the older Visual Basic (pre-.NET), then the DLL is compiled as what's called p-code and there are a few options for doing some variations on decompiling.
Finally, if it's written in a language like C++, there is no direct way to obtain the source code. Such a DLL is compiled to machine language and can only be directly decompiled to assembly language.
So, again, it depends on the language used. And the answer might be that it's just not possible to get anything resembling the original source code.
JetBrain 的 dotPeek 号称免费 .NET 反编译器和程序集浏览器,非常适合我:快速、简单且易于使用当然最重要的是,免费!
JetBrain's dotPeek billed as the Free .NET Decompiler and Assembly Browser worked great for me: quick, easy, and of course best of all, free!
.NET 反射器!!!
http://www.red-gate.com/products/dotnet-development/ Reflector/
它甚至是免费的,你不需要专业版就能看到反汇编代码。
.NET Reflector!!!
http://www.red-gate.com/products/dotnet-development/reflector/
It is even free, you won't need the pro version to see the dissassembled code.
市场上有很多付费工具。但我使用免费工具,不仅可以看到反汇编代码,而且还可以调试代码。
例如,假设有一个在 .Net 中开发的 exe,我可以使用名为 DnSpy 的工具来调试该编译代码。
http://xyzcoder. github.io/dll_decompiling/decompiled_dll_debugging/dnspy/2018/06/07/dnSpy-For-DeCompiling,Debugging.html
There are many paid tools out there in the market. But I use a free tool and not only just seeing disassembled code, but I am also able to debug the code.
For example, let's say there is an exe that was developed in .Net, I am able to debug that compile code using this tool known as DnSpy.
http://xyzcoder.github.io/dll_decompiling/decompiled_dll_debugging/dnspy/2018/06/07/dnSpy-For-DeCompiling,Debugging.html
由于这是一个较老的问题,并且自问以来发生了很多事情,我想我会添加几个反编译器的链接,这可能对其他寻找解决方案的人有用。
ILSpy
https://github.com/icsharpcode/ILSpy/releases
完全免费根据当前的 Git README.md:
反编译器前端
除了 WPF UI ILSpy(可通过版本下载,另请参阅插件)之外,还可以使用以下其他前端:
功能
泰勒里克
https://www.telerik.com
这是免费/试用/付费版本,支持多种语言。
Since this is an older question and a lot has happened since asked I figure I would add a couple links to decompilers out there that may be of use to others looking for a solution.
ILSpy
https://github.com/icsharpcode/ILSpy/releases
Completely Free & according to Git README.md as of current:
Decompiler Frontends
Aside from the WPF UI ILSpy (downloadable via Releases, see also plugins), the following other frontends are available:
Features
Telerik
https://www.telerik.com
This one is Free/Trail/Paid Versions with multiple language support.
我尝试了 JetBrains 的 DotPeek,但结果不够充分,(“引用编译器生成的字段”存在一些问题),然后我再次尝试 .NET Reflector 11.1,结果稍好一些,但仍然与 DotPeek 的效率差不多。最后我尝试了Telerik 的 JustDecompile,获得了总体最佳结果。
我推荐Telerik JustDecompile,如果您正在寻找一个好的反编译器,它可以保存项目文件。
它也是开源!
I tried the JetBrains's DotPeek but the result wasn't sufficient enough, (there were some issues with "reference to a compiler-generated field") then I gave a next try to .NET Reflector 11.1 with a little bit better result, but still almost as DotPeek's efficiency. Last I tried Telerik's JustDecompile, with the overall best result.
I recommend the Telerik JustDecompile, if your're looking for a good decompiler, which can save a project file.
It is also open source!
如果它是用“经典”Visual Basic 编写的并且未编译为 p 代码,则您将需要一个反编译器。
我不知道特定于 VB 的反编译器,但有 Ghidra,它将本机代码反编译为 C。Ghidra 于 2019 年向公众开放,距离这个问题最初发布很久之后。
If it's written in 'classic' Visual Basic and not compiled to p-code, you will need a decompiler.
I'm not aware of a VB-specific decompiler, but there is Ghidra, which will decompile native code to C. Ghidra was made available to the public in 2019, long after this question was originally posted.