enclozedy/visionsec
GitHub: enclozedy/visionsec
一款开源自托管威胁情报平台,集域名监控、代码泄露扫描、暴露面检测等功能于一体,帮助安全团队全面感知外部攻击面。
Stars: 1 | Forks: 0
# 🛡️ VisionSec
### 开源自托管威胁情报平台
监控域名、检测钓鱼、扫描代码泄露、检查数据泄露并评估您的攻击面 —— 尽在一个自托管平台。
`docker compose up -d` → 搞定。
[](https://opensource.org/licenses/MIT)
[](https://golang.org)
[](https://reactjs.org)
[](https://www.postgresql.org)
[](https://www.docker.com)
[](CONTRIBUTING.md)
## ✨ 功能
| 模块 | 功能描述 | 所需 API Keys |
|--------|-------------|:---:|
| 🔍 **域名监控** | 追踪新子域名、SSL 证书、DNS 变更 | 可选 (VirusTotal) |
| 🔑 **代码泄露扫描器** | 在 GitHub 仓库中查找泄露的密钥 | GitHub Token |
| 📱 **应用监控** | 在 Google Play 中检测伪造/克隆应用 | 免费 |
| 🛡️ **公开暴露扫描器** | 通过 Shodan/Censys 查找开放端口和服务 | Shodan (免费版) |
| 📊 **勒索软件防御准备度** | 为您的组织的勒索软件防御准备度评分 | 免费 |
| 📧 **邮件威胁情报** | SPF/DKIM/DMARC 检查、钓鱼 URL 检测 | 免费 |
| 👤 **账号数据泄露扫描器** | 检查邮箱的数据泄露与外泄情况 | 可选 (Hunter.io) |
| 🤖 **Telegram Bot** | 通过 Telegram 接收实时警报 | Bot Token |
**所有模块均为可选。** 仅从核心(API + UI + DB)开始,按需添加模块。
## 🚀 快速开始
### 前置条件
- [Docker](https://docs.docker.com/get-docker/) + Docker Compose v2
- 仅此而已。
### 60 秒安装
```
git clone https://github.com/VisionSec/visionsec.git
cd visionsec
cp .env.example .env
# 生成安全 secrets
sed -i.bak "s/changeme/$(openssl rand -hex 32)/g" .env && rm .env.bak
# 启动
docker compose up -d
```
**前端:** http://localhost:3000
**API:** http://localhost:8080
**API 文档:** http://localhost:8080/health
## 🏗️ 架构
```
┌──────────────────────────────────┐
│ Browser (React SPA) │
│ :3000 (nginx) │
└──────────────┬───────────────────┘
│ HTTP API
┌──────────────▼───────────────────┐
│ Go API Server │
│ :8080 (Chi router) │
│ Auth · RBAC · Rate Limiting │
│ Audit Log · Prometheus Metrics │
└──────┬───────────────┬───────────┘
│ │
┌────────────▼──┐ ┌───────▼────────────┐
│ PostgreSQL │ │ Worker Modules │
│ :5432 │ │ (Python / Go) │
│ │ │ │
│ • Clients │ │ • Repo Monitor │
│ • Incidents │ │ • Domain Scanner │
│ • Domains │ │ • App Monitor │
│ • Reports │ │ • Exposure Scanner │
│ • Audit Logs │ │ • Email Intel │
└───────────────┘ └─────────────────────┘
```
### 技术栈
| 层级 | 技术 |
|-------|-----------|
| **后端** | Go 1.24 · Chi router · sqlx · JWT · RBAC |
| **前端** | React 18 · TypeScript · Vite · Tailwind CSS |
| **数据库** | PostgreSQL 15 |
| **Worker** | Python 3.12 · aiohttp · asyncio |
| **基础设施** | Docker · docker-compose · nginx |
| **监控** | Prometheus · `/metrics` endpoint |
## 📁 项目结构
```
visionsec/
├── docker-compose.yml # One command to rule them all
├── .env.example # All config, zero secrets
├── Makefile # build · up · down · test · clean
│
├── backend/ # Go API server
│ ├── cmd/
│ │ ├── api/ # Main API entry point
│ │ └── seed/ # Database seeder
│ ├── internal/
│ │ ├── domain/ # Core domain models
│ │ ├── handler/http/ # HTTP handlers + middleware
│ │ ├── repository/ # PostgreSQL repositories
│ │ └── usecase/ # Business logic
│ ├── migrations/ # SQL migrations (auto-run)
│ ├── modules/ # Optional worker modules
│ │ ├── repo-monitor/ # GitHub code exposure
│ │ ├── telegram-bot/ # Alert notifications
│ │ ├── visionsec-domains/ # Domain monitoring
│ │ └── social-media-monitor/
│ ├── pkg/ # Shared Go packages
│ └── test/ # Integration tests
│
└── frontend/ # React SPA
├── src/
│ ├── lib/ # API client, utilities
│ ├── components/ # Reusable UI components
│ ├── pages/ # Route pages
│ └── integrations/ # API integrations
└── public/
```
## ⚙️ 配置
所有设置均通过环境变量进行。复制 `.env.example` → `.env` 并进行自定义。
### 核心设置
| 变量 | 描述 | 默认值 |
|----------|-------------|---------|
| `DB_USER` | PostgreSQL 用户 | `visionsec` |
| `DB_PASSWORD` | PostgreSQL 密码 | `changeme` ⚠️ |
| `DB_NAME` | 主数据库名称 | `visionsec_prod` |
| `JWT_SECRET` | JWT 签名密钥 | `changeme` ⚠️ |
| `ADMIN_API_KEY` | 管理员 API key | `changeme` ⚠️ |
| `CORS_ALLOWED_ORIGINS` | 允许的 CORS 源 | `http://localhost:3000` |
### 可选 API Keys(留空则跳过该模块)
| 变量 | 服务 | 免费层级 |
|----------|---------|:---------:|
| `VIRUSTOTAL_API_KEY` | VirusTotal(域名信誉) | ✅ |
| `SHODAN_API_KEY` | Shodan(端口扫描) | ✅ |
| `CENSYS_API_ID` + `CENSYS_API_SECRET` | Censys(暴露面扫描) | ✅ |
| `HUNTER_API_KEY` | Hunter.io(邮件发现) | 有限 |
| `GITHUB_TOKEN` | GitHub(代码泄露扫描) | ✅ |
| `TELEGRAM_BOT_TOKEN` | Telegram(通知) | ✅ |
## 🔌 添加 Worker 模块
Worker 是连接到同一个数据库的独立服务。只需启动您需要的服务:
```
# 示例:启动 Repo Monitor(GitHub 代码泄露扫描器)
cd backend/modules/repo-monitor
cp requirements.txt .
pip install -r requirements.txt
python worker.py
```
`backend/modules/` 中的每个模块都有各自的 README 以及设置说明。
## 🧪 开发
```
# Backend(热重载)
cd backend
go run ./cmd/api
# Frontend(Vite 开发服务器)
cd frontend
npm install
npm run dev
# 运行所有测试
make test
# Database shell
docker compose exec postgres psql -U visionsec -d visionsec_prod
```
### Makefile 目标
| 命令 | 操作 |
|---------|--------|
| `make build` | 构建所有 Docker 镜像 |
| `make up` | 启动所有服务(后台运行) |
| `make down` | 停止所有服务 |
| `make logs` | 滚动查看服务日志 |
| `make test` | 运行后端 + 前端测试 |
| `make clean` | 移除容器 + 数据卷 |
## 📡 API 概览
| 方法 | Endpoint | 描述 |
|--------|----------|-------------|
| `GET` | `/health` | 健康检查 |
| `POST` | `/api/v1/auth/register` | 注册新用户 |
| `POST` | `/api/v1/auth/login` | 登录 → 获取 JWT token |
| `GET` | `/api/v1/clients` | 列出客户 |
| `POST` | `/api/v1/clients` | 创建客户 |
| `GET` | `/api/v1/incidents` | 列出事件 |
| `POST` | `/api/v1/domains/scan` | 触发域名扫描 |
| `POST` | `/api/v1/public-exposure/scan` | Shodan 暴露面扫描 |
| `GET` | `/metrics` | Prometheus 指标 |
完整 API 文档:请查看 [`backend/internal/handler/http/router.go`](backend/internal/handler/http/router.go) 了解所有路由。
## 🗺️ 路线图
- [x] 包含 RBAC + JWT 认证的核心 API
- [x] 域名监控 worker
- [x] 代码泄露扫描器 (GitHub)
- [x] 公开暴露扫描器 (Shodan/Censys)
- [x] 勒索软件防御准备度评分
- [x] 邮件威胁情报
- [x] Prometheus 指标
- [x] Docker Compose 一键部署
- [ ] 用于自定义扫描器的 Plugin SDK
- [ ] AI 驱动的事件分类处理
- [ ] Slack/Discord 通知
- [ ] 多租户支持
- [ ] GraphQL API
请查看 [项目](https://github.com/VisionSec/visionsec/projects) 获取详细的追踪信息。
## 📜 License
[MIT](LICENSE) —— 随意使用,只需别起诉我们。标签:CISA项目, Docker, Go, React, Ruby工具, StruQ, Syscalls, 信息泄露监测, 威胁情报, 安全防御评估, 开发者工具, 日志审计, 测试用例, 自动化攻击, 自定义请求头, 请求拦截, 逆向工具, 钓鱼检测