Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modify Compiled .Net Exe

I have an application written in C# (without the source of course), that needs to be changed a little bit. For example, I need to stop a few lines of code that create an unnecessary menu. So I think I should comment them out.

The source code is not obfuscated. I know I can completely decompile, change, and compile again, using tools like Reflector/Reflexil. But everyone knows that by doing this, many parts of code won't compile again! Is there a way in Reflector (or any other product) that a part of could be disabled/changed without this process?

Thanks.

like image 367
Delphi.Boy Avatar asked Aug 26 '13 05:08

Delphi.Boy


2 Answers

You might want to try dnSpy. It is a .NET assembly editor, decompiler, and debugger forked from ILSpy.

https://github.com/0xd4d/dnSpy

like image 181
Milos Avatar answered Oct 10 '22 23:10

Milos


If you really needed to do this, you could decompile it with Reflector (or a similar product) and then use that to try to recreate a solution in .Net that will produce the same executable.

You may run into issues around:

  1. Obfuscated code
  2. Sections where the decompile shows you accurate code for specific sections, but for some reason it just doesn't work in your new solution (and then what do you do?)

This is not to mention the potential legal issues related to doing this. If the executable was released under a license that would permit you to do this, then you would most likely have access to the source code. So the fact that you do not have access to the source code implies that doing what you are suggesting might not be legal.

like image 40
Yaakov Ellis Avatar answered Oct 10 '22 23:10

Yaakov Ellis