As we have just discussed, it is very easy to get the source
code out of the .NET assemblies. The process is known as De-Compilation.
Microsoft is providing a native de-compiler known as ILDASM (IL Disassembler).
This ILDASM can convert the entire assembly to the understandable instructions
and then it is not a far reach to get the source codes back. Let us have a look
at how we can do this.
Go to the Visual Studio .NET Command prompt as shown below.
Figure 1
Enter ILDASM at
prompt.
Then the ILDASM window will come up. Here you can browse
your dll or exe. After which, you will get the complete set of instructions for
your assembly.
In this case I have used a Vb.net exe (mfsapp.exe) and got
the result as shown in the image below.
Figure 2
The above image shows an example of runtime ILDASM. It also
explains the meaning of the symbols used in the process. Double clicking any
item gives the set of instructions that will be executed. For example, here we
have double clicked on the Method doDBconnection () and received the following.
Figure 3
Once this structure is obtained, the source code is not far
away. One can easily decode these instructions into the source code by using
the code charts given at the location [Drive name]:\Program Files\Microsoft
Visual Studio .NET\FrameworkSDK\Tool Developers Guide\docs\Partition III
CIL.doc.
The Microsoft itself gives this DOC file. It contains the meanings
of all the instructions from the above process. So, now the source code is
almost in your hand exposing the whole logic behind the dll/exe.