shrivastava67/Mitiphy-Lite

GitHub: shrivastava67/Mitiphy-Lite

一款轻量级自托管 OSINT 与威胁情报平台,在单 Python 进程中完成多源被动情报收集、知识图谱构建、风险评分和报告生成。

Stars: 0 | Forks: 0

# Mitiphy — Lite [![CI](https://github.com/mitiphy/mitiphy/actions/workflows/ci.yml/badge.svg)](https://github.com/mitiphy/mitiphy/actions/workflows/ci.yml) [![许可证:Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE) [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/) Mitiphy 接收任何标识符(电子邮件、用户名、电话、域名、IP、文件哈希、URL),并生成基于知识图谱、带有风险评分的签名报告。所有操作均在您的本地机器上运行。除非您主动选择共享,否则不会有任何数据外传。 本仓库实现了 [DESIGN-LITE.md](DESIGN-LITE.md) 中的 **Lite** 配置:单一 Python 进程,无需 Docker,目标内存占用约为 4–7 GB,磁盘占用约为 8 GB,安装时间约 5 分钟。 ## 快速开始 ### Linux / macOS ``` git clone https://github.com/mitiphy/mitiphy.git cd mitiphy ./install.sh ``` ### Windows (PowerShell) ``` git clone https://github.com/mitiphy/mitiphy.git cd mitiphy ./install.ps1 ``` ### 从 PyPI 安装(发布后) ``` pip install mitiphy mitiphy wizard ``` 安装后,启动分析流程: ``` mitiphy chat # interactive TUI # 或 mitiphy run --target evil@example.com # one-shot investigation # 或 mitiphy web # local web UI on :7331 ``` 报告将以 HTML、Markdown、JSON 格式(若安装了 `mitiphy[pdf]` 则包含签名的 PDF)生成并保存在 `~/.mitiphy/cases/CASE-XXXX/` 目录下。 ## Lite 配置的功能 - 自动检测目标类型(电子邮件、用户名、电话、域名、IP、URL、文件哈希)。 - 针对免费的公共数据源运行被动 OSINT 和威胁情报收集器: - **CISA KEV** — 已知被利用漏洞。 - **FIRST EPSS** — 漏洞利用概率评分。 - **OSV.dev** — 多生态系统漏洞数据库(涵盖 GHSA、PyPI、npm、Go、Rust 等)。 - **abuse.ch** — URLhaus、ThreatFox、MalwareBazaar、Feodo(延迟预热)。 - **MITRE ATT&CK + CAPEC + D3FEND** — 离线内置。 - **HIBP** — k-匿名性密码哈希范围查询(无需密钥,保护隐私)。 - **crt.sh** — 用于子域名枚举的证书透明度。 - **Wayback Machine** — 历史存档查询。 - **DNS / RDAP / WHOIS** — 域名情报。 - 将调查结果存储在嵌入式知识图谱和向量数据库中(若已安装则使用 KuzuDB + LanceDB;否则回退至 SQLite)。 - 计算可解释的 0–100 风险评分,每个组成部分均具有完整的来源追溯。 - 维护防篡改的仅追加审计链(采用带有由创世行锚定的哈希链的 SQLite WAL)。 - 生成 HTML、Markdown、JSON、MISP 事件、STIX 2.1 以及(可选)签名 PDF 格式的报告。 ## Lite 配置不包含的功能 这些是故意推迟的功能 —— 在准备好时可以升级至 Default 或 Full 配置: - 主动侦察二进制文件(subfinder、httpx、dnsx、testssl、wafw00f)。 - 自托管的 SearXNG 元搜索引擎。 - Memgraph + MAGE 高级图分析。 - Grafana / Loki / Prometheus 仪表板。 - Container runtime。 ## 模式 ``` mitiphy run Run a one-shot investigation against a target. mitiphy chat Interactive analyst TUI. mitiphy web Start the local web UI on :7331. mitiphy doctor Self-check: DBs, model, feeds, quotas, audit chain. mitiphy wizard First-run interactive setup. mitiphy demo End-to-end smoke test against bundled fixtures. mitiphy report Re-render a saved case as HTML/MD/JSON. mitiphy explain Show the score breakdown for a saved case. mitiphy replay Re-run a saved case against current feeds. mitiphy authorize Manage authorized_targets.yml (for higher profiles). mitiphy upgrade Re-run preflight + dep sync + migrations + doctor. ``` ## 安全默认设置 - 默认**禁用**主动扫描(并且在 Lite 版本中不存在)。更高级别的配置需要同时具备 `--authorized` 参数和已签名的 `authorized_targets.yml` 条目。 - 针对个人的目标检测会触发同意提示;确认信息会被哈希化并记录到审计链中。 - SQLite 中硬性的 API 配额计数器 —— 操作会拒绝执行,而不是意外超限进入付费层级。 - **零出站遥测**,通过针对出站白名单的 CI 测试进行断言。 - 首次运行时必须确认 AUP;确认信息将与 AUP 修订版的哈希值一起记录。 有关可接受使用政策,请参阅 [AUP.md](AUP.md)。 ## 资源预算 | 指标 | Default (8B Q4 模型) | Fast (`--model fast`, 3B Q4) | Headless (无 LLM, `--llm none`) | | ------------------------- | --------------------- | ---------------------------- | ------------------------------- | | 内存 | ~7 GB | ~4 GB | ~500 MB | | 磁盘 | ~8 GB | ~5 GB | ~150 MB | | 安装时间 | ~5 分钟 | ~3 分钟 | <30 秒 | | CPU | AVX2 x86_64 或 arm64 | 同上 | 任意 | | GPU | 可选 | 可选 | 不适用 | Headless 模式适用于 CI、批处理任务以及不需要自然语言摘要的物理隔离侦察环境。 ## 架构 ``` ┌────────────────────────────────────────────────────────────┐ │ Frontends │ │ CLI · Rich TUI · Static UI on :7331 · REST + WebSocket │ └──────────────────────────┬─────────────────────────────────┘ ▼ ┌─────────────────────────┐ │ AI Brain (optional) │ │ Planner + Schema guard │ │ RAG over evidence │ └────────────┬────────────┘ ▼ ┌─────────────────────────┐ │ asyncio in-proc bus │ └────────────┬────────────┘ ▼ Passive · Identity · Code/Secret · Feeds · Reputation ▼ Normalize + Dedup + Metadata-strip ▼ Enricher (ATT&CK / KEV / EPSS) ▼ Graph (KuzuDB | SQLite) + Vector (LanceDB | SQLite) ▼ Scorer (0–100, explainable) ▼ Reporter + Sign + Audit chain ``` ## 仓库布局 ``` mitiphy-Lite/ ├── mitiphy/ # Python package │ ├── core/ # Target, bus, plugin ABC, config │ ├── brain/ # Planner + schema guard + RAG │ ├── collectors/ # Plugins (passive / identity / feeds) │ ├── enrich/ # ATT&CK + KEV/EPSS + reputation │ ├── graph/ # Embedded graph backend │ ├── score/ # Risk scorer │ ├── report/ # HTML / MD / JSON / MISP / STIX / PDF │ ├── audit/ # Tamper-evident chain │ ├── frontends/ # CLI / TUI / FastAPI server │ ├── safety/ # AUP / consent / quota / authorized │ ├── llm/ # llama.cpp + stub adapter │ ├── storage/ # SQLite + adapters │ ├── ops/ # doctor / wizard / bootstrap / demo │ └── data/ # Bundled ATT&CK snapshot + fixtures ├── tests/ # pytest suite ├── scripts/ # installer support ├── docs/ # extended docs ├── web/ # static UI served by core ├── install.sh # Linux/macOS bootstrap ├── install.ps1 # Windows bootstrap ├── DESIGN-LITE.md # design document ├── AUP.md # acceptable-use policy ├── LICENSE # Apache-2.0 └── pyproject.toml ``` ## 开发 ``` git clone https://github.com/mitiphy/mitiphy.git cd mitiphy python -m venv .venv . .venv/bin/activate # on Windows: .venv\Scripts\activate pip install -e ".[dev]" pytest # run the test suite ruff check . # lint mypy mitiphy # type check ``` ## 升级至 Default 或 Full Lite 安装可以在不丢失数据的情况下升级: ``` ./install.sh --profile default # adds Docker + SearXNG + active recon binaries ./install.sh --profile full # adds Memgraph + observability stack ``` `~/.mitiphy/` 中的状态(审计链、KuzuDB、LanceDB、案件)将被保留。 ## 许可证 Apache 2.0 —— 详见 [LICENSE](LICENSE)。 ## 致谢 本项目建立在开源安全社区的基石之上,它们是:NVD、CISA、FIRST EPSS、abuse.ch、MITRE、OSV.dev、证书透明度项目(certificate-transparency project)、互联网档案馆(Internet Archive)、sherlock/maigret/holehe/theHarvester/phoneinfoga 的维护者,以及 Python 和 llama.cpp 生态系统。 ## 免责声明 Mitiphy 按“原样”提供,用于防御性安全和授权的 OSINT 工作。维护者对任何滥用行为不承担责任。请参阅 [AUP.md](AUP.md)。
标签:GitHub, Python, 代码示例, 威胁情报, 实时处理, 开发者工具, 数据分析, 无后门, 网络安全, 自托管, 计算机取证, 逆向工具, 隐私保护