C#怎样防止反编译?
我使用的方法是利用加壳工具:virbox?Protector?Standalone。直接进行加壳。高级混淆、虚拟化代码、智能压缩等加密策略。如果要授权控制,可使用许可版本的virbox?Protector。
未经加壳保护的 ILspy 反编译效果如下:
public int add(int a, int b){
return a + b;}public int div(int a, int b){
return a / b;}public int mul(int a, int b){
return a * b;}public int sub(int a, int b){
return a - b;}
解决方案:
深思自主研发了为 C# .net 语言做保护的外壳(Virbox Protector)。将C# .net 编译成的执行程序(.exe),动态库(.dll)直接拖入加壳工具即可完成保护操作,十分方便。并且在效果上已经完全看不到源码中的逻辑。
加密后的效果
public int add(int a, int b){
return (int)dm.dynamic_method((object)this, System.Reflection.MethodBase.GetCurrentMethod(), 16416u, 21, 16384u, 32u, 31516u, 5).Invoke(this, new object[]
{
this,
a,
b
});}
public int div(int a, int b){
return (int)dm.dynamic_method((object)this, System.Reflection.MethodBase.GetCurrentMethod(), 16956u, 21, 16924u, 32u, 31516u, 2).Invoke(this, new object[]
{
this,
a,
b
});}
public int mul(int a, int b){
return (int)dm.dynamic_method((object)this, System.Reflection.MethodBase.GetCurrentMethod(), 16776u, 21, 16744u, 32u, 31516u, 3).Invoke(this, new object[]
{
this,
a,
b
});}
public int sub(int a, int b){
return (int)dm.dynamic_method((object)this, System.Reflection.MethodBase.GetCurrentMethod(), 16596u, 21, 16564u, 32u, 31516u, 4).Invoke(this, new object[]
{
this,
a,
b
});}
架构支持
IIS 服务架构的后台逻辑 DLL 文件
windows PC 应用程序 EXE 文件
windows PC 应用程序动态库 DLL 文件
UG等第三方绘图工具使用的 DLL 文件
Unity3d 编译使用的 DLL 文件