TrueFurina/passive-recon

GitHub: TrueFurina/passive-recon

一款纯被动的企业级 OSINT/EASM/CTEM 平台,通过 15+ 公共数据源实现零触碰外部资产发现与风险检测。

Stars: 2 | Forks: 0

# 🕵️ Passive Recon — 企业级 OSINT/EASM/CTEM Agent [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/39/39faa54be350a1dab8afd3b2fb8c1c83e4d9cff84abfef2374d19a18053687c4.svg)](https://github.com/TrueFurina/passive-recon/actions/workflows/ci.yml) [![Python](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/) [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE) [![欢迎 PR](https://img.shields.io/badge/PRs-welcome-brightgreen)](https://github.com/TrueFurina/passive-recon/pulls) [🇨🇳 中文版](./README.zh-CN.md) ## 🌟 什么是 Passive Recon? Passive Recon 是一个**纯被动**的 OSINT/EASM/CTEM 平台,它通过查询 **15+ 个公共数据源**——包括证书透明度日志、DNS 记录、搜索引擎、网络空间测绘、GitHub、Wayback Machine 等——来发现组织的外部资产,**全程不触碰目标系统**。 **一条命令,任意目标:** ``` pip install -r requirements.txt python cli.py collect "Tsinghua University" python cli.py collect --domain example.com "Acme Corp" ``` 系统会自动推断目标域名,并行运行所有 15 个数据源,并生成包含风险发现项的综合资产报告。 ## ✨ 功能 | 功能 | 描述 | |------------|-------------| | **被动资产发现** | 15+ 个交叉验证数据源,支持自动域名推断 | | **子域名枚举** | crt.sh、HackerTarget、URLScan、Wayback、DNSDumpster 等 | | **IP 与端口映射** | C 段聚类,暴露端口检测 | | **风险检测** | VPN 暴露、OA 系统、弱密码、已知漏洞 | | **合规护栏** | 每次外部调用均执行 R1 合规检查 — 故障关闭 | | **速率限制** | 单 IP 滑动窗口 ≤95%,队列绝不丢失任务 | | **审批工作流** | 高风险外部调用需要人工审批 | | **审计追踪** | 完整的操作审计日志 | | **静态护栏** | CI 扫描,阻止主动扫描代码进入生产环境 | | **Web 面板** | `python cli.py serve` — 一键启动控制台 | | **定时任务** | `python cli.py schedule --targets targets.txt` — 每日自动采集 | | **自动保存报告** | Markdown 报告保存至 `data/report__.md` | ## 📡 数据源 | 数据源 | 是否需要 Key | 类型 | |--------|-------------|------| | **crt.sh** | ❌ 免费 | 证书透明度 | | **HackerTarget** | ❌ 免费 | DNS / 子域名 | | **URLScan.io** | ❌ 免费 | 历史快照 | | **AlienVault OTX** | ❌ 免费 | 被动 DNS / 威胁情报 | | **Wayback Machine** | ❌ 免费 | 历史 URL / 子域名 | | **DNSDumpster** | ❌ 免费 | DNS 映射 / MX/NS 记录 | | **CommonCrawl** | ❌ 免费 | 网络爬虫归档 | | **GitHub** | ❌ 免费(有速率限制) | 代码泄露搜索 | | **Hunter (鹰图)** | ✅ 需要 | 网络空间测绘 | | **FOFA** | ✅ 需要 | 网络空间搜索 | | **SecurityTrails** | ✅ 需要 | 子域名 / 被动 DNS | | **Shodan** | ✅ 需要 | 互联网设备搜索 | | **VirusTotal** | ✅ 需要 | 被动 DNS / 子域名 | | **ZoomEye** | ✅ 需要 | 网络空间测绘 | | **Qichacha** | ✅ 需要 | 中国企业注册信息 | ## 🚀 快速开始 ### 1. 安装依赖 ``` pip install -r requirements.txt ``` ### 2. 配置 API Keys(选择一种) **选项 A:环境变量**(推荐 — 绝不写入磁盘) ``` # Linux / macOS export PASSIVE_API_KEYS='{"hunter":["key1","key2"],"qichacha":{"app_key":"xxx","secret_key":"xxx"}}' # Windows PowerShell $json='{"hunter":["key1","key2"],"qichacha":{"app_key":"xxx","secret_key":"xxx"}}' [Environment]::SetEnvironmentVariable('PASSIVE_API_KEYS', $json, 'User') ``` **选项 B:config.json** ``` cp config.example.json config.json # 使用你的密钥编辑 config.json ``` ### 3. 运行资产发现 ``` # One-shot:任意目标,自动域名推断 python cli.py collect "Tsinghua University" python cli.py collect --domain example.com "Acme Corp" # Batch 模式 python cli.py batch targets.txt # 一键 web dashboard python cli.py serve # 每日定时采集(凌晨 2:00) python cli.py schedule --targets targets.txt ``` ## 📊 输出示例 运行 `python cli.py collect "Tsinghua University"` 后: ``` 🎯 目标: Tsinghua University 🌐 自动推断域名: tsinghua.edu.cn # Tsinghua University 被动资产收集报告 > 主域: tsinghua.edu.cn | 数据源: 15 sources > 总数: 285 ## 📊 资产总览 | 类型 | 数量 | |------|------| | subdomain | 270 | | IP 地址 | 178 | | 端口 | 2 | | **合计** | **285** | ## 🚨 风险发现 - 🔴 [P1] VPN 入口暴露: vpn.tsinghua.edu.cn - 🔴 [P1] WebVPN 远程接入暴露: webvpn.tsinghua.edu.cn ``` ## 🔧 环境变量 | 变量 | 类型 | 描述 | 是否必须 | |----------|------|-------------|----------| | `PASSIVE_API_KEYS` | JSON 字符串 | 数据源 API keys(见下文) | ✅ 部分数据源需要 | | `PASSIVE_API_TOKENS` | 逗号分隔 | REST API 认证 tokens | 可选 | | `PASSIVE_API_KEY` | 字符串 | 单个 token 后备 | 可选 | | `PASSIVE_DB_PATH` | 路径 | SQLite 路径(默认:`data/agent.db`) | 可选 | | `PASSIVE_LOG_PATH` | 路径 | 审计日志路径(默认:`data/audit.jsonl`) | 可选 | | `PASSIVE_PII_SALT` | 字符串 | PII 去标识化盐值 (salt) | 可选 | | `PASSIVE_PII_KEY` | 字符串 | PII 加密密钥 | 可选 | ### API Key JSON 格式 ``` { "hunter": ["key1", "key2"], "qichacha": { "app_key": "your_app_key", "secret_key": "your_secret_key" }, "shodan": "your_shodan_key", "virustotal": "your_vt_key", "zoomeye": "your_zoomeye_key" } ``` ## 📁 项目结构 ``` ├── cli.py ← CLI entry point (one command to rule them all) ├── config.example.json ← Config template ├── requirements.txt ← Python dependencies │ ├── passive_agent/ ← 🎯 Core source │ ├── main.py ← FastAPI app + dashboard API │ ├── config.py ← Config loader (env > config.json) │ ├── api/ ← REST API routes │ ├── collector/ ← 15 passive data source collectors │ ├── enumerator/ ← Subject enumeration engine │ ├── verifier/ ← DNS-only verification pipeline │ ├── compliance/ ← Compliance guardrail │ ├── gateway/ ← Proxy gateway + rate limiter │ ├── orchestrator/ ← Orchestration scheduler │ ├── approval/ ← Approval workflow │ ├── audit/ ← Audit logging │ ├── inventory/ ← Asset inventory │ ├── graph/ ← Knowledge graph (planned) │ ├── metrics/ ← Metrics (planned) │ ├── scheduler/ ← Daily scheduled tasks │ ├── storage/ ← SQLite + JSON persistence │ ├── common/ ← Shared components │ └── static/ ← Frontend static files │ ├── tests/ ← Test suite ├── scripts/ ← CI guard scripts ├── docs/ ← Design documents └── data/ ← Runtime data (gitignored) ``` ## 🧪 运行测试 ``` # 完整测试套件 pytest # 被动 egress guard(CI gate) pytest tests/test_passive_egress.py -v # 静态 guard — 确保无 active-scan 代码进入生产环境 python scripts/guard_passive.py ``` ## 🛡️ 核心原则 1. **纯被动** — 绝不向目标发送任何数据包 2. **零日志** — 绝不触碰目标的日志系统 3. **合规出口** — 每次外部调用都必须通过 `compliance_client.check()` 4. **故障关闭** — 存疑则拒绝;配置错误则拒绝;无 token 则拒绝 ## 📜 License MIT

Passive Recon — 在 GitHub 上点个 ⭐ Star
用 ❤️ 为 OSINT / EASM / CTEM 社区打造

标签:EASM, ESC4, GitHub, OSINT, Python, 占用监测, 子域名枚举, 实时处理, 文档结构分析, 无后门, 系统安全, 资产管理, 逆向工具