x-glacier/kali-pentest / kali-pentest-zh
kali-pentest-zh
Flagged通过 SSH 或 Docker 使用 Kali Linux CLI 工具执行授权渗透测试。 覆盖:信息收集、漏洞分析、嗅探与欺骗、Web/API 渗透、漏洞利用、密码攻击、无线、云原生安全、RFID/NFC、VoIP/ICS、逆向工程、取证分析、后渗透/C2、报告生成。
references/information-gathering/tools/recon-ng.md
View on GitHub# Recon-ng
- **Category**: Information Gathering / OSINT Framework
- **Risk Level**: 🟡 Medium
---
## 描述
Recon-ng 是一个功能强大的 Web 侦察框架,其命令行界面类似于 Metasploit,采用模块化架构。它提供了一个完整的环境,将 OSINT 侦察任务自动化,并将数据存储到数据库中,方便管理和分析。
## 安装
```bash
recon-ng
sudo apt install recon-ng
git clone https://github.com/lanmaster53/recon-ng
cd recon-ng && pip3 install -r REQUIREMENTS
# 安装所有模块(首次使用)
# ⚠️ 需要网络连接;在运行批量脚本前,请先交互式安装模块
# 在 recon-ng 命令行中:
marketplace install all
```
## 参数说明
### 启动参数
| 参数 | 说明 |
|------|------|
| `-w <workspace>` | 指定/创建工作区 |
| `-r <file>` | 从资源文件加载命令 |
| `--no-version` | 禁用版本检查 |
| `--no-analytics` | 禁用分析报告 |
| `--no-marketplace` | 禁用远程模块管理 |
### 框架内命令
| 命令 | 说明 |
|------|------|
| `workspaces create <name>` | 创建工作区 |
| `workspaces list` | 列出工作区 |
| `workspaces load <name>` | 加载工作区 |
| `marketplace search [keyword]` | 搜索模块 |
| `marketplace install <module>` | 安装模块 |
| `marketplace info <module>` | 查看模块信息 |
| `modules search [keyword]` | 搜索已安装模块 |
| `modules load <module>` | 加载模块 |
| `info` | 查看当前模块信息 |
| `options set <option> <value>` | 设置选项 |
| `options list` | 列出选项 |
| `run` | 运行当前模块 |
| `back` | 退出当前模块 |
| `db insert <table> <value>` | 向数据库插入记录 |
| `db query <SQL>` | 查询数据库 |
| `show <table>` | 显示数据库表内容 |
| `keys add <API name> <key>` | 添加 API 密钥 |
| `keys list` | 列出已配置的 API 密钥 |
| `dashboard` | 查看项目统计 |
| `pdb` | Python 调试器 |
| `exit` | 退出框架 |
## 常用命令
### 场景一:初始化工作区
```bash
# 启动 recon-ng
recon-ng
# 创建项目工作区
[recon-ng] > workspaces create example_corp
# 安装所有模块(首次使用)
[recon-ng][example_corp] > marketplace install all
# 安装指定模块
[recon-ng][example_corp] > marketplace install recon/domains-hosts/hackertarget
```
### 场景二:配置 API 密钥
```bash
# 查看需要 API 密钥的模块
[recon-ng] > marketplace search
# 添加 API 密钥
[recon-ng] > keys add shodan_api YOUR_SHODAN_API_KEY
[recon-ng] > keys add virustotal_api YOUR_VT_API_KEY
[recon-ng] > keys add github_api YOUR_GITHUB_TOKEN
# 查看已配置的密钥
[recon-ng] > keys list
```
### 场景三:子域名枚举
```bash
# 添加目标域名
[recon-ng][example_corp] > db insert domains example.com
# 使用多个模块枚举子域名
[recon-ng][example_corp] > modules load recon/domains-hosts/hackertarget
[recon-ng][example_corp][hackertarget] > run
[recon-ng][example_corp] > modules load recon/domains-hosts/certificate_transparency
[recon-ng][example_corp][certificate_transparency] > run
[recon-ng][example_corp] > modules load recon/domains-hosts/google_site_web
[recon-ng][example_corp][google_site_web] > run
# 查看发现的主机
[recon-ng][example_corp] > show hosts
```
### 场景四:联系人和邮箱收集
```bash
# 搜索联系人模块
[recon-ng][example_corp] > modules search contacts
# 使用 Hunter.io 模块
[recon-ng][example_corp] > modules load recon/domains-contacts/hunter_io
[recon-ng][example_corp][hunter_io] > options set SOURCE example.com
[recon-ng][example_corp][hunter_io] > run
# 查看联系人
[recon-ng][example_corp] > show contacts
```
### 场景五:IP 地址信息
```bash
# 解析主机的 IP 地址
[recon-ng][example_corp] > modules load recon/hosts-hosts/resolve
[recon-ng][example_corp][resolve] > run
# Shodan 查询
[recon-ng][example_corp] > modules load recon/hosts-ports/shodan_ip
[recon-ng][example_corp][shodan_ip] > run
# 查看 IP 信息
[recon-ng][example_corp] > show hosts
```
### 场景六:生成报告
```bash
# HTML 报告
[recon-ng][example_corp] > modules load reporting/html
[recon-ng][example_corp][html] > options set FILENAME /tmp/report.html
[recon-ng][example_corp][html] > options set CREATOR "Pentester Name"
[recon-ng][example_corp][html] > options set CUSTOMER "Example Corp"
[recon-ng][example_corp][html] > run
# CSV 导出
[recon-ng][example_corp] > modules load reporting/csv
[recon-ng][example_corp][csv] > options set FILENAME /tmp/hosts.csv
[recon-ng][example_corp][csv] > options set TABLE hosts
[recon-ng][example_corp][csv] > run
```
### 场景七:批量自动化
> **前提条件**:在运行批量脚本前,请先交互式安装所有所需模块(`marketplace install all`)。在 `-r` 模式下执行 `marketplace install` 可能会静默失败(如果模块未预先安装)。
```bash
# 创建命令文件
cat > recon_commands.txt << 'EOF'
workspaces create auto_recon
db insert domains example.com
modules load recon/domains-hosts/hackertarget
run
back
modules load recon/hosts-hosts/resolve
run
back
modules load reporting/html
options set FILENAME /tmp/recon_report.html
run
exit
EOF
# 自动执行
recon-ng -r recon_commands.txt
```
### 数据库操作
```bash
# 直接 SQL 查询
[recon-ng] > db query SELECT * FROM hosts WHERE host LIKE '%.example.com'
# 导入已知数据(交互式;会提示输入每个字段)
[recon-ng] > db insert domains
# (按提示输入值)
# 对于域名,可以直接插入:
[recon-ng] > db insert domains example.com
```
### 常用模块清单
| 模块 | 功能 |
|------|------|
| `recon/domains-hosts/hackertarget` | 子域名枚举 |
| `recon/domains-hosts/certificate_transparency` | 证书透明度 |
| `recon/domains-contacts/hunter_io` | 邮箱收集 |
| `recon/hosts-hosts/resolve` | DNS 解析 |
| `recon/hosts-ports/shodan_ip` | Shodan 查询 |
| `recon/hosts-hosts/bing_ip` | Bing IP 查询 |
| `recon/domains-vulnerabilities/xssed` | XSS 漏洞 |
| `reporting/html` | HTML 报告 |
| `reporting/csv` | CSV 导出 |
## 注意事项
1. 依赖 `-r` 批量执行前,先交互式安装 marketplace 模块。
2. 为不同客户或评估范围使用独立工作区,避免证据混杂。
3. 许多模块需要 API 密钥;在判断数据源没有结果前,先完成密钥配置。
4. 使用 `reporting/html` 或 `reporting/csv` 导出数据库内容用于报告。
5. 针对子域名枚举,应将 recon-ng 结果与 `theHarvester`、`amass`、`subfinder` 和 `spiderfoot` 交叉验证。
---
## 官方参考
- [recon-ng GitHub](https://github.com/lanmaster53/recon-ng)
- [recon-ng Wiki](https://github.com/lanmaster53/recon-ng/wiki)
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 |