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()// 將所有檔案擷取到一個Directoryawait reader.ExtractToDirectoryAsync(“路徑/到/輸出”);}
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.