





[](https://mobinert.github.io/HORUS/)
```
_ _ ___ ____ _ _ ____
| | | |/ _ \| _ \| | | / ___|
| |_| | | | | |_) | | | \___ \
| _ | |_| | _ <| |_| |___) |
|_| |_|\___/|_| \_\\___/|____/
🔱 the all-seeing eye — IOC enrichment & PE static analysis
```
**随处拖放。直指任何目标。获取判定结果。**
[**下载 horus.exe**](https://github.com/mobinert/HORUS/releases/latest) · [查看源码](#architecture) · [快速开始](#quick-start) · [使用指南](#full-usage-guide)
## 什么是 Horus?
Horus 是一款**单文件 Windows 安全分诊工具** —— 无需 Python,无需安装程序,零依赖。它仅链接 Windows 自带的 API(使用 `BCrypt` 进行哈希计算,使用 `WinHTTP` 处理 HTTPS),并编译为一个独立的 `.exe` 文件。
交给它**任何东西**,它都能弄清楚该怎么做:
| 你提供的内容 | Horus 会做什么 |
|---|---|
| 文件路径 | 计算哈希值 (MD5/SHA-1/SHA-256),如果适用则解析 PE,评估风险,并根据嵌入的指标进行深度追踪 |
| MD5、SHA-1 或 SHA-256 | 查询 VirusTotal,报告检测结果 |
| IPv4 地址 | 并发查询 VirusTotal + AbuseIPDB |
| 域名 | 查询 VirusTotal,报告分类和信誉度 |
| URL | 查询 VirusTotal,报告判定结果 |
| 邮箱地址 | 查询 VirusTotal |
无需任何参数标志。只需 `horus <东西>` 即可。
## 终端预览
```
_ _ ___ ____ _ _ ____
| | | |/ _ \| _ \| | | / ___|
| |_| | | | | |_) | | | \___ \
| _ | |_| | _ <| |_| |___) |
|_| |_|\___/|_| \_\\___/|____/
🔱 the all-seeing eye — IOC enrichment & PE static analysis
$ horus ransomware_sample.exe
FILE ────────────────────────────────────────────────────────────
path ransomware_sample.exe
size 102,912 bytes
MD5 a3f5d1e2c7b849d60e14a2b8f93c5d17
SHA-1 4b2e8a91c3d056f7e820b4a19c6d3f7e2b085c40
SHA-256 e3b0c44298fc1c149afbf4c8996fb924...852b855
PE HEADER ───────────────────────────────────────────────────────
type executable
bitness 64-bit (PE32+)
machine x64 (AMD64)
subsystem Windows Console
compiled 2018-11-06 22:28:12 UTC (suspicious)
entry RVA 0x12a0
imphash 9a4f2c8d1e7b3056a82c914d6e0f5b17
SECTIONS ────────────────────────────────────────────────────────
.text r-x H=6.21 [##########........]
.rdata r-- H=4.87 [########..........]
.data rw- H=4.12 [#######...........]
UPX0 rwx H=7.94 [##################] RWX!
UPX1 rwx H=7.81 [#################.] RWX!
IMPORTS (4 DLLs, 11 functions) ─────────────────────────────────
KERNEL32.DLL (6)
ADVAPI32.DLL (3)
WS2_32.DLL (2)
CAPABILITIES ────────────────────────────────────────────────────
[Cryptography] encrypts data — benign, or ransomware/payload packing
CryptAcquireContextA CryptGenKey CryptEncrypt
[Network Activity] opens sockets or fetches remote content
WSAStartup connect
[Persistence] writes autostart keys or installs itself to survive reboot
RegSetValueExA RegCreateKeyExA
! Encryption combined with network I/O (exfil / ransomware pattern) +12
! High-entropy section 'UPX0' (H=7.94) — likely packed/encrypted +12
! Section 'UPX0' is writable AND executable (RWX) +18
! Section 'UPX1' is writable AND executable (RWX) +18
! Known packer section name 'UPX0' +16
EMBEDDED INDICATORS (from strings) ────────────────────────────
url http://185.220.101.5:8080/gate.php
ip 185.220.101.5
tokens cmd.exe schtasks powershell
VIRUSTOTAL ──────────────────────────────────────────────────────
VirusTotal 61/72 — Ransom.FileCryptor.Generic (Malicious)
VERDICT ─────────────────────────────────────────────────────────
[ LIKELY MALICIOUS ] risk 98/100
static analysis: LIKELY MALICIOUS (86)
virustotal: 61/72 engines
```
## 风险评分如何工作
Horus 不仅仅列出导入表 —— 它还会进行解读。评分引擎将约 110 个 Windows API 映射到它们隐含的能力,然后对关键的**组合**进行加权评分:
### 单项能力
| 能力 | 含义 | 分数 |
|---|---|---|
| 进程注入 | `VirtualAllocEx`, `WriteProcessMemory`, `CreateRemoteThread` | **+22** |
| 输入捕获 (键盘记录器) | `SetWindowsHookEx`, `GetAsyncKeyState`, `RegisterRawInputDevices` | **+20** |
| 持久化 | `RegSetValueEx`, `CreateService` | **+14** |
| 提权 | `AdjustTokenPrivileges`, `DuplicateTokenEx`, `ImpersonateLoggedOnUser` | **+14** |
| 屏幕捕获 | `BitBlt`, `GetDC`, `CreateCompatibleBitmap` | **+12** |
| 防御规避 | `DeleteFile`, `SetFileAttributes`, `EventWrite` | **+12** |
| 网络 | Winsock + WinHTTP + WinInet | **+8** |
| 加密 | `CryptEncrypt`, `BCryptEncrypt`, `CryptGenKey` | **+8** |
| RWX 节区 | 可写**且**可执行的节区 | **每项 +18** |
| 高熵节区 | Shannon 熵 ≥ 7.2 bits(加壳/加密) | **每项 +12** |
| 已知加壳器名称 | UPX, Themida, VMProtect, .enigma, .vmp… | **+16** |
### 组合奖励(关键部分)
| 组合 | 重要性原因 | 奖励 |
|---|---|---|
| **注入 + API 解析** | 将注入的代码隐藏在动态导入之后 | **+15** |
| **键盘记录 + 网络** | 经典的键盘记录与数据外传架构 | **+15** |
| **加密 + 网络** | 勒索软件或 C2 数据外传模式 | **+12** |
常见的双用途 API(`LoadLibrary`, `CreateProcess`, `GetProcAddress`)会显示出来,但**单独存在时不会计入分数** —— 它们在普通二进制文件中随处可见。只有罕见的原语和危险的组合才会真正影响分数。
### 判定区间
| 分数 | 判定结果 | 含义 |
|---|---|---|
| 0–9 | **CLEAN (干净)** | 未发现可疑内容 |
| 10–29 | **LOW RISK (低风险)** | 存在可疑导入,但无强烈危险信号 |
| 30–59 | **SUSPICIOUS (可疑)** | 存在多个令人担忧的能力或组合 |
| 60–100 | **LIKELY MALICIOUS (极可能为恶意)** | 有强烈证据表明具有恶意意图 |
## 快速开始
### 1. 下载(无需安装)
从 [**Releases**](https://github.com/mobinert/HORUS/releases/latest) 获取 `horus.exe`,并将其放置在你的 PATH 路径中 —— 或者直接在任意文件夹中运行它。
```
# 从你下载它的任意位置运行
.\horus.exe suspicious.exe
```
### 2. 设置 API 密钥(可选但推荐)
Horus 没有密钥也能工作 —— 它仍会进行完整的静态 PE 分析和哈希计算。密钥用于解锁实时的威胁情报查询。
```
# 为当前 session 设置
$env:VT_API_KEY = "your_virustotal_key"
$env:ABUSEIPDB_API_KEY = "your_abuseipdb_key"
# 或者使它们永久生效(user profile)
[System.Environment]::SetEnvironmentVariable("VT_API_KEY","your_key","User")
[System.Environment]::SetEnvironmentVariable("ABUSEIPDB_API_KEY","your_key","User")
```
免费 API 密钥获取:
- **VirusTotal** → [virustotal.com](https://www.virustotal.com) → 登录 → API Key
- **AbuseIPDB** → [abuseipdb.com](https://www.abuseipdb.com) → 账户 → API
## 完整使用指南
```
horus
[options]
anything: a file path, hash, IP, domain, URL, or email
options:
--vt-key VirusTotal API key (overrides VT_API_KEY env)
--abuse-key AbuseIPDB API key (overrides ABUSEIPDB_API_KEY env)
--strings dump extracted ASCII/UTF-16 strings from the file
--json machine-readable JSON output (exit code 1 = suspicious/malicious)
--no-color disable ANSI colour (auto-disabled when piped)
-h, --help show this help
```
### 文件分析示例
```
:: Static analysis of a suspicious binary (PE parser + entropy + capabilities)
horus C:\Samples\malware.exe
:: Same, plus VirusTotal file reputation by SHA-256
horus C:\Samples\malware.exe --vt-key %VT_API_KEY%
:: Analyze and dump its full string table
horus C:\Samples\dropper.dll --strings
:: Get machine-readable JSON for scripting or SIEM ingestion
horus C:\Samples\payload.bin --json
:: Pipe JSON output into jq to extract just the verdict
horus suspicious.exe --json | jq .verdict
```
### IOC 查询示例
```
:: MD5, SHA-1, or SHA-256 hash — Horus auto-detects the type
horus 44d88612fea8a8f36de82e1278abb02f
horus 3395856ce81f2b7382dee72602f798b642f14d0
horus 275a021bbfb6489e54d471899f7db9d1663fc695b2cfad87ef3ef...
:: IP reputation from VirusTotal + AbuseIPDB simultaneously
horus 185.220.101.5
:: Domain reputation
horus evil-c2-domain.ru
:: Full URL
horus https://sketchy.example/drop.bin
:: Email address
horus attacker@phishing-domain.com
:: Combine keys inline instead of via env vars
horus 1.2.3.4 --vt-key abc123 --abuse-key def456
:: JSON output for automation
horus 185.220.101.5 --json
```
### 脚本与自动化
退出代码使得 Horus 可以在流水线中发挥作用:
| 退出代码 | 含义 |
|---|---|
| `0` | 干净 / 未知 —— 未发现可疑内容 |
| `1` | 可疑或恶意 —— 分数 ≥ 30 |
| `2` | 使用错误或未找到文件 |
```
# 如果 Horus 将其标记,则阻止使用该文件
horus .\download.exe --json | Out-Null
if ($LASTEXITCODE -eq 1) {
Write-Warning "File flagged — not running it."
exit 1
}
# 批量 triage 一个文件夹
Get-ChildItem C:\Quarantine\*.exe | ForEach-Object {
$result = horus $_.FullName --json | ConvertFrom-Json
"$($_.Name): $($result.verdict) (score $($result.final_score))"
}
```
### JSON 输出格式
```
{
"target": "malware.exe",
"size": 102912,
"md5": "a3f5d1e2c7b849d60e14a2b8f93c5d17",
"sha1": "4b2e8a91c3d056f7e820b4a19c6d3f7e2b085c40",
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"is_pe": true,
"bitness": 64,
"imphash": "9a4f2c8d1e7b3056a82c914d6e0f5b17",
"static_score": 86,
"vt_detections": 61,
"final_score": 98,
"verdict": "LIKELY MALICIOUS"
}
```
## 架构
无外部库。无运行时依赖。全部集中于一个 `.exe` 中。
```
horus/
│
├── src/
│ ├── main.cpp CLI entry point + orchestration + report rendering
│ ├── pe.hpp PE32 / PE32+ parser — every field bounds-checked
│ ├── signatures.hpp 110-API knowledge base + capability scoring engine
│ ├── ioc.hpp indicator type auto-detection (no regex, hand-rolled)
│ ├── json.hpp zero-dependency JSON parser (recursive descent)
│ ├── crypto.cpp/hpp MD5 / SHA-1 / SHA-256 via Windows BCrypt/CNG
│ ├── http.cpp/hpp HTTPS client via Windows WinHTTP
│ ├── intel.cpp/hpp VirusTotal v3 + AbuseIPDB v2 (extensible interface)
│ └── console.hpp ANSI colour / formatted terminal output
│
├── tests/
│ ├── test_ioc.cpp indicator classifier unit tests
│ ├── test_json.cpp JSON parser unit tests
│ ├── test_pe.cpp PE parser unit tests
│ └── test_score.cpp risk scoring engine unit tests
│
├── CMakeLists.txt CMake build (MSVC or MinGW-w64)
└── LICENSE
```
### 内部数据流
```
horus
│
├─ file_exists(arg)? ──YES──► analyze_file()
│ │
│ ├─ read bytes
│ ├─ hash_buffer() ← BCrypt/CNG
│ ├─ pe::Analyzer::analyze()
│ │ ├─ parse headers (bounds-checked)
│ │ ├─ parse sections + entropy
│ │ ├─ parse import table
│ │ └─ build imphash string
│ ├─ sig::score() ← capability engine
│ ├─ extract_strings() → scan_strings()
│ └─ VirusTotal lookup (if key set)
│
└─ NO ──► classify(arg)
│
└─► intel::enrich() ← parallel fan-out
├─ VirusTotal::lookup() (if supported + key)
└─ AbuseIPDB::lookup() (if supported + key)
```
### 添加新的情报来源
`IntelSource` 接口包含三个方法。只需添加一个新文件,并在 `build_sources()` 中添加一行新代码:
```
// In intel.cpp — add this class
class URLhaus : public IntelSource {
public:
explicit URLhaus(std::string key) : key_(std::move(key)) {}
std::string name() const override { return "URLhaus"; }
bool supports(IocType t) const override {
return t == IocType::Url || t == IocType::Domain;
}
SourceResult lookup(const std::string& ioc, IocType) const override {
// one WinHTTP call → parse JSON → fill SourceResult
}
private:
std::string key_;
};
// In main.cpp — build_sources(), add one line:
if (!o.urlhaus_key.empty()) v.push_back(std::make_shared(o.urlhaus_key));
```
后续可考虑添加的情报源:URLhaus · OTX (AlienVault) · GreyNoise · Shodan · MalwareBazaar
## 从源码构建
### 选项 A — MSVC Developer Command Prompt
打开 **"x64 Native Tools Command Prompt for VS 2022"**(或 2019 版),然后:
```
git clone https://github.com/mobinert/HORUS.git
cd HORUS
cl /EHsc /std:c++17 /O2 /DNOMINMAX /DWIN32_LEAN_AND_MEAN /D_WIN32_WINNT=0x0601 ^
src\main.cpp src\crypto.cpp src\http.cpp src\intel.cpp ^
/I src /Fe:horus.exe bcrypt.lib winhttp.lib
```
### 选项 B — CMake
```
git clone https://github.com/mobinert/HORUS.git
cd HORUS
cmake -B build -G "Visual Studio 17 2022"
cmake --build build --config Release
:: binary at build\Release\horus.exe
```
### 选项 C — MinGW-w64 (MSYS2)
```
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake
cmake -B build -G "MinGW Makefiles"
cmake --build build
```
## Imphash
imphash 遵循 Mandiant 的方法:将小写的 `dll.function` 对(对于 `.dll`、`.ocx`、`.sys` 会去掉扩展名)按导入顺序用逗号连接,然后计算其 MD5。这与 `pefile` 和 `pe-sieve` 等工具生成的结果一致,因此你可以将 Horus 的结果与现有的恶意软件家族数据库进行交叉比对。
## 安全性与局限性
- Horus 是**只读**的 —— 它从不执行、修改或生成任何内容。
- PE 解析器在读取之前会**检查每一个偏移量和长度的边界**。向其提供格式错误或恶意的样本是安全的。
- 静态风险评分是一种**分诊辅助工具**,而不是最终的生产环境判定。请结合 VirusTotal 的共识结果进行判断,对于任何重要文件,请在沙箱中进行引爆测试。
- 在运行时加载所有导入项的混淆样本在静态分析中得分会较低 —— 这是预料之中的。熵值和加壳启发式分析方法能部分弥补这一问题,但对于高度混淆的代码,动态分析仍不可替代。
## 出自同一工作台的更多工具
| 工具 | 功能 |
|------|--------------|
| [**machunt**](https://github.com/mobinert/machunt) | 只读的 macOS 威胁狩猎与妥协评估 —— 包含 20 个模块,支持 HTML/JSON 报告 |
| [**ssh-fortress**](https://github.com/mobinert/ssh-fortress) | 面向 Linux 服务器的 SSH 加固、暴力破解防护与 SIEM 集成 |
## 许可证
MIT —— 详见 [LICENSE](LICENSE)。永久免费用于个人、商业和研究用途。

**专为防御者打造。永久免费。没有任何附加条件。**