大模型应用
何时用 OpenOSINT:对邮箱、用户名、域名、IP…
需要对邮箱、用户名、域名、IP 或电话做 OSINT 信息收集,并希望用 AI、CLI、Python 或 MCP 统一调用 11 个工具生成结构化报告时使用 OpenOSINT。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 59/100 ×0.15
适用场景
何时用 OpenOSINT:对邮箱、用户特定
解决思路
- 安装 OpenOSINT:执行 `git clone https://github.com/OpenOSINT/OpenOSINT.git`,进入目录 `cd OpenOSINT`,再执行 `pip install -e .`。
- 配置 AI provider:设置 `export ANTHROPIC_API_KEY=sk-ant-your-key-here`;或使用本地模型时加 `--provider ollama`。安装外部 OSINT 工具:`pip install holehe sherlock-project sublist3r`,并从 GitHub Releases 下载 phoneinfoga 二进制后放入 `PATH`。
- 安装可选依赖与 API key:`pip install ollama` 后执行 `ollama pull llama3.2`;`pip install shodan` 并设置 `export SHODAN_API_KEY=your-shodan-key`;`pip install reportlab` 生成 PDF;设置 `HIBP_API_KEY`、`IPINFO_TOKEN`、`VIRUSTOTAL_API_KEY`。
- 启动交互式 REPL:执行 `openosint`、`openosint shell` 或 `openosint --provider ollama`;在提示符输入自然语言目标,如 `investigate user@example.com`、`find accounts for johndoe99`、`check breaches for admin@company.com`、`enumerate subdomains of example.com`。
- 使用 REPL 命令:输入 `<target>` 调查 email/username/domain/IP/phone;`clear` 重置对话记忆;`save` 保存最后报告到 `reports/`;`tools` 列出可用工具与状态;`config` 显示当前配置;`help` 显示所有命令;`exit` 或 Ctrl-D 退出。
- 使用直接 CLI(不经过 AI):`openosint email target@example.com`,可加 `-t 60`;`openosint username johndoe99`,可加 `-t 120`;`openosint shodan 8.8.8.8`;`openosint shodan 'apache port:80 country:DE'`;`openosint virustotal example.com`;`openosint virustotal 192.168.1.1`;`openosint multi 'user@example.com johndoe99 example.com'`;`openosint --parallel email user@example.com`;`openosint --parallel username johndoe99`;`openosint --json email user@example.com`。
- 直接用 Python API 调用单个工具:从 `openosint.tools.email` 导入 `search_email`,从 `openosint.tools.username` 导入 `search_username`,从 `openosint.tools.breach` 导入 `search_breach`,从 `openosint.tools.whois` 导入 `search_whois`,从 `openosint.tools.ip` 导入 `search_ip`,从 `openosint.tools.domain` 导入 `search_domain`,从 `openosint.tools.dorks` 导入 `generate_dorks`,从 `openosint.tools.paste` 导入 `search_paste`,从 `openosint.tools.phone` 导入 `search_phone`,从 `openosint.tools.shodan` 导入 `search_shodan`,从 `openosint.tools.virustotal` 导入 `search_virustotal`。
- 编写异步调查函数:`await search_email(email, timeout=60)` 查社交账号;`await search_breach(email)` 查数据泄露;`await search_paste(email)` 查 paste 转储;`await generate_dorks(email)` 生成 Google dorks;`await search_username(username, timeout=120)` 查平台;`await search_whois(domain)`;`await search_domain(domain)` 枚举子域名;`await search_virustotal(domain)`;`await search_ip(ip)`;`await search_shodan(ip)`;`await search_phone(phone)` 使用 E.164 格式;最后用 `asyncio.run(...)` 执行。
- 使用 AI Agent:导入 `OpenOSINTAgent`,创建 `OpenOSINTAgent(api_key=None, provider='anthropic', model='claude-3-5-sonnet-20241022')` 或 `provider='ollama'`;调用 `await agent.investigate('investigate user@example.com')`;可让 agent 自动串联工具,如 `await agent.investigate('find all accounts for johndoe99 and check for breaches')`;用 `agent.get_history()` 获取历史,用 `agent.clear_history()` 清空对话。
- 并行执行:用 `asyncio.gather(search_email(...), search_breach(...), search_paste(...), return_exceptions=True)` 同时跑多个工具,并把返回结果组装成 report;单个工具异常不阻断整体。
- 执行完整邮箱扫描:依次 `search_email` 找社交账号、`search_breach` 查泄露(需 `HIBP_API_KEY`)、`search_paste` 查 paste、`generate_dorks` 生成 dorks,返回 accounts/breaches/pastes/dorks。
- 执行完整用户名扫描:`search_username(username, timeout=180)` 搜索 300+ 平台(可能 2 分钟以上)、`search_paste`、`generate_dorks`,返回 platforms/pastes/dorks。
- 执行完整域名扫描:`search_whois`、`search_domain` 枚举子域名、`search_virustotal`(需 `VIRUSTOTAL_API_KEY`)、`generate_dorks`,返回 whois/subdomains/virustotal/dorks。
- 执行完整 IP 扫描:`search_ip` 查地理位置、`search_shodan`(需 `SHODAN_API_KEY`)、`search_virustotal`,返回 ip_info/shodan/virustotal。
- 执行 Shodan 高级查询:主机查询 `search_shodan('8.8.8.8')`;banner 查询 `search_shodan('apache port:80')`;国家查询 `search_shodan('apache port:80 country:DE')`;漏洞查询 `search_shodan('vuln:CVE-2014-0160')`;ICS/SCADA 查询 `search_shodan('port:502')`;摄像头查询 `search_shodan('Server: SQ-WEBCAM')`。
- 集成 MCP server:在 MCP 客户端配置 `mcpServers.openosint`,`command` 为 `python`,`args` 为 `['-m', 'openosint.mcp_server']`,`env` 放入 `ANTHROPIC_API_KEY`、`HIBP_API_KEY`、`SHODAN_API_KEY`、`VIRUSTOTAL_API_KEY`、`IPINFO_TOKEN`;然后在 Claude Desktop 直接说 `Investigate user@example.com for social accounts and data breaches`、`Find all platforms where johndoe99 has accounts`、`Enumerate subdomains for example.com`。
- 配置环境变量与超时:必需 `ANTHROPIC_API_KEY`(除非用 ollama);可选 `HIBP_API_KEY`、`SHODAN_API_KEY`、`VIRUSTOTAL_API_KEY`、`IPINFO_TOKEN`;Ollama 用 `OLLAMA_HOST=http://localhost:11434`;每个工具可传 `timeout` 秒,默认 `search_email=60`、`search_username=120`、`search_domain=90`、`search_phone=30`、`search_shodan=30`,慢工具可设 `search_username(timeout=300)`。
- 批量与导出:用 `asyncio.gather` 对多个 email 并行调查并用 `return_exceptions=True` 过滤异常;用 `OpenOSINTAgent` 调查后 `json.dump` 写入 `reports/investigation.json`,包含 target/findings/timestamp。
- 错误处理与限流:每个工具独立 `try/except`,分别捕获 `asyncio.TimeoutError` 和普通异常并写入错误字符串;批量请求时用 `await asyncio.sleep(delay)` 限流;大结果用逐个处理并 `del result` 避免内存堆积。
- 检查工具状态与排障:用 `shutil.which` 检查 `holehe`、`sherlock`、`sublist3r`、`phoneinfoga`,用 `os.getenv` 检查各 API key;holehe 缺失则 `pip install holehe`;sherlock 缺失则 `pip install sherlock-project`;phoneinfoga 缺失则从 GitHub Releases 下载、解压、`sudo mv phoneinfoga /usr/local/bin/`、`chmod +x /usr/local/bin/phoneinfoga`;HIBP 401 设置 `HIBP_API_KEY`;Shodan 401 设置 `SHODAN_API_KEY` 并用 `python -c` 调用 shodan 验证;VirusTotal 403 设置 `VIRUSTOTAL_API_KEY`;Ollama 连接错误则 `curl -fsSL https://ollama.com/install.sh | sh`、`ollama pull llama3.2`、`curl http://localhost:11434/api/tags`。
适用边界 · 注意事项
- 未获得授权或用于骚扰、人肉、非法跟踪时不要使用。
- 缺少外部工具(holehe/sherlock/sublist3r/phoneinfoga)或对应 API key 时,breach/shodan/virustotal/ipinfo 等增强功能不可用。
- 电话查询需 E.164 格式;若不想配置 AI provider 或外部依赖,可用直接 CLI,但 AI agent/MCP 功能不适用。