Omjee73/Vulnerability_Scanner
GitHub: Omjee73/Vulnerability_Scanner
一个基于微服务架构、集成 19+ 开源工具的 Docker 化企业级漏洞扫描平台,实现自动化探测、实时日志与可视化报告。
Stars: 0 | Forks: 0
# 🛡️ Cystar 漏洞扫描器
**Enterprise-grade automated vulnerability scanner with AI-powered reconnaissance, 19+ security tools, real-time streaming, and a 6-layer microservices architecture.**
[](https://python.org)
[](https://react.dev)
[](https://typescriptlang.org)
[](https://docs.docker.com/compose/)
[](https://mongodb.com)
[](https://docs.celeryq.dev)
[](LICENSE)
[Features](#-features) · [Architecture](#-architecture) · [Quick Start](#-quick-start) · [Endpoints](#-api-endpoints) · [Tools](#-security-tools-19)
## 📋 目录
- [Features](#-features)
- [Architecture](#-architecture)
- [Complete Folder Structure](#-complete-folder-structure)
- [Layer-by-Layer Breakdown](#-layer-by-layer-breakdown)
- [Layer 1 — Presentation](#layer-1--presentation-react--nginx)
- [Layer 2 — API Gateway](#layer-2--api-gateway-flask)
- [Layer 3 — Processing](#layer-3--processing-celery)
- [Layer 4 — Scanning Engine](#layer-4--scanning-engine-hexstrike)
- [Layer 5 — Intelligence (Disabled)](#layer-5--intelligence-disabled)
- [Layer 6 — Data Layer](#layer-6--data-layer-mongodb--redis)
- [Security Tools (19+)](#-security-tools-19)
- [API Endpoints](#-api-endpoints)
- [Scan Workflow](#-scan-workflow)
- [Quick Start](#-quick-start)
- [Docker Registry (ghcr.io)](#-docker-registry-ghcrio)
- [Environment Variables](#-environment-variables)
- [Frontend Pages & Components](#-frontend-pages--components)
- [Database Schema](#-database-schema)
- [Nginx Reverse Proxy](#-nginx-reverse-proxy)
- [Troubleshooting](#-troubleshooting)
## ✨ 特性
- **19+ Security Tools** — subfinder, nuclei, httpx, nmap, naabu, masscan, nikto, ffuf, dirsearch, whatweb, dnsx, tlsx, testssl, wafw00f, gobuster, sqlmap, wpscan, curl, gau, waybackurls, dig
- **AI-Powered Analysis** — Automatic target classification, risk scoring (0–100), attack vector identification, optimal tool selection per target
- **Real-Time Streaming** — Server-Sent Events (SSE) push live scan logs to a terminal UI as tools execute
- **3 Scan Modes** — HexStrike AI (full), Levelwise Parallel, Ultra-Fast
- **Parallel Execution** — 10 concurrent subdomain scans, each running 8–14 tools simultaneously
- **Subdomain Discovery** — Subfinder (recursive + all sources) + DNS wordlist expansion
- **PDF Export** — Download scan results as formatted PDF reports
- **Asset Management** — Track companies, domains, IPs, and endpoints
- **JWT Auth + OTP** — Email-based OTP verification, password reset, session cookies
- **Rate Limiting** — Redis-backed sliding-window rate limiter on auth endpoints
- **6 Color Themes** — Blue, Green, Purple, Red, Gray, Black
- **Analytics Dashboard** — Scan trends, severity distribution, vulnerability counts via Recharts
- **Docker-First** — Single `docker compose up --build` deploys everything
## 🏗 架构
```
┌──────────────────────────────────────────────────────────────────────────┐
│ CYSTAR VULNERABILITY SCANNER │
│ 6-Layer Microservices Architecture │
└──────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────┐
│ Layer 1: PRESENTATION │
│ ┌─────────────────────────────────────────────────────────────────┐ │
│ │ React 19 + TypeScript + Vite 6 + TailwindCSS │ │
│ │ Built → static assets → served by Nginx on :80 │ │
│ │ Reverse proxy: /api/ /auth/ /rescan/ → api-gateway:4000 │ │
│ └─────────────────────────────────────────────────────────────────┘ │
└────────────────────────────────┬────────────────────────────────────────┘
│ HTTP / SSE
┌────────────────────────────────▼────────────────────────────────────────┐
│ Layer 2: API GATEWAY │
│ ┌─────────────────────────────────────────────────────────────────┐ │
│ │ Flask 2.2 + Gunicorn (4 workers) on :4000 │ │
│ │ JWT Auth (cookies) │ Rate Limiting │ CORS │ Flask-Mail │ │
│ │ Routes: auth, scans, assets, results, stats │ │
│ │ Dispatches Celery tasks │ Direct SSE streaming │ │
│ └──────────┬───────────────────────────────┬──────────────────────┘ │
└─────────────┼───────────────────────────────┼──────────────────────────-─┘
│ Celery Tasks │ Direct HTTP
┌─────────────▼─────────────────┐ ┌──────────▼──────────────────────────┐
│ Layer 3: PROCESSING │ │ Layer 4: SCANNING ENGINE │
│ ┌───────────────────────┐ │ │ ┌────────────────────────────┐ │
│ │ Celery Worker (4 conc) │ │ │ │ Flask + Gunicorn on :8888 │ │
│ │ Celery Beat (scheduler)│ │ │ │ 19+ security tools │ │
│ │ HexStrikeManager │─────┼──│→ │ AI analysis engine │ │
│ │ Redis log streaming │ │ │ │ Tool orchestration │ │
│ └───────────────────────┘ │ │ │ Parallel execution (8 thr) │ │
└────────────────────────────────┘ │ └────────────────────────────┘ │
└────────────────────────────────────-─┘
│ │
┌─────────────▼────────────────────────────────▼──────────────────────────┐
│ Layer 6: DATA LAYER │
│ ┌──────────────────────┐ ┌───────────────────────────────────────┐ │
│ │ MongoDB 7.0 on :27017│ │ Redis 7 (Alpine) on :6379 │ │
│ │ DB: subdomain_scanner│ │ Celery broker (db 0) │ │
│ │ 6 collections │ │ Celery results (db 1) │ │
│ │ Indexed for perf │ │ SSE log streaming │ │
│ └──────────────────────┘ │ Rate limiting counters │ │
│ └───────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────────┘
```
### 服务连接图
```
Browser (:80)
│
├── Static Assets ──→ Nginx (presentation container)
│
├── /api/* ──────────→ Nginx proxy ──→ api-gateway (:4000)
│ │
│ ├── MongoDB (reads/writes scans, users, assets)
│ ├── Redis (rate limiting, SSE log reads)
│ │
│ ├── [Celery Task] ──→ celery-worker
│ │ │
│ │ ├── HexStrikeManager HTTP Client
│ │ │ └── scanning-engine (:8888)
│ │ │ ├── subfinder, nuclei, httpx...
│ │ │ └── 19+ tools in parallel
│ │ │
│ │ ├── MongoDB (store results)
│ │ └── Redis (push SSE logs)
│ │
│ └── [Direct SSE] ──→ scanning-engine (:8888)
│
├── /auth/* ─────────→ Nginx proxy ──→ api-gateway (:4000)
│
└── /rescan/* ───────→ Nginx proxy ──→ api-gateway (:4000) ──→ SSE stream
```
### Docker Compose 服务
| # | Service | Container Name | Port | Image | Role |
|---|---------|---------------|------|-------|------|
| 1 | `presentation` | cystar-frontend | **80** | node:22 → nginx:1.27 | React SPA + Nginx reverse proxy |
| 2 | `api-gateway` | cystar-api-gateway | **4000** | python:3.12-slim | Flask REST API + JWT auth |
| 3 | `celery-worker` | cystar-celery-worker | — | python:3.12-slim | Async scan task execution |
| 4 | `celery-beat` | cystar-celery-beat | — | python:3.12-slim | Scheduled task runner |
| 5 | `scanning-engine` | cystar-scanning-engine | **8888** | python:3.12-slim | HexStrike tool orchestrator |
| 6 | `mongo` | cystar-mongo | **27017** | mongo:7.0 | Primary database |
| 7 | `redis` | cystar-redis | **6379** | redis:7-alpine | Task broker + cache |
Network: `cystar-network` (bridge). Volumes: `mongo-data`, `redis-data`, `nuclei-templates`, `scanning-data`.
## 📁 完整文件夹结构
```
Vulnerability_Scanner/
│
├── docker-compose.yml # 7-service orchestration (6 layers)
├── .env # Environment variables (secrets, API keys)
├── .gitignore
├── .dockerignore
├── README.md # ← This file
├── VERSION # Current release version (e.g. 1.0.0)
├── registry-push.ps1 # PowerShell script: build, tag, push images to ghcr.io
│
├── services/
│ │
│ ├── presentation/ # ── LAYER 1: React Frontend + Nginx ──
│ │ ├── Dockerfile # Multi-stage: node:22-alpine (build) → nginx:1.27-alpine (serve)
│ │ ├── nginx.conf # SPA routing + reverse proxy to api-gateway
│ │ ├── package.json # React 19.1, Vite 6.3.5, TailwindCSS, 30+ deps
│ │ ├── package-lock.json
│ │ ├── index.html # Vite entry point
│ │ ├── vite.config.ts
│ │ ├── tsconfig.json
│ │ ├── tsconfig.app.json
│ │ ├── tsconfig.node.json
│ │ ├── tailwind.config.js
│ │ ├── tailwind.config.cjs
│ │ ├── postcss.config.cjs
│ │ ├── eslint.config.js
│ │ ├── public/
│ │ │ ├── vite.svg
│ │ │ ├── grid.svg
│ │ │ ├── iitm.jpg
│ │ │ └── IIT_Madras_Logo.svg.png
│ │ └── src/
│ │ ├── main.tsx # Entry: AuthProvider → ThemeProvider → App
│ │ ├── App.tsx # React Router v7 — all route definitions
│ │ ├── App.css # Global animations, gradients, scan-line effects
│ │ ├── index.css # Tailwind directives + CSS custom properties
│ │ ├── vite-env.d.ts # Vite type declarations
│ │ │
│ │ ├── config/
│ │ │ └── api.ts # API_BASE_URL from VITE_API_URL env var
│ │ │
│ │ ├── context/
│ │ │ ├── AuthContext.tsx # JWT session: login/logout/register, user state
│ │ │ └── ThemeContext.tsx # 6 color palettes via CSS custom properties
│ │ │
│ │ ├── types/
│ │ │ └── subdomain.ts # TS interfaces: Subdomain, Vulnerability, TrendData
│ │ │
│ │ ├── pages/
│ │ │ ├── About.tsx # 8-step workflow visualization
│ │ │ └── Profile.tsx # Edit name + change password
│ │ │
│ │ ├── components/
│ │ │ ├── HeroSection.tsx # Landing page — animated domain input
│ │ │ │
│ │ │ ├── auth/
│ │ │ │ ├── Login.tsx # Split-screen email/password login
│ │ │ │ ├── Register.tsx # Registration form
│ │ │ │ ├── ForgotPassword.tsx # Password reset request
│ │ │ │ ├── VerificationPage.tsx # Email verification callback
│ │ │ │ ├── verify-otp.tsx # 6-digit OTP input
│ │ │ │ └── ProtectedRoute.tsx # Auth guard (redirect to /login)
│ │ │ │
│ │ │ ├── layout/
│ │ │ │ ├── Layout.tsx # Shell: Navbar + visual effects + footer
│ │ │ │ └── Navbar.tsx # Nav links, theme picker, user menu
│ │ │ │
│ │ │ ├── scan/
│ │ │ │ ├── HexStrikeScan.tsx # Core scan page: POST scan → SSE → results
│ │ │ │ ├── SubdomainCardSubfinder.tsx # Individual subdomain result card
│ │ │ │ ├── subdomainDetailsSubfinder.tsx # Expanded subdomain details
│ │ │ │ ├── DirectoryTree.tsx # Directory brute-force results tree
│ │ │ │ └── PDFDownloadSubfinder.tsx # Export scan results to PDF (jspdf)
│ │ │ │
│ │ │ ├── Statistics/
│ │ │ │ └── ReconDashboard.tsx # Charts: scan trends, severity, history
│ │ │ │
│ │ │ ├── terminal/
│ │ │ │ └── Terminal.tsx # Live SSE log viewer (portal, macOS style)
│ │ │ │
│ │ │ ├── asset/
│ │ │ │ └── AssetForm.tsx # CRUD: companies, domains, IPs, endpoints
│ │ │ │
│ │ │ └── ui/
│ │ │ └── LoadingSpinner.tsx # Spinning loader icon
│ │ │
│ │ └── assets/
│ │ └── react.svg
│ │
│ ├── api-gateway/ # ── LAYER 2: Flask REST API ──
│ │ ├── Dockerfile # python:3.12-slim, gunicorn 4 workers, port 4000
│ │ ├── requirements.txt # Flask 2.2.5, celery, pymongo, redis, flask-mail, etc.
│ │ └── app/
│ │ ├── __init__.py
│ │ ├── main.py # Flask app factory, blueprint registration, CORS, JWT
│ │ ├── tasks.py # Celery task stubs (dispatched to processing worker)
│ │ ├── hexstrike_manager.py # HTTP client → scanning-engine (connection pooling)
│ │ │
│ │ ├── middleware/
│ │ │ ├── __init__.py
│ │ │ └── rate_limit.py # Redis sliding-window rate limiter + domain sanitizer
│ │ │
│ │ ├── models/
│ │ │ ├── __init__.py
│ │ │ └── user.py # User model: email, password, OTP, reset tokens
│ │ │
│ │ └── routes/
│ │ ├── __init__.py
│ │ ├── auth.py # 10 endpoints: register, login, OTP, password flows
│ │ ├── scans.py # 17 endpoints: create/list/stream scans, SSE streaming
│ │ ├── assets.py # 3 endpoints: CRUD asset groups
│ │ ├── results.py # 8 endpoints: scan results, ports, ffuf, ZAP alerts
│ │ └── stats.py # 2 endpoints: dashboard statistics + trends
│ │
│ ├── processing/ # ── LAYER 3: Celery Workers ──
│ │ ├── Dockerfile # python:3.12-slim, celery worker --concurrency=4
│ │ ├── requirements.txt # celery, pymongo, redis, requests, aiohttp
│ │ ├── tasks.py # 3 Celery tasks: hexstrike, levelwise, ultra-fast
│ │ ├── hexstrike_manager.py # HTTP client → scanning-engine (ThreadPoolExecutor)
│ │ └── utils/
│ │ ├── __init__.py
│ │ ├── redis_log_handler.py # Custom logging.Handler → Redis rpush for SSE
│ │ └── ollama_risk_analyzer.py # AI risk analysis (DISABLED — entirely commented out)
│ │
│ ├── scanning-engine/ # ── LAYER 4: HexStrike Tool Orchestrator ──
│ │ ├── Dockerfile # python:3.12-slim + nmap, masscan, nikto, naabu, testssl
│ │ ├── requirements.txt # flask, gunicorn, aiohttp, requests
│ │ ├── init_tools.py # Build-time script: downloads 7 Go binaries
│ │ ├── tool_tracker.py # Standalone tool version & status tracker (runs on startup)
│ │ ├── entrypoint.sh # Startup: nuclei template update → tool tracker → gunicorn
│ │ ├── app/
│ │ │ ├── __init__.py
│ │ │ └── hexstrike_server.py # ~2200 lines: 8 Flask routes, AI engine, 19 tool runners
│ │ ├── utils/
│ │ │ └── tool_manager.py # ToolManager: downloads ProjectDiscovery Go binaries
│ │ └── wordlists/
│ │ └── common.txt # Directory fuzzing wordlist (ffuf, dirsearch, gobuster)
│ │
│ ├── hexstrike-intelligence/ # ── LAYER 5: AI Analysis (DISABLED) ──
│ │ ├── Dockerfile # python:3.12-slim, gunicorn on :8889
│ │ ├── requirements.txt
│ │ └── app/
│ │ ├── __init__.py
│ │ └── intelligence_server.py # Ollama/Mistral integration (not currently active)
│ │
│ └── data/ # ── LAYER 6: Database Configuration ──
│ ├── mongo/
│ │ └── init-db.js # Creates 6 collections + 11 indexes on first boot
│ └── redis/
│ └── redis.conf # 512MB maxmemory, AOF persistence, allkeys-lru
│
├── Backend/ # Legacy monolith (pre-microservices, not used by Docker)
└── Frontend/ # Legacy monolith (pre-microservices, not used by Docker)
```
## 🔬 分层拆解
### 第 1 层 — 表示层 (React + Nginx)
| Item | Detail |
|------|--------|
| **Framework** | React 19.1 + TypeScript 5.8 |
| **Bundler** | Vite 6.3.5 (HMR in dev, optimized build for prod) |
| **Styling** | TailwindCSS 3.4 + CSS custom properties for themes |
| **Icons** | lucide-react 0.514 |
| **Charts** | Recharts 2.15 (LineChart, BarChart, PieChart) |
| **Routing** | React Router v7.6 (client-side) |
| **SSE Client** | event-source-polyfill (supports credentials/cookies) |
| **PDF Export** | jspdf 3.0 |
| **Maps** | Leaflet 1.9 + react-leaflet 5.0 + mapbox-gl 3.12 |
| **Animations** | framer-motion 12.17 + typewriter-effect + tsparticles |
| **UI Components** | Radix UI (accordion, dialog, tabs, tooltip, slot) |
| **Notifications** | react-hot-toast + sweetalert2 |
| **Build** | Multi-stage Docker: `node:22-alpine` → `nginx:1.27-alpine` |
| **Port** | **80** (Nginx) |
### 第 2 层 — API 网关 (Flask)
| Item | Detail |
|------|--------|
| **Framework** | Flask 2.2.5 |
| **Server** | Gunicorn (4 workers, 600s timeout, keep-alive 5s) |
| **Auth** | flask-jwt-extended 4.3.1 (HTTP-only cookies, CSRF disabled) |
| **Database Client** | PyMongo 4.6.1 → MongoDB `subdomain_scanner` |
| **Cache/Broker** | Redis 5.0.1 (rate limiting, Celery broker connection) |
| **Email** | Flask-Mail 0.10.0 via Gmail SMTP (OTP delivery) |
| **Rate Limiting** | Custom Redis sliding-window decorator |
| **Port** | **4000** |
**Blueprints Registered:**
| Blueprint | Prefix | Endpoints | Purpose |
|-----------|--------|-----------|---------|
|auth_bp` | `/auth` | 10 | Registration, login, OTP, password flows |
| `scans_bp` | mixed | 17 | Scan CRUD, SSE streaming, task dispatch |
| `assets_bp` | `/api` | 3 | Asset group management |
| `results_bp` | mixed | 8 | Scan result queries, port data, ZAP alerts |
| `stats_bp` | mixed | 2 | Dashboard statistics and trends |
### 第 3 层 — 处理层 (Celery)
| Item | Detail |
|------|--------|
| **Engine** | Celery 5.3.1 |
| **Worker Concurrency** | 4 processes |
| **Beat** | Separate container for scheduled tasks |
| **Broker** | Redis db 0 |
| **Result Backend** | Redis db 1 |
| **Scan Client** | HexStrikeManager → HTTP to scanning-engine |
| **Log Streaming** | RedisLogHandler → `scan_logs:{scan_id}` (max 1000, 24h TTL) |
**Active Celery Tasks:**
| Task Name | Description |
|-----------|-------------|
| `hexstrike_scan` | Full AI scan: analyze → discover subdomains → select tools → parallel execution of 10+ tools per subdomain → store results in MongoDB → stream logs to Redis |
| `levelwise_parallel_scan` | Same pipeline but tracks `levels_completed: 3` for progress UI |
| `hexstrike_ultra_parallel_scan` | Fast-path alias that delegates to `hexstrike_scan` |
### 第 4 层 — 扫描引擎 (HexStrike)
| Item | Detail |
|------|--------|
| **Framework** | Flask 3.0 |
| **Server** | Gunicorn (4 workers, 8 threads, 300s timeout) |
| **Binary Tools** | 7 Go binaries (ProjectDiscovery) downloaded at Docker build |
| **System Tools** | nmap, masscan, nikto, testssl, dirsearch, wafw00f, whois |
| **Nuclei Templates** | Auto-updated on every container start via `entrypoint.sh`, persisted in `nuclei-templates` volume |
| **Parallelism** | ThreadPoolExecutor (8 workers per subdomain scan) |
| **AI Engine** | Target classification, risk scoring, tech detection, tool selection |
| **Port** | **8888** |
### 第 5 层 — 情报(已禁用)
Ollama + Mistral-based AI risk analysis. Commented out in `docker-compose.yml` and all processing tasks. When enabled, would run on port **8889** and provide:
- Natural-language vulnerability assessments per subdomain
- Batch risk analysis across scan results
- Automatic model management (pull, health checks)
### 第 6 层 — 数据层 (MongoDB + Redis)
**MongoDB 7.0** — Database: `subdomain_scanner`
| Collection | Purpose | Key Indexes |
|------------|---------|-------------|
| `users` | User accounts (email, password, OTP) | `email` (unique), `is_verified` |
| `scans` | Scan metadata & lifecycle status | `(user_id, created_at)` desc, `status`, `domain`, `scan_type` |
| `subdomain_results` | Per-subdomain tool findings & risk scores | `scan_id`, `subdomain`, `risk_score` (desc) |
| `scan_results` | Legacy knockpy scan results | `scan_id`, `domain`, `created_at` (desc) |
| `scan_results_subfinder` | Subfinder-pipeline scan results | `scan_id`, `domain` |
| `assets` | Company asset groups (domains, IPs) | `user_id`, `domain`, `created_at` (desc) |
**Redis 7 (Alpine):**
| Function | Key Pattern | Detail |
|----------|-------------|--------|
| Celery Broker | db 0 | Task queue (JSON serialization) |
| Celery Results | db 1 | Task result storage |
| Rate Limiting | `ratelimit:{endpoint}:{ip}` | Sliding-window counters (db 0) |
| SSE Log Stream | `scan_logs:{scan_id}` | Max 1000 entries, 24h TTL, rpush/ltrim |
Config: 512MB maxmemory, `allkeys-lru` eviction, AOF persistence (`appendfsync everysec`), RDB snapshots (900/1, 300/10, 60/10000).
## 🔧 安全工具 (19+)
### ProjectDiscovery Go 二进制文件(通过 `init_tools.py` 在 Docker 构建时自动下载)
| # | Tool | Version | GitHub Repo | Purpose |
|---|------|---------|-------------|---------|
| 1 | **subfinder** | v2.6.3 | projectdiscovery/subfinder | Passive + active subdomain enumeration (recursive, all sources) |
| 2 | **httpx** | v1.3.7 | projectdiscovery/httpx | HTTP probing: status codes, titles, TLS, tech detection, CDN, CNAME |
| 3 | **nuclei** | v3.1.5 | projectdiscovery/nuclei | Template-based vuln scanning: CVE detection, misconfigs, exposures. Templates auto-updated on container start and persisted via Docker volume |
| 4 | **dnsx** | v1.2.3 | projectdiscovery/dnsx | DNS resolution & validation: A records, TTL, resolver info |
| 5 | **ffuf** | v2.1.0 | ffuf/ffuf | Web fuzzing & directory brute-force (auto-calibration, wordlist) |
| 6 | **naabu** | v2.3.4 | projectdiscovery/naabu | Fast port scanning: SYN/CONNECT, top 1000 ports, rate 1000/s |
| 7 | **tlsx** | v1.1.2 | projectdiscovery/tlsx | TLS certificate inspection: versions, ciphers, SAN, expiry |
### 系统安装工具 (Dockerfile apt/git/pip)
| # | Tool | Install Method | Purpose |
|---|------|---------------|---------|
| 8 | **nmap** | apt | Port scanning + service/version detection + OS fingerprinting |
| 9 | **masscan** | apt | Mass IP port scanner (ports 1–5000 + high ports, rate 1000/s) |
| 10 | **nikto** | git clone → `/opt/nikto/` | Web server vulnerability scanner (misconfigs, outdated software, dangerous files) |
| 11 | **testssl.sh** | git clone → `/opt/testssl/` | TLS/SSL testing: cipher suites, protocols, Heartbleed, POODLE, DROWN |
| 12 | **dirsearch** | pip install | Directory/file scanner with JSON output and wordlist support |
| 13 | **wafw00f** | pip install | Web Application Firewall detection and identification |
| 14 | **whatweb** | system (scanning-engine reads via subprocess) | Web technology fingerprinting: server, CMS, frameworks, versions |
| 15 | **whois** | apt | Domain registration and ownership lookup |
| 16 | **curl** | apt | HTTP header inspection, technology detection from response headers |
### 引用工具 (期望在系统 PATH 中,可选)
| # | Tool | Purpose |
|---|------|---------|
| 17 | ~~**amass**~~ | ~~Passive subdomain enumeration (OWASP Amass)~~ — **REMOVED**: redundant with subfinder |
| 18 | **gobuster** | Directory/file brute-forcing |
| 19 | **wpscan** | WordPress vulnerability scanner (plugins, users, themes) |
| 20 | **sqlmap** | SQL injection detection and exploitation |
| 21 | **waybackurls** Fetch historical URLs from Wayback Machine |
| 22 | **gau** | Get All URLs from multiple web archives |
## 📡 API 端点
### 健康检查
| Method | Path | Auth | Description |
|--------|------|------|-------------|
| `GET` | `/health` | No | API Gateway health status |
### 身份验证 (10 个端点)
| Method | Path | Auth | Rate Limit | Description |
|--------|------|------|------------|-------------|
| `POST` | `/auth/register` | No | 10/60s | Create account + send OTP email |
| `POST` | `/auth/login` | No | 20/60s | Email/password login → set JWT cookie |
| `POST` | `/auth/verify-otp` | No | 10/60s | Verify 6-digit OTP → auto-login |
| `POST` | `/auth/resend-otp` | No | 5/60s | Regenerate and resend OTP |
| `POST` | `/auth/logout` | No | — | Clear JWT cookies |
| `GET` | `/auth/me` | **Yes** | — | Get current user profile |
| `PUT` | `/auth/profile` | **Yes** | — | Update user display name |
| `POST` | `/auth/change-password` | **Yes** | — | Change password (requires current) |
| `POST` | `/auth/forgot-password` | No | 5/60s | Send password reset OTP/token |
| `POST` | `/auth/reset-password` | No | 5/60s | Reset password with OTP/token |
### 扫描管理 (17 个端点)
| Method | Path | Auth | Description |
|--------|------|------|-------------|
| `POST` | `/api/scans/hexstrike` | **Yes** | Queue HexStrike AI scan (Celery task) |
| `GET` | `/api/scans/hexstrike` | **Yes** | List user's HexStrike scans (`?mode=`, `?limit=`) |
| `GET` | `/api/scans/hexstrike/:id` | **Yes** | Get single scan metadata |
| `GET` | `/api/scans/hexstrike/:id/stream` | **Yes** | SSE real-time log stream from Redis |
| `GET` | `/api/scans/hexstrike/:id/results` | **Yes** | Aggregated scan results (MongoDB pipeline) |
| `POST` | `/api/scans/levelwise` | **Yes** | Queue levelwise parallel scan |
| `GET` | `/api/scans/levelwise/:id` | **Yes** | Levelwise scan progress and status |
| `POST` | `/api/scans/ultra-fast` | **Yes** | Queue ultra-fast scan (`?mode=ultra/async`) |
| `GET` | `/api/scans/ultra-fast` | **Yes** | List ultra-fast scans |
| `GET` | `/api/scans/ultra-fast/:id` | **Yes** | Ultra-fast scan status |
| `GET` | `/api/scans/ultra-fast/:id/results` | **Yes** | Paginated results (`?page=`, `?limit=`, `?severity=`) |
| `GET` | `/rescan/stream` | **Yes** | Direct HexStrike AI SSE stream (`?domain=`) |
| `GET` | `/rescan/stream_subfinder_dnsx_httpx` | **Yes** | Subfinder pipeline SSE (`?domain=`) |
| `GET` | `/scan/comprehensive` | **Yes** | Levelwise parallel SSE (`?domain=`) |
| `GET` | `/api/hexstrike/health` | **Yes** | Check scanning-engine health |
| `POST` | `/api/trigger_background_scan` | **Yes** | Fire-and-forget Celery scan |
| `GET` | `/api/background_scan_status/:task_id` | **Yes** | Check Celery task state |
### 资产管理 (3 个端点)
| Method | Path | Auth | Description |
|--------|------|------|-------------|
| `POST` | `/api/assets` | **Yes** | Create asset group (company, domains, IPs, endpoints) |
| `GET` | `/api/assets` | **Yes** | List all user's asset groups |
| `DELETE` | `/api/assets/:id` | **Yes** | Delete asset group (owner only) |
### 结果 (8 个端点)
| Method | Path | Auth | Description |
|--------|------|------|-------------|
| `GET` | `/results` | **Yes** | Legacy scan results (`?scan_id=`) |
| `GET` | `/resultssubfinder` | **Yes** | Latest subfinder scan results |
| `GET` | `/resultssubfinderchart` | **Yes** | Subfinder chart data (`?scan_id=`) |
| `GET` | `/recent-scan-json` | **Yes** | Recent scans JSON (`?scan_type=`, `?limit=`) |
| `GET` | `/api/getPorts` | No | Open ports for a domain (`?subdomain=`) |
| `GET` | `/api/getPorts_subfinder` | No | Ports from subfinder/hexstrike scans (`?subdomain=`) |
| `GET` | `/api/getFfuf_subfinder` | No | Ffuf directory results (`?subdomain=`) |
| `GET` | `/api/getZapAlerts` | No | ZAP security alerts (`?subdomain=`) |
### 统计 (2 个端点)
| Method | Path | Auth | Description |
|--------|------|------|-------------|
| `GET` | `/api/statistics` | **Yes** | Dashboard stats: totals, trends, severity breakdown, top alerts |
| `GET` | `/scan-trends` | **Yes** | Scan trend data for line charts |
### 扫描引擎内部 API (端口 8888,不暴露给前端)
| Method | Path | Description |
|--------|------|-------------|
| `GET` | `/health` | Engine health + tool count + version |
| `GET` | `/api/tools` | List all 19 available tools with categories/priorities |
| `POST` | `/api/analyze` | AI target analysis: DNS, HTTP, port scan, WAF, risk, techs |
| `POST` | `/api/tools/optimal` | AI-recommended tools for a target (max 12) |
| `POST` | `/api/intelligence/generate-command` | Generate CLI command for any tool |
| `POST` | `/api/scan/subdomain` | Execute tools against a single subdomain (parallel) |
| `POST` | `/api/scan/batch` | Batch subdomain scan (stub) |
| `POST` | `/api/discover/subdomains` | Discovery: subfinder + wordlist expansion |
## 🔄 扫描流程
```
┌─────────────────────────────────────────────────────────────────┐
│ USER enters domain in browser (HeroSection → navigates /scan) │
└──────────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ FRONTEND: POST /api/scans/hexstrike { domain: "example.com" } │
│ Opens SSE connection to /api/scans/hexstrike/:id/stream │
└──────────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ API GATEWAY: Creates scan in MongoDB (status: "queued") │
│ Dispatches Celery task → hexstrike_scan(scan_id, domain) │
└──────────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ CELERY WORKER picks up task │
│ Creates RedisLogHandler → streams logs to scan_logs:{scan_id} │
│ Creates HexStrikeManager(scanning-engine:8888) │
│ Updates MongoDB: status → "running" │
└──────────────────────────┬──────────────────────────────────────┘
│
┌────────────────┼────────────────┐
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Step 1: │ │ Step 2: │ │ Step 3: │
│ ANALYZE │ │ DISCOVER │ │ SELECT TOOLS │
│ │ │ │ │ │
│ POST /api/ │ │ POST /api/ │ │ POST /api/ │
│ analyze │ │ discover/ │ │ tools/ │
│ │ │ subdomains │ │ optimal │
│ • DNS lookup │ │ │ │ │
│ • HTTP probe │ │ • subfinder │ │ • AI selects │
│ • 14 ports │ │ • subfinder │ │ best tools │
│ • WAF detect │ │ • wordlist │ │ • Per-tool │
│ • Risk score │ │ expansion │ │ params │
│ • Tech detect│ │ • Dedup │ │ • Max 12 │
│ • Classify │ │ • Max 150 │ │ │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
└─────────────────┼─────────────────┘
▼
┌─────────────────────────────────────────────────────────────────┐
│ Step 4: PARALLEL SCAN — ThreadPoolExecutor (10 workers) │
│ │
│ For EACH subdomain (up to 150): │
│ POST /api/scan/subdomain { subdomain, tools[] } │
│ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ ThreadPoolExecutor (8 workers) runs tools in parallel: │ │
│ │ │ │
│ │ httpx ─────→ HTTP probe + tech fingerprint │ │
│ │ nuclei ────→ CVE detection + vulnerability templates │ │
│ │ nmap ──────→ Port scan + service/version detection │ │
│ │ naabu ─────→ Fast port scan │ │
│ │ dnsx ──────→ DNS records │ │
│ │ tlsx ──────→ TLS certificate inspection │ │
│ │ whatweb ───→ Technology fingerprinting │ │
│ │ ffuf ──────→ Directory brute-force │ │
│ │ nikto ─────→ Web vulnerability scan │ │
│ │ masscan ───→ Mass port scan │ │
│ │ testssl ───→ SSL/TLS testing │ │
│ │ dirsearch ─→ Directory scanning │ │
│ │ wafw00f ───→ WAF detection │ │
│ │ curl ──────→ Header analysis │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
│ Results merged → Risk score computed (0-100) │
│ CVEs extracted → Vulnerabilities categorized by severity │
└──────────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ STORAGE & STREAMING │
│ │
│ • Each subdomain result → MongoDB subdomain_results collection │
│ • Scan status → MongoDB scans (completed, total_subdomains) │
│ • Logs → Redis scan_logs:{scan_id} → SSE → Terminal component │
└──────────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ FRONTEND renders results: │
│ • SubdomainCardSubfinder for each discovered subdomain │
│ • Risk score badges (CRITICAL / HIGH / MEDIUM / LOW / MINIMAL) │
│ • Expandable details: ports, techs, vulns, directories │
│ • PDF export via PDFDownloadSubfinder │
│ • Analytics in ReconDashboard (charts, history) │
└─────────────────────────────────────────────────────────────────┘
```
## 🚀 快速开始
### 先决条件
- [Docker Desktop](https://www.docker.com/products/docker-desktop/) (Windows/Mac) or Docker Engine (Linux)
- Docker Compose v2+
- 4GB+ RAM available for Docker
- Ports **80**, **4000**, **6379**, **8888**, **27017** available
### 1. 克隆并配置
```
git clone
**Built for security researchers and penetration testers**
*Cystar Vulnerability Scanner — 6-Layer Microservices Architecture*
标签:AES-256, AI侦察, API网关, Celery, CI/CD安全, DevSecOps, Docker, Docker Compose, Flask, HexStrike, LIDS, Llama, MongoDB, Nginx, NIDS, PMD, Python, React, Redis, Syscalls, TypeScript, 上游代理, 人工智能安全, 企业安全, 企业级, 分布式系统, 合规性, 响应大小分析, 多工具集成, 威胁情报, 子域名突变, 安全专业人士, 安全工具集成, 安全扫描, 安全插件, 安全防御评估, 实时流处理, 容器化, 开发者工具, 开源安全工具, 异步任务, 微服务架构, 扫描引擎, 搜索引擎查询, 无后门, 时序注入, 漏洞评估, 版权保护, 网络安全, 网络空间测绘, 网络资产管理, 自动化渗透测试, 逆向工具, 逆向工程平台, 隐私保护, 高可用架构