![]() |
Modifying/replacing class in .NET binary
I have a .NET binary (.NET only, no native code). Short of decompiling the entire binary, changing it and recompiling it (not really an option for my particular target), is there a way to take the decompiled code for the one class I am interested in, modify it and either A.Stick it back in the original binary somehow or B.Stick it into a dll file and make the binary use the dll instead of the original code?
Or any other way to modify the code? |
You should be able to directly replace or modify the decompiled class with dnSpy rather seamlessly, depending on how drastic the changes are:
Code:
https://github.com/0xd4d/dnSpy/releases |
Also you can export project from dnspy and load it in VS.
|
Projects like dnlib, Mono.Cecil, and Harmony are usable for things like this:
https://github.com/0xd4d/dnlib https://github.com/jbevain/cecil https://github.com/pardeike/Harmony |
also net reflector with reflexil 2.3 plugin
|
Quote:
This might be in IL, but it is not too complicated to learn (for small patches it is usually ok) I wonder if new versions are able to change in .net directly (thus builing the IL code automatically. Last time i tried, dnSpy had some issues with this and changing the IL code directly was the way to go... |
also, in some cases, the name of patched file have to be same as original one
|
Quote:
author is responsive and is interested in in keeping his great product up to date and bugless |
For small binary files, you can dump the file with dnSpy, load it with Visual Studio, patch then rebuild.
|
Why VS? Can patch directly in dnspy.
|
| All times are GMT +8. The time now is 10:37. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX