.Net Core 3 自包含的单个可执行文件可以反编译吗?

Abh*_*eet 2 obfuscation decompiling ilspy .net-core

我尝试使用 Dotpeek 和 ILSpy.Net 反编译(我自己的代码),但失败了。

我需要对 .Net Core 3自包含单个可执行文件的分布式二进制文件进行特殊混淆吗?

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <PublishTrimmed>true</PublishTrimmed>
    <PublishReadyToRun>true</PublishReadyToRun>
    <PublishSingleFile>true</PublishSingleFile>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
  </PropertyGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)

Ere*_*mez 5

单文件 exe 实际上是一个非托管包装器,ILSpy 不支持反编译它。但是当您运行 exe 时,它​​会将其内容解包到一个临时文件夹中。所以你可以在那里找到托管的 dll 并使用 ILSpy 反编译它。

要查找临时文件夹,您可以使用任何显示进程加载的程序集位置的工具。SysInternals Process Monitor ( procmon ) 是一个很好的工具。

您可以设置 procmon 以按您的 exe 名称进行过滤,并且当您启动您的 exe 时,procmon 应显示从临时文件夹加载的程序集的一些事件:

截屏

您可以浏览到该文件夹​​并在那里找到您的托管 dll。您可以从该位置使用 ILSpy 进行反编译。

我写了一篇博文:https : //eersonmez.blogspot.com/2020/02/ilspy-decompiling-net-core-self.html