scorpiocodex/hexmind

GitHub: scorpiocodex/hexmind

HexMind 是一款基于本地大模型的 AI 渗透测试助手,通过异步编排八类侦察工具并结合 Mistral 智能体循环分析,实现完全离线的安全评估与漏洞情报关联。

Stars: 0 | Forks: 0

# ⬡ HexMind [![版本](https://img.shields.io/badge/version-v0.1.0--alpha-blue?style=flat-square)](https://github.com/scorpiocodex/hexmind/releases) [![Python](https://img.shields.io/badge/python-3.11%2B-blue?style=flat-square&logo=python&logoColor=white)](https://python.org) [![许可证](https://img.shields.io/badge/license-MIT-green?style=flat-square)](LICENSE) [![AI](https://img.shields.io/badge/AI-Ollama%20%2B%20Mistral-purple?style=flat-square)](https://ollama.com) [![状态](https://img.shields.io/badge/status-alpha-orange?style=flat-square)]() `Python 3.11+` · `Ollama + Mistral` · `SQLite` · `Rich TUI` · `MIT License` ## 功能 - **8个侦察运行器** 在异步并行层执行 (whois, dig, curl, nmap, whatweb, sslscan, nikto, gobuster) - **本地 AI 分析** 通过 Ollama + Mistral 实现 — 100% 离线,零数据离开您的机器 - **智能体循环** — AI 可以在分析过程中请求后续扫描,并收敛于发现的结果 - **完整的扫描历史** 存储在 SQLite 中的 5 个关联表内 (targets, scans, tool_results, findings, ai_conversations) - **报告导出** — Markdown、HTML、PDF (WeasyPrint) 和 JSON - **CVE 查询** 通过 CIRCL.lu + NVD 后备支持 (无需 API 密钥) - **网络搜索** 通过 DuckDuckGo 实现 (无需 API 密钥) - **扫描比较** — 对比任意两次扫描 ID 之间的发现差异 ## 前置条件 | 工具 | 安装 | 是否必需? | |------|---------|-----------| | Python 3.11+ | `sudo apt install python3.11` | 是 | | nmap | `sudo apt install nmap` | 是 | | whois | `sudo apt install whois` | 是 | | dig | `sudo apt install dnsutils` | 是 | | curl | `sudo apt install curl` | 是 | | whatweb | `sudo apt install whatweb` | 推荐 | | nikto | `sudo apt install nikto` | 推荐 | | sslscan | `sudo apt install sslscan` | 推荐 | | gobuster | `sudo apt install gobuster` | 可选 (深度配置) | | Ollama | `curl https://ollama.ai/install.sh \| sh` | 是 (AI 分析) | ## 安装 ``` git clone https://github.com/scorpiocodex/hexmind.git cd hexmind pip install -e . ollama pull mistral hexmind doctor ``` ## 使用方法 | 命令 | 描述 | |---------|-------------| | `hexmind scan ` | 使用标准配置运行完整扫描 | | `hexmind scan --profile quick` | 快速 2–5 分钟扫描 | | `hexmind scan --profile deep` | 包含 gobuster + 漏洞脚本的全面扫描 | | `hexmind scan --no-ai` | 仅侦察,跳过 AI 分析 | | `hexmind scan --tool nmap --tool whois` | 仅运行指定工具 | | `hexmind history` | 列出所有历史扫描 | | `hexmind history --target example.com` | 按目标筛选历史记录 | | `hexmind show ` | 显示指定扫描的发现结果 | | `hexmind report --format html` | 导出 HTML 报告 | | `hexmind report --format pdf` | 导出 PDF 报告 | | `hexmind report --format md` | 导出 Markdown 报告 | | `hexmind report --format json` | 导出 JSON 报告 | | `hexmind compare ` | 对比两次扫描的发现结果 | | `hexmind targets` | 列出所有已知目标 | | `hexmind search ` | DuckDuckGo 网络搜索 | | `hexmind search --cve` | CVE 详情查询 | | `hexmind doctor` | 检查所有依赖和系统健康状况 | | `hexmind --version` | 显示版本 | ### 输出示例 ``` hexmind scan scanme.nmap.org --profile quick ██╗ ██╗███████╗██╗ ██╗███╗ ███╗██╗███╗ ██╗██████╗ ██║ ██║██╔════╝╚██╗██╔╝████╗ ████║██║████╗ ██║██╔══██╗ ███████║█████╗ ╚███╔╝ ██╔████╔██║██║██╔██╗ ██║██║ ██║ ██╔══██║██╔══╝ ██╔██╗ ██║╚██╔╝██║██║██║╚██╗██║██║ ██║ ██║ ██║███████╗██╔╝ ██╗██║ ╚═╝ ██║██║██║ ╚████║██████╔╝ Target › scanme.nmap.org Profile › QUICK Scan ID › #0012 DB › ~/.hexmind/hexmind.db ─── RECON PHASE ─── [✓] whois 3.2s [✓] dig 0.8s [✓] nmap 4.1s ─── AI ANALYSIS ─── [✓] Pass 1/1 complete — 3 findings ``` ## 扫描配置 | 配置 | 工具 | AI 分析轮数 | 预计用时 | 适用场景 | |---------|-------|-----------|-----------|----------| | `quick` | nmap (快速) + whois + dig | 1 | 2–5 分钟 | 快速分类 | | `standard` | 除 gobuster 外的所有工具 | 2 | 15–30 分钟 | 默认渗透测试 (默认) | | `deep` | 所有工具 + 漏洞脚本 + gobuster | 3 | 60–120 分钟 | 完整测试 | | `stealth` | 低噪声定时,最小足迹 | 2 | 60–90 分钟 | 规避检测扫描 | ## 项目结构 ``` hexmind/ ├── ai/ # OllamaEngine, AgenticLoop, ContextBuilder, AIParser ├── core/ # ScanSession, RateLimiter, TargetValidator, exceptions ├── db/ # SQLAlchemy models, DatabaseManager, repositories ├── recon/ # 8 tool runners + ReconOrchestrator ├── reports/ # Jinja2 templates, ReportExporter, PDFRenderer ├── search/ # DuckDuckGoSearch, CVELookup ├── ui/ # Rich console, banner, panels, spinner ├── data/ │ └── wordlists/common.txt # 200-path gobuster wordlist ├── cli.py # Typer entry point ├── config.py # Pydantic settings └── constants.py # Colors, profiles, tool binaries, paths ``` ## 配置 配置文件:`~/.hexmind/config.toml` (首次运行时自动创建) 关键设置: ``` [ai] model = "mistral" base_url = "http://localhost:11434" [reports] output_dir = "~/hexmind-reports" [scan] default_profile = "standard" ``` ## 路线图 | 版本 | 阶段 | 描述 | |---------|-------|-------------| | 0.1.0 | Alpha | 核心脚手架、数据库层、所有运行器、AI 引擎、报告 ← **当前** | | 0.2.0 | Beta | Nuclei 集成、自定义插件运行器、限速配置 | | 0.3.0 | RC | Web UI (FastAPI + htmx)、团队工作区、共享发现数据库 | | 1.0.0 | Stable | 生产就绪版本、安装程序、文档站点 | | 2.0.0 | Stable | 批量扫描、CI/CD 集成、发现 API | | 3.0.0 | Stable | 计划任务、团队功能、云端可选 AI 后备 | ## 贡献 HexMind 正处于活跃的 Alpha 开发阶段。我们欢迎各种贡献、错误报告和功能请求。 1. Fork 本仓库 2. 创建一个功能分支:`git checkout -b feat/your-feature` 3. 提交您的更改:`git commit -m "feat: description"` 4. 推送并开启一个 Pull Request 在提交与扫描相关的更改之前,请先在 `scanme.nmap.org`(Nmap 的官方测试目标)上进行测试。 ## 法律声明 **请仅扫描您拥有或获得明确书面授权测试的系统。** HexMind 专为授权安全测试、CTF 竞赛和教育用途而设计。未经授权的扫描可能会违反《计算机欺诈和滥用法》(CFAA)、《计算机滥用法》以及您所在司法管辖区的相关法律。作者对任何滥用行为不承担任何责任。 ## 作者 由 [scorpiocodex](https://github.com/scorpiocodex) 构建 *HexMind v0.1.0-alpha — 使用 Python、Ollama 和大量 nmap 构建。*
标签:AI安全助手, AI风险缓解, API密钥扫描, CVE分析, DNS解析, GitHub, LLM评估, Mistral, Nmap, Ollama, Python, SQLite, SSL扫描, Whois, XSS, 反取证, 大模型安全, 安全报告生成, 安全评估, 实时处理, 密码管理, 富文本终端, 开源项目, 异步扫描, 插件系统, 搜索引擎优化词, 无后门, 无线安全, 本地化部署, 本地大模型, 漏洞情报, 目录爆破, 离线安全工具, 网络安全, 网络安全审计, 自动化渗透, 虚拟驱动器, 隐私保护