volexity/GoResolver

GitHub: volexity/GoResolver

GoResolver 是一款利用符号提取与控制流图相似性算法,帮助安全研究人员还原混淆 Go 二进制文件函数符号的逆向工程辅助工具。

Stars: 110 | Forks: 9

# GoResolver GoResolver 是一个 Go 分析工具,利用 Go 符号提取和控制流图 (CFG) 相似性来识别和解析混淆 Go 二进制文件的函数符号。 该工具支持三大主要操作系统:Windows、MacOS 和 Linux,以及它们各自的可执行文件格式 PE、ELF 和 Mach-O,适用于 X86、AMD64、ARM 和 ARM64 架构。 ## 如何安装 要安装 GoResolver,我们建议直接从 PyPi 获取: ``` pip install goresolver ``` 这将安装 GoResolver 及其必要的依赖项。 由于 GoResolver 在其相似性分析中可能需要不同的 Go 版本,您还需要安装基础 Go 版本(1.20.6 或更高版本)作为依赖。 请访问 https://go.dev/dl/ 为您的设备安装正确的 Go 版本。 ### 从源码构建 如果您希望从源码构建并安装 GoResolver,请按照以下步骤操作: #### 依赖项: 您需要安装基础 Go 版本(1.20.6 或更高版本)。请访问 https://go.dev/dl/ 为您的设备安装正确的 Go 版本。 #### 构建过程: 要从源码构建 GoResolver,请使用 Hatch 的常规构建命令: ``` hatch build ``` 构建的归档文件将作为 .whl 文件放置在 "dist" 目录中。 要安装 GoResolver,只需使用 pip 安装该 .whl 文件。 ``` pip install dist/goresolver-*.whl ``` ## 命令行用法 安装完成后,将提供一个新的实用程序 `goresolver`。可以使用以下两个命令: ### Resolve - 分析 Go 二进制文件并检索符号 ``` usage: goresolver resolve [-h] [-l [LIBS ...]] [-v VERSION] [-f] [-r COMPARE_REPORT] [-b BACKUP_PATH] [-o OUTPUT] [-t THRESHOLD] [-x] [-g] [-y] sample_path [reference_path] positional arguments: sample_path Path to the GO sample to analyze. reference_path Path to the GO reference sample to compare to (if any). options: -h, --help show this help message and exit -l, --libs [LIBS ...] List of GO libs to include in the generated samples. -v, --go-version VERSION The GO version to build the reference samples with. -f, --force Force build existing samples. -r, --compare-report COMPARE_REPORT Path to an already generated GoGrapher report. -b, --backup-path BACKUP_PATH Path where to save the intermediary GoGrapher report. -o, --output OUTPUT Path of the output JSON report. -t, --threshold THRESHOLD Value at which matches are considered significant. -x, --extract Extract symbols from the Go sample. -g, --graph Compare the Go sample against generated references. -y, --types Parse runtime types from the Go sample. ``` ### Manage - 管理已安装的 Go 版本 ``` usage: goresolver manage [-h] (--list_available | --list_installed | -i VERSIONS | -u VERSIONS) options: -h, --help show this help message and exit --list_available List the GO versions available to install. --list_installed List the currently installed GO versions. -i, --install VERSIONS The list of GO versions to install. -u, --uninstall VERSIONS The list of GO versions to uninstall. ``` 以下是使用 GoResolver 的典型工作流程: ``` goresolver resolve -v go1.18 -o "path/to/report.json" "path/to/sample.exe" ``` ### 选项 ``` -l, --libs [LIBS ...] List of GO libs to include in the generated samples. -v, --go-version VERSION The GO version to build the reference samples with. ``` `--libs` 和 `--go-version` 选项允许您调整用于生成参考样本的 Go 版本和库。 默认情况下,GoResolver 将尝试识别用于生成样本的 GoVersion,如果失败,则测试一系列 Go 版本并选择最接近的一个。 ``` -t, --threshold THRESHOLD Value at which matches are considered significant. ``` `--threshold` 允许您调整通过图算法获得的符号被视为有效所需的置信度阈值,范围为 `0.0` 到 `1.O`。默认值为 `0.9`。 ``` -x, --extract Extract symbols from the Go sample. -g, --graph Compare the Go sample against generated references. ``` `--extract` 和 `--graph` 选项允许您单独切换任一算法。当两个选项都打开时效果最佳,这也是默认行为。 ## 插件 GoResolver 在 `Plugin` 目录中提供了适用于 IDA 和 Ghidra 的插件。GoResolver 插件的独立版本也可在本仓库的 release 部分获取。这些插件通过提供一种简单的方法将 CLI 工具生成的报告导入到各自的数据库中,使得在这些工具中结合使用 GoResolver 变得更加容易。 两个插件共享同一个 `common` 目录。安装其中一个时,请务必同时复制附带的 `ida` 或 `ghidra` 文件。有关更多信息,请参阅插件目录中的 README.md。
标签:CFG, CTF工具, ELF, Golang, Go语言, Hakrawler, Mach-O, PE, Python, 二进制分析, 云安全监控, 云安全运维, 云资产清单, 函数识别, 去混淆, 反混淆, 同源性分析, 安全编程, 恶意代码分析, 控制流图, 无后门, 日志审计, 混淆分析, 漏洞搜索, 程序破解, 符号恢复, 符号解析, 网络安全, 逆向工具, 逆向工程, 配置文件, 隐私保护, 静态分析