static-analysis-engineering/CodeHawk-Binary
GitHub: static-analysis-engineering/CodeHawk-Binary
面向恶意软件分析和逆向工程的静态二进制分析命令行工具,支持多架构反汇编、控制流图生成和 IOC 提取。
Stars: 39 | Forks: 13
# CodeHawk-Binary
CodeHawk Binary Analyzer 用于恶意软件分析和通用逆向
工程
本代码库包含命令行接口(使用 Python 编写),用于
运行 CodeHawk Binary Analyzer 并报告其结果。命令行
接口可以按如下方式调用(请根据实际位置调整路径):
```
> export PYTHONPATH=$HOME/CodeHawk-Binary
> export PATH=$HOME/CodeHawk-Binary/chb/cmdline:$PATH
> chkx
```
这将显示可用命令的[概述](doc/cli-output.txt)。
目前分析器支持 x86(32 位),包括 ELF 和 PE32,mips32,
以及 arm32(包括 ARM 和 Thumb-2)二进制文件(仅限 ELF);arm32 仍处于
活跃开发中,因此具有一定实验性质。
### 要求
确保已安装 `zip`。
命令行接口需要 python3.5 或更高版本。
CodeHawk Binary Analyzer 的构建说明可在此处
[获取](https://github.com/static-analysis-engineering/codehawk/tree/master/CodeHawk)。
完成后,将分析器 `chx86_analyze` 从 `CodeHawk/_build/install/default/bin/`
目录复制到 `chb/bin/binaries` 中的相应目录,或者将 `chb/util/` 中的
Config.py(或 ConfigLocal.py)指向其位置。
您可以使用以下命令检查配置:
```
> chkx info
Analyzer configuration:
-----------------------
analyzer : /home/myname/codehawk/CodeHawk/_build/install/default/bin/chx86_analyze (found)
summaries: /home/myname/codehawk/CodeHawk/CHB/bchsummaries/bchsummaries.jar (found)
```
并通过运行一些测试来检查其是否正常工作:
```
> chkx test runall
--ok-- arm32 elf suite_001 test_001
--ok-- x86 elf suite_001 test_001
--ok-- x86 elf suite_001 test_002
--ok-- x86 elf suite_001 test_003
--ok-- x86 elf suite_001 test_004
--ok-- x86 elf suite_001 test_005
--ok-- x86 pe suite_001 test_001.exe
--ok-- x86 pe suite_001 test_002.exe
--ok-- x86 pe suite_001 test_003.exe
--ok-- x86 pe suite_001 test_004.exe
--ok-- x86 pe suite_001 test_005.exe
All 11 tests passed.
```
### 快速入门
```
> cd
> git clone https://github.com/static-analyis-engineering/CodeHawk-Binary.git
> export PYTHONPATH=$HOME/CodeHawk-Binary
> export PATH=$HOME/CodeHawk-Binary/chb/cmdline:$PATH
>
```
要反汇编 x86、arm32 或 mips32 可执行文件:
```
> chkx analyze -d mybinary
...
```
这将显示有关反汇编的一些统计信息,但不会执行任何
分析。这通常是很好的第一步,特别是当二进制文件
很大时,用于检查反汇编是否成功。如果看起来没问题,可以使用以下命令执行
分析(使用 --reset 删除任何先前的中间结果):
```
> chkx analyze mybinary --reset
....
> chkx results stats mybinary
```
以下命令可用于查看更详细的结果:
```
results stats output a summary of results with one line per function
results functions ... output a listing of annotated assembly functions
results function output a listing of a single annotated assembly function
results cfg ... produce a control flow graph for a function (in pdf)
results cfgpaths ... find paths throug a cfg with a given target
results appcalls output a listing of application calls
results dllcalls output a listing of dll calls (PE32 only)
results stringargs output a listing of calls with string arguments
results iocs output a listing of indicators of compromise encountered
```
最后,在重新分析
以前分析过的二进制文件时,重置分析结果通常是个好主意:
```
> chkx analyze mybinary --reset
```
以避免不一致的中间结果。
标签:CodeHawk, DAST, ELF, Findomain, JS文件枚举, MIPS, PE32, Python, Wayback Machine, x86, 二进制分析, 二进制安全, 云安全监控, 云安全运维, 云资产清单, 反汇编, 恶意软件分析, 情报收集, 无后门, 漏洞数据库, 漏洞研究, 逆向工具, 逆向工程, 静态分析