如何使用ConfuserEx 1.6.0+447341964f对.NET10版本的WPF进行混淆加壳保护
本文使用的是ConfuserEx 1.6.0+447341964f GUI版本
https://pan.baidu.com/s/15KT60te8J_YI8bvtxQBhbQ 提取码: wk79
开源版本:https://pan.baidu.com/s/15qqf-82rU1fCpo4vumOjMQ 提取码: k55g
处理过程
1.先用VS2026自带混淆工具进行混淆,按照如下顺序先设置“Protect Using Obfuscar”,在设置具体混淆内容,后续每次生成Debug时都会自动应用。


2.在GUI中设置目录和具体文件

Base Directory设置到程序主目录,如bin\x64\Debug\net10.0-windows
点上图中的+浏览具体文件,可以是exe,也可以是dll
3.指定ConfuserEx 搜索依赖项的目录(否则Protect处理过程中会提示找不到dll等错误)
[INFO] Confuser.Core 1.6.0+447341964f Copyright © 2014 Ki, 2018 - 2022 Martin Karing
[INFO] Running on Microsoft Windows NT 6.2.9200.0, .NET Framework v4.0.30319.42000, 64 bits
[DEBUG] Discovering plugins...
[INFO] Discovered 13 protections, 1 packers.
[DEBUG] Resolving component dependency...
[INFO] Loading input modules...
[INFO] Loading 'xxx.dll'...
[INFO] Initializing...
[DEBUG] Building pipeline...
[DEBUG] Executing 'Type scanner' phase...
[INFO] Resolving dependencies...
[ERROR] Failed to resolve dependency of 'xxx.dll'.
Exception: dnlib.DotNet.AssemblyResolveException: Could not resolve assembly: System.Drawing.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
在 dnlib.DotNet.Extensions.ResolveThrow(IAssemblyResolver self, IAssembly assembly, ModuleDef sourceModule)
在 Confuser.Core.ConfuserEngine.Inspection(ConfuserContext context)
Failed at 10:19, 0:00 elapsed.
点击上图右下角的设置图标,设置依赖路径

由于显示问题,上述dotnet路径无法全部展示,请参考后面的工程文件内容
3.设置保护内容

在软件的Settings标签点击编辑,设置如下内容(注意,由于在保护前已经混淆过了,有些rename等保护内容不要选,否则程序执行会报错)

4. Protect!
在Protect!标签页点击Protect按钮,很快就能在同目录下(如bin\x64\Debug\net10.0-windows\Confused)看到保护后的文件
5.替换并测试
由于有些混淆和保护过程,可能破坏原有的参数或函数名,替换文件后要进行软件功能的多方面测试。
项目文件内容:
<project outputDir="D:\xxx\bin\x64\Debug\net10.0-windows\Confused" baseDir="D:\xxx\bin\x64\Debug\net10.0-windows" xmlns="http://confuser.codeplex.com"> <module path="xxx.dll"> <rule pattern="true" inherit="false"> <protection id="anti debug" /> <protection id="anti dump" /> <protection id="anti ildasm" /> <protection id="anti tamper" /> </rule> </module> <probePath>C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\10.0.12</probePath> <probePath>C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\10.0.8</probePath> <probePath>C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App</probePath> <probePath>C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\10.0.12</probePath> <probePath>C:\Program Files\dotnet\shared\Microsoft.NETCore.App\10.0.12</probePath> <probePath>C:\Program Files\dotnet\shared\Microsoft.NETCore.App\10.0.8</probePath> </project>

浙公网安备 33010602011771号