views:

170

answers:

5

Is it possible to decompile a .NET 2.0 binary file (*.exe) to some sort of readable code? Or if not, just extract some information from it (for example method names, debugging information, etc.)?

+14  A: 

You might want to look at Reflector, it should show you the assembly as C# or IL.

dsolimano
Reflector is the best tool I've ever used for Reversing :))
Filip Ekberg
Works like a charm, thank you :).
pako
Reflector also works well for converting code, say from VB.NET to C#.
Cory Charlton
Yeah there is a nice "dissassembly"-plugin that exports complete libraries to cs-files.
Filip Ekberg
+3  A: 

Dropping the exe into ILDASM or Dot Net Reflector should do the trick.

rotti2
+1  A: 

Search for Lutz Roeder and you'll find :

http://www.red-gate.com/products/reflector/

Stephan Leclercq
A: 

Yes. First all .net libraries have manifests with type information it them. They can be interrogated problematically using reflection, or by using tools like reflector. Take a look at the system.reflection namespace for the classes you will need to take a look at.

rerun
+1  A: 

I will Quote myself from this question earlier today:

You can never get back to the exact same source since there is no meta-data about that saved with the compiled code.

But you can re-create code out from the assembly-code.

Check out this book if you are interested in these things: Reversing: Secrets of Reverse Engineering.

Edit

Some compilers-101 here, if you were to define a compiler with another word and not as technical as "compiler", what would it be?

Answer: Translator

A compiler translates the syntax / phrases you have written into another language a C compiler translates to Assembly or even Machine-code. C# Code is translated to IL and so forth.

The executable you have is just a translation of your original text / syntax and if you want to "reverse it" hence "translate it back" you will most likely not get the same structure as you had at the start.

A more real life example would be if you Translate from English to German and the from German back to English, the sentance structure will most likely be different, other words might be used but the meaning, the context, will most likely not have changed.

The same goes for a compiler / translator if you go from C to ASM, the logic is the same, it's just a different way of reading it ( and of course its optimized ).

Regarding C#, you have already been given a lot of great tools like Reflector. However, if the Code is obfuscated you are going to have problems reading it.

Filip Ekberg