faseehfawaz/outpost
GitHub: faseehfawaz/outpost
一个自动化反钓鱼威胁情报流水线,通过监控公开钓鱼数据源、抓取并静态分析暴露的源码压缩包来提取数据外发渠道,聚类关联攻击者并自动发起滥用举报。
Stars: 0 | Forks: 0
```
██████╗ ██╗ ██╗████████╗██████╗ ██████╗ ███████╗████████╗
██╔═══██╗██║ ██║╚══██╔══╝██╔══██╗██╔═══██╗██╔════╝╚══██╔══╝
██║ ██║██║ ██║ ██║ ██████╔╝██║ ██║███████╗ ██║
██║ ██║██║ ██║ ██║ ██╔═══╝ ██║ ██║╚════██║ ██║
╚██████╔╝╚██████╔╝ ██║ ██║ ╚██████╔╝███████║ ██║
╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═╝
```
**一个持续运行的钓鱼工具包情报 pipeline。**
追踪工具包。剖析代码。锁定攻击者。提交封禁。
[](https://python.org) [](https://fastapi.tiangolo.com) [](https://postgresql.org) [](https://docker.com) [](LICENSE) [](tests/) [](docs/SCOPE_AND_ETHICS.md)
[实时仪表盘](https://outpost.heapleap.tech) · [API 参考](https://outpost.heapleap.tech/docs) · [道德政策](docs/SCOPE_AND_ETHICS.md)
## 功能介绍
大多数威胁情报工具的检测仅停留在 URL 层面。Outpost 则更进一步。
它全天候监控公开的钓鱼数据源,当一个网站被判定为确凿的钓鱼网站时,它会检查攻击者是否犯了一个常见的错误——将他们的源码压缩包留在了开放目录中。如果发现了这种疏漏,它会抓取该 zip 文件,将其密封在一个无网络环境的 sandbox 中,并静态读取每一个 PHP 文件,以准确找出被盗凭证的发送目的地:Telegram bot、Discord webhook 或个人电子邮件地址。
随后,这些数据外发 (exfil) 渠道会被计算哈希值,与我们见过的所有其他工具包进行聚类分析,并与威胁行为者 (threat actor) 的档案进行关联。经过脱敏处理的 IOC 源将对外公开。滥用报告则会发送给主机托管商、域名注册商以及相关平台。攻击者的基础设施将不断被削弱。
## Pipeline
```
PUBLIC FEEDS INGEST TRIAGE
┌──────────────┐ ┌─────────┐ ┌──────────────┐
│ URLhaus │ │ │ │ Is it live? │
│ OpenPhish │──────────│Normalize│──────────▶│ Brand match? │
│ CT Logs │ │ Dedupe │ │ Score 0-100 │
│ GitHub Lists │ │ Enqueue │ └──────┬───────┘
└──────────────┘ └─────────┘ │
│ score ≥ 50
▼
ACTOR GRAPH KIT HUNTER ANALYZER SANDBOX
┌──────────────┐ ┌──────────────┐ ┌──────────────────┐
│ Cluster by │ │ Open dir? │ │ --network none │
│ fingerprint │◀─────────│ *.zip probe │──────▶│ non-root user │
│ & token hash │ │ Log files │ │ read-only fs │
│ → Actor card │ └──────────────┘ │ static PHP read │
└──────┬───────┘ └──────────────────┘
│
▼
TAKEDOWN ENGINE DASHBOARD IOC FEED
┌──────────────┐ ┌──────────────┐ ┌──────────────────┐
│ RDAP lookup │ │ Live phish │ │ Telegram tokens │
│ Host report │ │ Actor cards │──────▶│ Discord webhooks │
│ Registrar │ │ Real-time │ │ Email drops │
│ Telegram │ │ IOC feed │ │ (all redacted) │
│ GSB / APWG │ └──────────────┘ └──────────────────┘
└──────────────┘
```
## 五大子系统
每个子系统均可独立运行,并拥有专属的测试覆盖率。它们通过 `SELECT FOR UPDATE SKIP LOCKED` 协调共享同一个 Postgres 队列——无需任何 message broker。
[](https://python.org) [](https://fastapi.tiangolo.com) [](https://postgresql.org) [](https://docker.com) [](LICENSE) [](tests/) [](docs/SCOPE_AND_ETHICS.md)
[实时仪表盘](https://outpost.heapleap.tech) · [API 参考](https://outpost.heapleap.tech/docs) · [道德政策](docs/SCOPE_AND_ETHICS.md)
**`01 · Ingest`** — 每个周期从五个公开来源提取候选 URL。包括 URLhaus 滥用报告、OpenPhish 社区源、证书透明度日志 (Certificate Transparency logs,通过品牌关键词过滤)、urlscan.io,以及精心整理的 GitHub 社区列表。按 URL 哈希进行去重,并在源头进行速率限制。 **`02 · Triage`** — 逐个访问候选 URL。检查页面是否存活,读取 HTML 以识别品牌仿冒(如 PayPal、Apple、Emirates NBD 等),提取登录表单结构,对 favicon 和 logo 进行感知哈希 (perceptual-hashes) 处理,并生成 0–100 的置信度得分。任何得分高于 50 的页面都会进入下一环节。 **`03 · Kit Hunter`** — 针对已确认的钓鱼 URL,向上遍历目录树以查找暴露的工具包压缩文件。它只检查一个简短的固定名称列表——不进行 fuzzing,也不使用 wordlists。如果发现 `.zip` 文件,它会校验文件魔数 (magic),将其下载并存储到 Cloudflare R2 中,同时记录其 SHA256 值。 **`04 · Analyzer`** — 在经过严格安全加固的 Docker 容器(`--network none`,非 root 用户,只读文件系统,30 秒超时限制)内解压该压缩包。静态读取每一个 PHP 文件,以提取数据外发 (exfil) 渠道(Telegram token、Discord webhook、SMTP 凭证、exfil URL)。使用 TLSH 计算每个文件的归一化 token 哈希,以实现模糊相似度匹配——这种方式在面对简单的代码混淆和变量重命名时依然保持稳定。 **`05 · Fingerprint & Takedown`** — 基于文件哈希集合的 Jaccard 相似度以及共享的 exfil token 对工具包进行聚类。生成威胁行为者档案。起草并向主机托管商、域名注册商及相关平台(Telegram、Google Safe Browsing、APWG eCrime Exchange)发送滥用举报。 ## 快速开始 ### 前置条件 - Python 3.12+ - Docker & Docker Compose - PostgreSQL 16(或通过 Compose 运行) ### 设置 ``` git clone https://github.com/yourusername/outpost.git cd outpost # 创建虚拟环境 uv venv .venv --python 3.12 uv pip install -e ".[dev]" --python .venv/bin/python # 复制并填写环境文件 cp .env.example .env # 启动 Postgres docker compose up -d db # 应用 schema 并注册 feed sources pkintel db migrate pkintel db seed ``` ### 运行 Pipeline ``` # 运行每个 stage 一次 pkintel run ingest pkintel run triage pkintel run kithunt pkintel run analyze pkintel run cluster pkintel run takedown # 或者在连续循环中运行所有内容(每 30 秒) pkintel run all --loop --interval 30 ``` ### 启动 API 和 Dashboard ``` # Terminal 1 — backend API uvicorn pkintel.api.app:app --host 0.0.0.0 --port 8000 # Terminal 2 — pipeline loop pkintel run all --loop --interval 30 ``` 打开 **`http://localhost:8000`** —— Dashboard 直接由 API 提供服务。 ## API 参考 FastAPI 后端会在 `/docs` (Swagger UI) 和 `/redoc` 自动生成文档。 | 方法 | Endpoint | 描述 | |--------|----------|-------------| | `GET` | `/api/feeds/stats` | Pipeline 汇总数据:URL、钓鱼网站、工具包、行为者、封禁数量 | | `GET` | `/api/feeds/live` | 当前存活的钓鱼 URL | | `GET` | `/api/feeds/recent` | 最近经过分拣的 50 个 URL | | `GET` | `/api/actors` | 所有已识别的威胁行为者档案 | | `GET` | `/api/actors/{id}` | 单个行为者及其关联的工具包列表 | | `GET` | `/api/ioc` | 脱敏的 IOC 源(可按类型、日期过滤) | | `GET` | `/health` | 健康检查 | | `GET` | `/metrics` | Prometheus 指标 | ## 项目结构 ``` outpost/ ├── src/pkintel/ │ ├── ingest/ # Feed adapters (URLhaus, OpenPhish, CT, GitHub, urlscan) │ ├── triage/ # Brand detection, favicon hash, form analysis, scoring │ ├── kithunter/ # Open-dir detection, zip probing, log sighting │ ├── analyzer/ # Static PHP analysis, indicator extraction, TLSH inventory │ ├── fingerprint/ # Similarity metrics, union-find clustering, actor graph │ ├── takedown/ # RDAP enrichment, abuse report templates, email dispatch │ ├── api/ # FastAPI app + routes (actors, ioc, feeds) │ ├── cli/ # Typer CLI entry point │ ├── config.py # All settings via environment variables │ ├── db.py # SKIP LOCKED queue primitives │ ├── models.py # Pydantic data models │ ├── redact.py # Single path from raw indicator to public string │ └── storage.py # Cloudflare R2 / S3 object store ├── analyzer_container/ # Hardened Docker sandbox for kit analysis ├── frontend/ # Static dashboard (HTML / CSS / JS) ├── db/migrations/ # SQL schema (14 tables) ├── tests/ # 107 tests, 0 network calls ├── ops/ # Prometheus scrape config ├── terraform/ # OCI + Cloudflare infrastructure as code ├── .github/workflows/ # CI (lint + test) and CD (build + deploy) └── docs/ └── SCOPE_AND_ETHICS.md ``` ## 测试 ``` pytest tests/ -v ``` ``` tests/test_analyzer.py ...... (6) safe_extract, deobfuscate tests/test_fingerprint.py ....... (23) similarity, clustering, union-find tests/test_ingest.py ....... (47) all feed adapters, normalization tests/test_kithunter.py ...... (6) paths, open-dir, archive detection tests/test_redact.py .. (2) redaction, hashing tests/test_takedown.py ..... (5) RDAP, templates tests/test_triage.py ...... (18) brand, score, forms, favicon 107 passed in 0.31s ``` 没有任何测试会发起网络调用。所有外部依赖均已被 mock。 ## 部署说明 部署在 **`outpost.heapleap.tech`**(并托管于 [Render](https://outpost-27sb.onrender.com)),使用以下服务: | 层级 | 服务 | 成本 | |-------|---------|------| | Frontend & API | [Render](https://render.com) (Web Service) | 免费 | | 数据库 | [Neon](https://neon.tech) (Serverless PostgreSQL) | 免费 | | Pipeline Workers | [GitHub Actions](https://github.com) (Scheduled Cron Runner) | 免费 | | 工具包存储 | [Supabase Storage](https://supabase.com) (兼容 S3 的 bucket) | 免费 | 请参阅 [`docs/DEPLOY.md`](docs/DEPLOY.md) 中的部署指南以了解架构详情。 ## 道德与法律 这是一个**被动的研究工具**。五条硬性规定直接在代码中强制执行,而不仅停留在政策层面: | 规则 | 执行方式 | |------|--------------------| | 绝不执行工具包 | Analyzer 在 `--network none` 容器中运行,仅进行纯静态读取 | | 绝不使用提取到的 token | 没有任何代码路径会向提取出的指标发起外部请求 | | 绝不保留受害者凭证 | Kit hunter 仅存储日志文件的 SHA256 和字节数,随后即删除 | | 对外发布内容一律脱敏 | `redact.py` 是将原始数据转换为任何对外可见字符串的唯一路径 | | 仅进行被动收集 | `http.py` 按主机进行限流;使用固定的候选列表,无 wordlists | 阅读完整政策:[`docs/SCOPE_AND_ETHICS.md`](docs/SCOPE_AND_ETHICS.md) ## 技术栈 | 组件 | 技术 | |-----------|-----------| | 语言 | Python 3.12 | | Web 框架 | FastAPI + Uvicorn | | 队列 / 数据库 | PostgreSQL 16 (`SKIP LOCKED`) | | HTTP Client | HTTPX (异步、速率限制) | | 压缩包安全性 | 自定义 zip-slip / tar-slip / 炸弹防护 | | 模糊哈希 | TLSH | | 聚类分析 | Jaccard 相似度 + Union-Find | | Frontend | 原生 HTML / CSS / JS | | 基础设施 | Docker Compose, Terraform (OCI + Cloudflare) | | 可观测性 | Prometheus + Grafana | | CI/CD | GitHub Actions |
**为前沿而生,而非困于边界。**
*仅用于被动研究 —— 请参阅 [`docs/SCOPE_AND_ETHICS.md`](docs/SCOPE_AND_ETHICS.md)*
标签:AV绕过, FastAPI, Python, 威胁情报, 开发者工具, 数据泄露防护, 无后门, 测试用例, 滥用举报, 网络探测, 网络测绘, 自动化分析, 自定义请求头, 请求拦截, 跨站脚本, 逆向工具, 钓鱼工具包