SingleFileExtractor
1.0.0
一种用于将内容(程序集、配置等)从单文件应用程序提取到目录的工具,适用于恶意软件分析等目的。
要使用此工具,请将其安装为全局 dotnet 工具:
dotnet tool install -g sfextract
sfextract [file] -o|--output [directory]
提取文件
sfextract Application.exe -o path/to/output/
列出文件
省略输出目录将列出单个文件可执行文件中的所有文件。
sfextract Application.exe
安装SingleFileExtractor.Core
NuGet 包以编程方式使用它:
var reader = new ExecutableReader("application.exe");
当你想知道入口点程序集是什么时,你可以阅读启动信息
var reader = new ExecutableReader("application.exe");varstartupInfo = reader.StartupInfo;
var reader = new ExecutableReader("application.exe");// 验证可执行文件是否是单个文件可执行文件,并且可以提取var isSingleFile = reader.IsSingleFile;if (isSingleFile){// 提取特定文件条目await reader.Manifest.Entries [0].ExtractToFileAsync("example.dll");// ,或者创建特定文件的内存流entryvar stream = wait reader.Manifest.Entries[0].AsStreamAsync()// 将所有文件提取到目录等待 reader.ExtractToDirectoryAsync("path/to/output");}
var reader = new ExecutableReader("application.exe");await reader.Manifest.Entries[0].ExtractToFileAsync("example.dll");
var reader = new ExecutableReader("application.exe");var stream = wait reader.Manifest.Entries[0].AsStreamAsync()
我正在开发的另一个应用程序要求我提取单个文件的内容。由于我也看到有人询问如何做到这一点,所以我决定将其变成 dotnet 工具和 NuGet 包。
GitHub:用于发明单文件应用程序的 dotnet/runtime。
MIT License Copyright (c) 2021 Joery Droppers (https://github.com/Droppers) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.