JacobJandon/OnionClaw

GitHub: JacobJandon/OnionClaw

基于 SICRY 引擎的 Tor 暗网 OSINT 工具集,支持多引擎聚合搜索、页面抓取、身份轮换和 LLM 智能分析,可独立运行或作为 OpenClaw 技能集成。

Stars: 0 | Forks: 0

# OnionClaw™ 🧅 [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/JacobJandon/OnionClaw/blob/main/LICENSE) [![OpenClaw Skill](https://img.shields.io/badge/OpenClaw-skill-blue)](https://github.com/JacobJandon/OnionClaw/blob/main/SKILL.md) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/4fc6272d53023600.svg)](https://github.com/JacobJandon/OnionClaw/actions/workflows/ci.yml) **作者:[JacobJandon](https://github.com/JacobJandon)**

OnionClaw™ logo

OnionClaw™ 赋予 AI agents 完整访问 Tor 网络和 .onion 隐藏服务的能力。它作为 [OpenClaw](https://github.com/openclaw/openclaw) skill 运行(除了 `.env` 文件外无需额外配置即可即插即用),同时也支持在任何终端中独立运行。 基于 [SICRY](https://github.com/JacobJandon/Sicry) 引擎 —— 包含 18 个暗网搜索引擎、Robin OSINT pipeline、以及四种 LLM 分析模式。 ``` # 作为 OpenClaw 技能: cp -r OnionClaw ~/.openclaw/skills/onionclaw # → agent 现在在每次会话中都有 7 个暗网命令可用 # 独立运行: python3 scripts/check_tor.py # verify Tor python3 scripts/search.py --query "ransomware healthcare" python3 scripts/pipeline.py --query "acme.com data leak" --mode corporate ``` ## 目录 1. [OnionClaw™ 的功能](#what-onionclaw-does) 2. [系统要求](#requirements) 3. [作为 OpenClaw skill 安装](#install-as-openclaw-skill) 4. [独立安装](#standalone-install) 5. [配置说明](#configuration) 6. [全部七条命令](#all-seven-commands) 7. [调查流程](#investigation-flows) 8. [分析模式](#analysis-modes) 9. [故障排除](#troubleshooting) 10. [致谢](#credits) ## OnionClaw™ 的功能 七条命令提供了完整的 Tor OSINT 工具集: | 命令 | 功能 | |---|---| | `check_tor.py` | 验证 Tor 是否处于活动状态,显示当前出口 IP | | `renew.py` | 轮换 Tor 电路 —— 获取新的出口节点和新身份 | | `check_engines.py` | Ping 所有 18 个暗网搜索引擎,显示延迟 | | `search.py` | 同时搜索多达 18 个引擎,返回去重后的结果 | | `fetch.py` | 通过 Tor 获取任何 `.onion` 或明网 URL | | `ask.py` | 对抓取的内容进行 LLM OSINT 分析(4 种模式) | | `pipeline.py` | 完整的 Robin pipeline:优化 → 搜索 → 过滤 → 抓取 → 分析 | ## 系统要求 - **Python 3.10+** - **Tor** 在本地运行(SOCKS 代理位于 `127.0.0.1:9050`) - **pip packages**: `requests[socks] beautifulsoup4 python-dotenv stem` - **LLM key**(可选 —— 仅 `ask.py` 和 `pipeline.py` 分析步骤需要) ### 安装 Tor **Linux (Debian/Ubuntu):** ``` apt install tor && tor & ``` **macOS:** ``` brew install tor && tor & ``` **配置控制端口(`renew.py` 需要):** ``` cat > /tmp/onionclaw_tor.conf << 'EOF' SocksPort 9050 ControlPort 9051 CookieAuthentication 1 DataDirectory /tmp/tor_data EOF tor -f /tmp/onionclaw_tor.conf & ``` 然后在 `.env` 中设置 `TOR_DATA_DIR=/tmp/tor_data`。 ### 安装 Python packages ``` pip install requests[socks] beautifulsoup4 python-dotenv stem ``` ## 作为 OpenClaw skill 安装 1. **克隆或复制** 此仓库到你的 OpenClaw skills 目录: ``` # 选项 A — 直接 clone git clone https://github.com/JacobJandon/OnionClaw ~/.openclaw/skills/onionclaw # 选项 B — 复制本地文件夹 cp -r OnionClaw ~/.openclaw/skills/onionclaw ``` 2. **配置** skill 文件夹中的 `.env`: ``` cp ~/.openclaw/skills/onionclaw/.env.example ~/.openclaw/skills/onionclaw/.env nano ~/.openclaw/skills/onionclaw/.env # add LLM key if desired ``` 3. **启动新的 OpenClaw 会话** —— skill 会在启动时自动加载。每当用户询问暗网相关话题时,OpenClaw 会自动将 `onionclaw` 纳入 agent 上下文。 **验证 OpenClaw 是否能识别该 skill:** ``` openclaw skills list # → onionclaw 🧅 搜索 Tor 暗网... ``` **OpenClaw 触发短语:** - "search the dark web for …"(在暗网搜索……) - "investigate this .onion site …"(调查这个 .onion 网站……) - "check if my data appeared on the dark web"(检查我的数据是否出现在暗网上) - "find ransomware leaks related to …"(查找与……相关的勒索软件泄露) - "fetch this .onion URL …"(获取这个 .onion URL……) - "run a Tor OSINT investigation on …"(对……进行 Tor OSINT 调查) ## 独立安装 无需 OpenClaw。每个脚本均可直接在终端运行: ``` git clone https://github.com/JacobJandon/OnionClaw cd OnionClaw pip install requests[socks] beautifulsoup4 python-dotenv stem cp .env.example .env # 编辑 .env — 根据需要添加 LLM key(对于大多数命令是可选的) ``` ## 配置说明 将 `.env.example` 复制为 `.env` 并根据需要填写: ``` # ── Tor ──────────────────────────────────────────────────────────────── TOR_SOCKS_HOST=127.0.0.1 TOR_SOCKS_PORT=9050 TOR_CONTROL_HOST=127.0.0.1 TOR_CONTROL_PORT=9051 # TOR_CONTROL_PASSWORD=your_password # 仅当 torrc 中包含 HashedControlPassword 时 # TOR_DATA_DIR=/tmp/tor_data # 用于 cookie 认证的 DataDirectory 路径 # ── LLM(仅 ask.py 和 pipeline.py 分析步骤需要)────────── LLM_PROVIDER=openai # openai | anthropic | gemini | ollama | llamacpp OPENAI_API_KEY=sk-... # ANTHROPIC_API_KEY=sk-ant-... # GEMINI_API_KEY=AIza... # OLLAMA_MODEL=llama3.2 # 本地模型 — 无需 API key ``` ## 全部七条命令 ### `check_tor.py` — 验证 Tor ``` python3 scripts/check_tor.py ``` ``` ✓ Tor active Exit IP : 185.220.101.20 Error : None {"tor_active": true, "exit_ip": "185.220.101.20", "error": null} ``` 优先运行此命令。如果 Tor 未运行或无法通过端口 9050 访问,将以代码 1 退出。 ### `renew.py` — 轮换身份 ``` python3 scripts/renew.py ``` ``` Rotating Tor circuit... ✓ Identity renewed — new Tor circuit established {"success": true, "error": null} ``` 认证顺序:环境变量中的密码 → 来自 `TOR_DATA_DIR` 的 cookie → 常见系统路径 → 无认证。配合上述推荐的 torrc 或标准系统 Tor 安装,即可开箱即用。 ### `check_engines.py` — 引擎健康检查 ``` python3 scripts/check_engines.py ``` ``` ALIVE 13/18 ────────────────────────────────────────── ✓ Ahmia-clearnet 670ms ███ ✓ Tor66 749ms ███ ✓ Ahmia 1139ms █████ ✓ OSS 1203ms ██████ ... DOWN 5/18 ✗ Kaizer timeout ✗ Anima timeout ✗ FindTor timeout ``` 在进行大规模搜索会话前运行。将存活引擎名称作为参数传给 `search.py` 的 `--engines` 选项。 ### `search.py` — 搜索暗网 ``` # 所有 18 个引擎(默认) python3 scripts/search.py --query "ransomware healthcare leak" # 指定引擎(更快 — 使用 check_engines 输出中的存活引擎) python3 scripts/search.py \ --query "credential dump" \ --engines Ahmia Tor66 Ahmia-clearnet OSS # 限制结果数量 python3 scripts/search.py --query "bitcoin mixer" --max 30 ``` 返回包含 `{title, url, engine}` 的去重列表,涵盖所有引擎。 **提示:** 使用简短的关键词查询(3–5 个词)。暗网搜索索引对关键词的响应远优于自然语言句子。 ### `fetch.py` — 获取任何 .onion 页面 ``` # Hidden service python3 scripts/fetch.py \ --url "http://juhanurmihxlp77nkq76byazcldy2hlmovfu2epvl5ankdibsot4csyd.onion" # 包含提取的链接 python3 scripts/fetch.py --url "http://example.onion/page" --links # 仅 JSON 输出 python3 scripts/fetch.py --url "http://example.onion" --json ``` 返回:标题、文本内容(最多 8000 字符)、提取的链接、HTTP 状态码。状态码为 `0` 表示隐藏服务不可达或已离线。 ### `ask.py` — LLM OSINT 分析 ``` # 内联内容 python3 scripts/ask.py \ --query "LockBit ransomware" \ --mode ransomware \ --content "page text from scraped pages" # 来自文件 python3 scripts/ask.py \ --query "acme.com" \ --mode corporate \ --file /tmp/scraped_pages.txt # 通过管道传输自 fetch.py python3 scripts/fetch.py --url "http://some.onion" --json | \ python3 -c "import sys,json; print(json.load(sys.stdin)['text'])" | \ python3 scripts/ask.py --query "investigate" --mode threat_intel # 自定义分析焦点 python3 scripts/ask.py \ --query "mixer services" \ --mode threat_intel \ --content "..." \ --custom "Focus on cryptocurrency wallet addresses only" ``` **模式:** `threat_intel` · `ransomware` · `personal_identity` · `corporate` — 参见 [分析模式](#analysis-modes)。 ### `pipeline.py` — 完整调查(单条命令) 自动运行完整的 Robin OSINT pipeline: | 步骤 | 执行内容 | |---|---| | 1 | 验证 Tor 是否处于活动状态 | | 2 | 检查哪些引擎存活 | | 3 | 将查询优化为 ≤5 个关键词 (LLM) | | 4 | 搜索所有存活的引擎 | | 5 | 筛选出前 20 个最相关的结果 (LLM) | | 6 | 并发批量抓取页面 | | 7 | OSINT 分析并生成报告 (LLM) | ``` # 基础 python3 scripts/pipeline.py --query "hospital ransomware 2026" # 带分析模式和输出文件 python3 scripts/pipeline.py \ --query "acme.com credentials leak" \ --mode corporate \ --out report.md # 完整选项 python3 scripts/pipeline.py \ --query "QUERY" \ --mode ransomware \ --max 50 \ --scrape 12 \ --custom "Focus on ransom amounts and victim industries" \ --out report.md ``` **步骤 1–6 无需 LLM key 即可完全运行。** 只有步骤 3、5 和 7 会使用 LLM —— 当未设置 key 时,它们会优雅地回退,打印目前已收集的内容。 ## 调查流程 ### 场景 1:检查泄露的凭证 ``` python3 scripts/check_tor.py python3 scripts/pipeline.py \ --query "acme.com email passwords" \ --mode corporate \ --scrape 10 \ --out acme_leak_report.md ``` ### 场景 2:勒索软件情报 ``` python3 scripts/check_tor.py python3 scripts/search.py \ --query "LockBit healthcare 2026" \ --engines Ahmia Tor66 Ahmia-clearnet \ --max 40 # 获取最相关的 URL python3 scripts/fetch.py --url "http://..." > /tmp/page.json # 分析 python3 scripts/ask.py \ --query "LockBit healthcare 2026" \ --mode ransomware \ --file /tmp/page.json ``` ### 场景 3:个人数据暴露检查 ``` python3 scripts/pipeline.py \ --query "john.smith@email.com personal data" \ --mode personal_identity \ --scrape 8 ``` ### 场景 4:手动分步调查 ``` # 1. 验证 Tor python3 scripts/check_tor.py # 2. 查找存活引擎 python3 scripts/check_engines.py # 3. 使用存活引擎搜索 python3 scripts/search.py \ --query "ransomware hospital 2026" \ --engines Ahmia Tor66 OSS \ --max 40 # 4. 抓取热门页面 python3 scripts/fetch.py --url "http://..." --links python3 scripts/fetch.py --url "http://..." # 5. 分析 python3 scripts/ask.py \ --query "hospital ransomware" \ --mode ransomware \ --content "combined text from pages" # 6. 完成后轮换身份 python3 scripts/renew.py ``` ## 分析模式 ### `threat_intel`(默认) 通用暗网 OSINT。提取内容:IoCs、基础设施详情、攻击者提及、后续调查步骤。 输出部分:输入查询 · 来源链接 · 调查工件 · 关键洞察 · 建议的后续步骤 ### `ransomware` 恶意软件/RaaS 情报。提取 C2 域名、文件哈希、MITRE ATT&CK TTPs、受害者行业、赎金金额。 输出部分:输入查询 · 来源链接 · 恶意软件/勒索软件指标 · 威胁行为者画像 · 关键洞察 · 建议的后续步骤 ### `personal_identity` PII 和泄露暴露。浮现 SSN、电子邮件、密码、护照数据、泄露来源、风险严重等级。 输出部分:输入查询 · 来源链接 · 暴露的 PII 工件 · 泄露/市场来源 · 暴露风险评估 · 关键洞察 · 建议的后续步骤 ### `corporate` 企业威胁情报。检测泄露的凭证、源代码、内部文档、初始访问经纪人活动。 输出部分:输入查询 · 来源链接 · 泄露的企业工件 · 威胁行为者/经纪人活动 · 业务影响评估 · 关键洞察 · 建议的后续步骤 ## 故障排除 **`✗ Tor NOT active`** ``` # Tor 是否正在运行? pgrep tor || tor & # 端口 9050 是否正在监听? ss -tlnp | grep 9050 ``` **`renew.py` → `success: false`** ``` # 控制端口是否开启? ss -tlnp | grep 9051 # 在 torrc 中启用它: echo "ControlPort 9051" >> /etc/tor/torrc echo "CookieAuthentication 1" >> /etc/tor/torrc systemctl restart tor # 在 .env 中设置正确的 DataDirectory: TOR_DATA_DIR=/var/lib/tor # system Tor (Debian/Ubuntu) TOR_DATA_DIR=/tmp/tor_data # custom torrc DataDirectory ``` **`fetch.py` → `status: 0`** 隐藏服务已离线。.onion 站点经常宕机 —— 尝试从 `search.py` 结果中选择不同的 URL。使用 `check_tor.py` 确认 Tor 状态正常。 **`search.py` 返回 0 个结果** 暗网索引波动较大。运行 `check_engines.py` 查找存活引擎,然后使用 `--engines Ahmia Ahmia-clearnet` 作为可靠的后备方案。 **`ask.py` / `pipeline.py` LLM 错误** 在 `.env` 中设置 `LLM_PROVIDER` 和 API key。无 key 本地运行:设置 `LLM_PROVIDER=ollama` 并运行 Ollama 实例。所有五个非 LLM 脚本(`check_tor`, `renew`, `check_engines`, `search`, `fetch`)无需任何 key 即可工作。 **`ERROR: sicry.py not found`** `sicry.py` 必须位于 OnionClaw™ 根目录(与 `SKILL.md` 同级文件夹)。它已包含在此仓库中 —— 请勿删除或移动。如果你克隆后发现缺失,请重新克隆。 ## 文件结构 ``` OnionClaw/ ├── SKILL.md ← OpenClaw skill descriptor (YAML frontmatter) ├── sicry.py ← SICRY engine (bundled — no separate install needed) ├── .env.example ← Copy to .env and configure ├── README.md ← This file └── scripts/ ├── check_tor.py ← Verify Tor / show exit IP ├── renew.py ← Rotate Tor circuit ├── check_engines.py ← Ping all 18 engines ├── search.py ← Search dark web ├── fetch.py ← Fetch .onion pages ├── ask.py ← OSINT analysis via LLM └── pipeline.py ← Full Robin investigation pipeline ``` ## 致谢 - 暗网搜索引擎列表和 Robin OSINT pipeline 来自 [@apurvsinghgautam](https://github.com/apurvsinghgautam) 的 [Robin](https://github.com/apurvsinghgautam/robin) — MIT 许可证 - 核心引擎:[SICRY](https://github.com/JacobJandon/Sicry) - .onion 地址验证通过 [dark.fail](https://dark.fail) - Agent 运行时:[OpenClaw](https://github.com/openclaw/openclaw) - 网络匿名化:[Tor Project](https://www.torproject.org/) ## 许可证 Apache 2.0 License — 版权所有 2026 JacobJandon "OnionClaw™" 名称和徽标归 JacobJandon 所有。Apache 2.0 许可证适用于本仓库中的所有源代码。详情请参见 [LICENSE](LICENSE)。
标签:AI风险缓解, Atomic Red Team, ESC4, IP 地址批量处理, .onion, OpenClaw, OSINT, Petitpotam, Python, Splunk, Tor, 勒索软件监控, 威胁情报, 实时处理, 开发者工具, 搜索引擎, 攻击路径可视化, 数据泄露检测, 无后门, 暗网, 洋葱路由, 网络安全, 网络安全, 身份轮换, 隐私保护, 隐私保护, 黑客工具