简体   繁体   中英

Obfuscator for .NET Core Single Publish Files

Is there an obfuscation tool that can work well on the exe and pdb files that result from a dotnet core single file publish?

I am using dotnet core single file publish with the command: dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true . This works great in giving me just two neat files an exe and a pdb file, which I am able to give to a client to run my application.

However, I am still concerned about its ability to be decompiled.

I tried using ILSpy and JustCompile on both the files and they luckily could not be decompiled with these tools. Is it then that my files are safe, or it is that the tools have not yet caught up?

If the latter, what obfuscation tool can I use to protect these files? I attempted to use Obfuscar which did not work specifically on the single file publish outputs, the exe and pdb .

Any suggestions on the obfuscation tools to use for this?

Disclosure: I work for the Dotfuscator team at PreEmptive.

We have tested and verified that Dotfuscator Professional handles this scenario on both .NET Core 3 and .NET 5. Specifically, you must use Dotfuscator Professional's MSBuild integration, which is now our recommended method of using Dotfuscator Professional for new projects . However, Dotfuscator will not update .pdb files on .NET Core or .NET 5, so you will not be able to debug builds which use Dotfuscator (eg, Release builds). You should not ship .pdb files to untrusted users.

You can decompile .NET Core self-contained executables if you manually unpack them: Can.Net Core 3 self-contained single executable be decompiled?

You would have to run the obfuscator as part of the build process, before the individual assemblies are compressed into the single file. That's probably possible if you add a custom MSBuild target that executes the obfuscator, and use the BeforeTargets attribute to integrate it at the correct point in the build process. But I haven't looked at the .NET core build system in detail.

You can use Obfuscar.
Use it in obj directory after target Compile and then copy obfuscated files to directory.(replace with original files)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM