Arijit0906/osint-recon
GitHub: Arijit0906/osint-recon
一款基于 Python 的被动 OSINT 侦察工具,利用公开 API 无接触地收集子域名、DNS 记录、端口服务和泄露信息,并自动生成 Markdown 报告。
Stars: 0 | Forks: 0
# osint-recon
一款被动 OSINT 侦察工具,利用公共 API 和开源情报源自动映射目标域名的外部攻击面——无需主动扫描。
本项目作为 Red Team 作品集项目构建,展示了实战中的侦察方法论。
## 功能
| 模块 | 来源 | 发现内容 |
|--------|--------|---------------|
| 子域名发现 | crt.sh (免费) | 通过证书透明度日志获取所有子域名 |
| DNS 枚举 | dnspython (免费) | A, MX, TXT, NS, CNAME 记录 |
| 端口/服务信息 | Shodan API (免费层) | 开放端口、服务指纹、产品版本 |
| WHOIS 查询 | python-whois (免费) | 注册商、过期日期、名称服务器 |
| 泄露关联 | HaveIBeenPwned API (免费) | 泄露数据库中被泄露的邮箱地址 |
所有数据源均为**被动**方式——该工具从不直接向目标发送数据包。
## 输出示例
查看 [`examples/sample_report.md`](examples/sample_report.md) 获取完整的示例报告。
```
╔═══════════════════════════════════════╗
║ osint-recon v1.0 ║
║ Passive Attack Surface Mapper ║
╚═══════════════════════════════════════╝
[1/5] Subdomain enumeration via crt.sh...
Found 14 subdomains
[2/5] Resolving DNS records...
A: ['93.184.216.34']
MX: ['10 mail.example.com.']
[3/5] Querying Shodan for 1 IP(s)...
Ports: [80, 443]
[4/5] WHOIS lookup...
Registrar: Example Registrar LLC
Expires: 2030-01-01
[5/5] HIBP — no emails found in WHOIS to check
[+] Report saved → report.md
```
## 安装
```
git clone https://github.com/Arijit0906/osint-recon
cd osint-recon
pip install -r requirements.txt
cp .env.example .env
```
然后编辑 `.env` 并添加你的 API 密钥:
```
SHODAN_API_KEY=your_key_here
HIBP_API_KEY=your_key_here
```
**免费 API 密钥获取:**
- Shodan: https://shodan.io (注册 → My Account → API Key)
- HaveIBeenPwned: https://haveibeenpwned.com/API/Key
## 用法
```
# 基础扫描 — 输出 report.md
python main.py --domain example.com
# 自定义输出文件
python main.py --domain example.com --output example_report.md
# 跳过 Shodan(如果还没有 API key)
python main.py --domain example.com --skip-shodan
# 跳过所有付费 API — 仅 crt.sh + DNS + WHOIS(100% 免费)
python main.py --domain example.com --skip-shodan --skip-hibp
```
## 运行测试
```
python -m pytest tests/ -v
# 或不使用 pytest:
python -m unittest discover tests/
```
## 项目结构
```
osint-recon/
├── modules/
│ ├── crtsh.py # Subdomain discovery (crt.sh)
│ ├── dns_enum.py # DNS record resolution
│ ├── shodan_scan.py # Port/service enumeration (Shodan)
│ ├── whois_lookup.py # Domain registration data
│ ├── hibp.py # Breach correlation (HIBP)
│ └── __init__.py
├── report/
│ ├── renderer.py # Markdown report generator
│ └── __init__.py
├── tests/
│ ├── test_crtsh.py
│ └── test_renderer.py
├── examples/
│ └── sample_report.md
├── main.py # CLI entry point
├── requirements.txt
├── .env.example
├── .gitignore
└── README.md
```
## 法律声明
本工具仅供**授权使用**。
- 仅在你**拥有**或已获得**书面授权**测试的域名上运行
- 所有数据源均为公开且被动——不会向目标发送任何数据包
- 作者对滥用行为不承担任何责任
## 展示技能
`Python` · `REST API integration` · `DNS` · `OSINT methodology` · `Threat surface mapping` · `Security reporting` · `Unit testing` · `argparse CLI` · `dotenv` · `Shodan` · `HaveIBeenPwned`
标签:Atomic Red Team, ATT&CK, DNS枚举, ESC4, OSINT, Python, WHOIS查询, 动态插桩, 协议探测, 安全工具库, 安全规则引擎, 实时处理, 密码管理, 开源网络情报, 攻击面测绘, 数据展示, 数据泄露检测, 无后门, 端口枚举, 红队, 网络安全, 网络安全工具, 自动化报告, 被动侦察, 证书透明度, 逆向工具, 隐私保护