Decompiling code (language independent) [closed]

允我心安 提交于 2019-12-05 07:51:23

If it's a managed DLL (.NET), you can open it using tools such as Reflector or ILDASM and you'll see the IL code. (Edit 2017-02-03: In 7+ years, .NET disassemblers have of course progressed a lot and are now able to produce very decent C# code)

If it's an unmanaged DLL (native), you're out of luck. The best you can do is load a disassembler. Which leads you nearly nowhere unless you know exactly where you want to go.

You're interested in decompiling assemblies. Well here's a start on decompiling .NET assemblies: http://aspnet.4guysfromrolla.com/articles/080404-1.aspx

A popular tool in the .NET community for decompiling assemblies is .NET Reflector

It's not possible(1) to decompile object code to source code. Inspecting an interface is another matter altogether; there are tools that exist but I don't know of any offhand.

(1) - well, OK, it is possible for some languages and under certain conditions but the code produced won't exactly be readable...

The only readable code you'll get is assembly language (there are many programs for this). There are some languages that can be decompiled to original (or close to) source code, such as Visual Basic 3. But who writes programs in VB3 nowadays? Nobody. As far as seeing the imports/exports of the DLL, you can use the Dependency walker program from: http://www.dependencywalker.com/

For some languages, for example Visual Basic or C#, you can get readable source-code if you use a good decompiler and the code is not obfuscated (which it most of the time isn't)

Check this site if you're interested in decompiling: http://www.program-transformation.org/Transform/DecompilationPossible

For .Net, .NET Reflector is the way to go. It will decompile your dll into either C# or VB.NET http://www.aisto.com/roeder/dotnet/

For .NET, Reflector will do this; the "Pro" version (now in preview) has a plugin for Visual Studio that lets you debug into most managed code within the VS IDE itself, rather than being a separate tool. So far, it is looking very sweet.

Reflector EAP http://www.simple-talk.com/community/blogs/alex/attachment/74919.ashx

They are different formats.

For a .NET dll, you can use ildasm.exe (installed with .net framework) or .NET Reflector (download)

There was enough said about decompiling .NET. If you ever decide to start with reverse-engineering native binaries, I recommend to use IDA.

It supports different OSs, processor architectures, detects and shows standard libraries usage (so you can easily find places of interest), shows graphs of dependencies between subroutines, shows procedures arguments at stack etc. It also can be scripted and there're scripts that detect C++ classes and try-catch blocks, finds COM interfaces names for UUIDs and do many other things. It's a great tool and there's free version of it.

To decompile a .Net DLL, you can use .Net Reflector. It will work for DLLs written in any .Net language.

To decompile a Java JAR file, try Java Decompiler.

Decompiling native code (C++) is much more difficult.

Unless you're in .NET land, what's in a DLL is binary code. The only language you can see this in is assembler - which is just a mnemonic way of presenting machine language.

Irrespective of a .Net language you use - everything will be compiled to MSIL (Microsoft intermediate language). You can use tools like Ildasm to convert it to readable "disassembled text":

http://msdn.microsoft.com/en-us/library/f7dy01k1.aspx

You can also use Reflector: http://www.builderau.com.au/program/asp/soa/Look-inside-NET-DLL-files-with-Reflector/0,339028371,339287377,00.htm

to examine classes and methods (it supports different .Net languages)

For native DLL's this program, Hex-Rays Decompiler (a layer on top of the excellent IDAPro disassembler-debugger) is probably as close as you can get. It doesn't restore the original code but converts the disassembly in a C-like pseudocode. It's not cheap though.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!