.Net Core 3自包含的单个可执行文件可以反编译吗? [英] Can .Net Core 3 self-contained single executable be decompiled?

查看:1595
本文介绍了.Net Core 3自包含的单个可执行文件可以反编译吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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


我是否需要对.Net Core 3的分布式二进制文件



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



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


I tried using Dotpeek and ILSpy.Net to decompile (my own code), they failed.

Do I need special obfuscation on distributed binaries of .Net Core 3 self-contained single executable ?

<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>

解决方案

The single-file exe is really an unmanaged wrapper and ILSpy doesn't support decompiling this. But when you run the exe, it unwraps its contents to a temp folder. So you can find the managed dll there and decompile it using ILSpy.

To find the temp folder, you can use any tool that shows locations of assemblies loaded by a process. SysInternals Process Monitor (procmon) is a good one.

You can setup procmon to filter by your exe name, and when you launch your exe, procmon should show some events for assemblies being loaded from a temp folder:

You can browse to that folder and find your managed dll there. And you can decompile using ILSpy from that location.

I wrote a blog entry: https://eersonmez.blogspot.com/2020/02/ilspy-decompiling-net-core-self.html

这篇关于.Net Core 3自包含的单个可执行文件可以反编译吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆