AllanGallop/Hellion
GitHub: AllanGallop/Hellion
一款高性能分布式 Web 漏洞扫描器,通过 YAML 测试包和水平扩展的 Worker 实现快速、大规模的 HTTP 安全测试。
Stars: 0 | Forks: 0
[
](.github/images/logo.png)
# Hellion
[](https://github.com/hellion/Hellion/actions/workflows/ci.yml)
[](https://go.dev/)
[](https://www.rust-lang.org/)
[](docker-compose.yml)
[性能](#performance) · [快速开始](#quick-start) · [配置](#config) · [文档](#documentation) · [测试](#testing-and-benchmarks) · [开发](#development) · [架构](.github/docs/architecture.md)
- 没有 AI。
- 没有区块链。
- 没有以希腊神明命名的微服务。
- 就是又快又好
## 性能摘要
| 运行次数 | 队列 (ms) | Worker (ms) | 总计 (ms) | 队列速率 | Worker 速率 | 总速率 |
| ------- | ---------- | ----------- | ---------- | ---------- | ----------- | ---------- |
| 100 | 76 | 292 | 423 | 1,316/s | 342/s | 236/s |git
| 1,000 | 73 | 865 | 994 | 13,699/s | 1,156/s | 1,006/s |
| 10,000 | 168 | 3,892 | 4,122 | 59,524/s | 2,569/s | 2,426/s |
| 100,000 | 1,020 | 43,782 | 44,870 | 98,039/s | 2,284/s | 2,229/s |
请参阅 [架构指南](.github/docs/architecture.md) 了解组件概述、流程和运行生命周期。
## 文档
| 指南 | 描述 |
| -------------------------------------------------- | -------------------------------- |
| [架构指南](.github/docs/architecture.md) | 组件、流程、运行生命周期 |
| [API 指南](.github/docs/api.md) | Endpoints、运行生命周期、事件 |
| [测试包指南](.github/docs/test-packs.md) | 编写 HTTP 检查工作流 |
| [性能指南](.github/docs/performance.md) | 基准测试与调优 |
| [OpenAPI 规范](.github/docs/openapi.yaml) | 机器可读的 API schema |
## 快速开始
### 启动服务
```
docker compose up --build
```
打开 **[http://localhost:8080](http://localhost:8080)** 进入 Web UI(与 API 端口相同)。
### 发送请求
```
curl -X POST http://localhost:8080/runs \
-H "Content-Type: application/json" \
-d '{
"scope_id": "local-juice-shop",
"targets": ["http://juice-shop:3000"],
"test_pack": "juice-shop-detect"
}'
```
### 读取数据
```
curl http://localhost:8080/runs/stats
curl http://localhost:8080/runs/{run_id}
curl http://localhost:8080/runs/{run_id}/events
```
## 配置
### Scopes
Scopes 位于 `scopes/` 目录下,并挂载到 worker 的 `/app/scopes/` 中。
```
scope_id: local-juice-shop
allowed_origins:
- http://juice-shop:3000
allowed_methods:
- GET
- HEAD
max_rps: 0
worker_concurrency: 25
```
| 字段 | 描述 |
| -------------------- | --------------------------------------- |
| `scope_id` | 匹配 NATS subject 和作业 `scope_id` |
| `allowed_origins` | Worker 允许请求的基础 URL |
| `allowed_methods` | 允许的 HTTP 方法 |
| `max_rps` | 每个 worker 的速率限制 (0 = 无限制) |
| `worker_concurrency` | 每个 worker 的并发作业数 |
在 worker 上设置 `SCOPE_PATH` 以指向 scope 文件。
### 测试包
测试包理所当然是 `test-packs/` 目录下的 YAML 文件。[看这里](.github/docs/test-packs.md)。每个测试包由多个步骤组成:
| 步骤类型 | 用途 |
| --------- | -------------------------------------------------------- |
| `http` | 发送请求(方法、路径、headers、body、JSON、form) |
| `assert` | 检查命名响应的状态、headers 或 body |
| `extract` | 将 regex group 捕获到变量中 |
| `finding` | 记录一个 finding |
示例 (`test-packs/juice-shop-detect.yaml`):
```
id: juice-shop-detect
name: Detect OWASP Juice Shop
steps:
- http:
id: root
method: GET
path: /
- assert:
response: root
status: 200
message: Homepage returned 200
- finding:
severity: critical
message: OWASP Juice Shop detected
```
### 环境变量
**control-api**
| 变量 | 默认值 | 描述 |
| -------------- | ------------------ | --------------------------------------- |
| `NATS_URL` | `nats://nats:4222` | NATS 连接 URL |
| `DATABASE_URL` | postgres DSN | 用于运行和事件的 Postgres 连接 |
**worker-rust**
| 变量 | 默认值 | 描述 |
| ------------------------ | ----------------------------------- | -------------------------------------------------------------------- |
| `NATS_URL` | `nats://nats:4222` | NATS 连接 URL |
| `DATABASE_URL` | postgres DSN | 用于批量状态写入的 Postgres 连接 |
| `SCOPE_PATH` | `/app/scopes/local-juice-shop.yaml` | Scope 文件路径 |
| `HELLION_VERBOSE_EVENTS` | `false` | 存储所有事件还是仅存储高信号事件 |
| `BENCHMARK_MODE` | `false` | 跳过事件插入(状态更新仍会写入) |
| `STATE_BATCH_SIZE` | `64` | 每次 Postgres 批量刷新的事件数 |
| `PG_POOL_SIZE` | `12` | 每个 worker 的连接数 (`replicas × PG_POOL_SIZE < max_connections`) |
水平扩展 worker:
```
docker compose up -d --scale worker-rust=4
```
## 项目结构
```
Hellion/
├── control/ # Go Control API + embedded web UI (control/web/)
├── worker/ # Rust job worker
├── scopes/ # Worker scope definitions
├── test-packs/ # YAML test pack definitions
├── tests/ # e2e, benchmark, and queue scripts
├── docker-compose.yml
└── .github/docs/ # Architecture, API, test pack, and performance docs
```
## 测试与基准测试
```
# 端到端功能测试
bash tests/e2e.sh
# 仅 Queue 吞吐量(不等待完成)
RUNS=50 bash tests/queue-only.sh
# 完整 benchmark:Queue + Worker 完成(轮询 GET /runs/stats)
RUNS=1000 TIMEOUT_SEC=300 ./tests/bench.sh
```
在 compose 网络内部运行脚本时,请设置 `API=http://control-api:8080`。可以通过覆盖 `RUNS` 和 `TIMEOUT_SEC` 来进行更大或更长时间的基准测试。请参阅 [性能指南](.github/docs/performance.md) 了解参考吞吐量和调优建议。
## 开发
### 本地构建
```
# Worker
cd worker && cargo build
# Control API
cd control && go build .
```
### 重建容器
```
docker compose build worker-rust control-api
docker compose up -d
```
](.github/images/logo.png)
# Hellion
[](https://github.com/hellion/Hellion/actions/workflows/ci.yml)
[](https://go.dev/)
[](https://www.rust-lang.org/)
[](docker-compose.yml)
[性能](#performance) · [快速开始](#quick-start) · [配置](#config) · [文档](#documentation) · [测试](#testing-and-benchmarks) · [开发](#development) · [架构](.github/docs/architecture.md)
- 没有 AI。
- 没有区块链。
- 没有以希腊神明命名的微服务。
- 就是又快又好
## 性能摘要
| 运行次数 | 队列 (ms) | Worker (ms) | 总计 (ms) | 队列速率 | Worker 速率 | 总速率 |
| ------- | ---------- | ----------- | ---------- | ---------- | ----------- | ---------- |
| 100 | 76 | 292 | 423 | 1,316/s | 342/s | 236/s |git
| 1,000 | 73 | 865 | 994 | 13,699/s | 1,156/s | 1,006/s |
| 10,000 | 168 | 3,892 | 4,122 | 59,524/s | 2,569/s | 2,426/s |
| 100,000 | 1,020 | 43,782 | 44,870 | 98,039/s | 2,284/s | 2,229/s |
请参阅 [架构指南](.github/docs/architecture.md) 了解组件概述、流程和运行生命周期。
## 文档
| 指南 | 描述 |
| -------------------------------------------------- | -------------------------------- |
| [架构指南](.github/docs/architecture.md) | 组件、流程、运行生命周期 |
| [API 指南](.github/docs/api.md) | Endpoints、运行生命周期、事件 |
| [测试包指南](.github/docs/test-packs.md) | 编写 HTTP 检查工作流 |
| [性能指南](.github/docs/performance.md) | 基准测试与调优 |
| [OpenAPI 规范](.github/docs/openapi.yaml) | 机器可读的 API schema |
## 快速开始
### 启动服务
```
docker compose up --build
```
打开 **[http://localhost:8080](http://localhost:8080)** 进入 Web UI(与 API 端口相同)。
### 发送请求
```
curl -X POST http://localhost:8080/runs \
-H "Content-Type: application/json" \
-d '{
"scope_id": "local-juice-shop",
"targets": ["http://juice-shop:3000"],
"test_pack": "juice-shop-detect"
}'
```
### 读取数据
```
curl http://localhost:8080/runs/stats
curl http://localhost:8080/runs/{run_id}
curl http://localhost:8080/runs/{run_id}/events
```
## 配置
### Scopes
Scopes 位于 `scopes/` 目录下,并挂载到 worker 的 `/app/scopes/` 中。
```
scope_id: local-juice-shop
allowed_origins:
- http://juice-shop:3000
allowed_methods:
- GET
- HEAD
max_rps: 0
worker_concurrency: 25
```
| 字段 | 描述 |
| -------------------- | --------------------------------------- |
| `scope_id` | 匹配 NATS subject 和作业 `scope_id` |
| `allowed_origins` | Worker 允许请求的基础 URL |
| `allowed_methods` | 允许的 HTTP 方法 |
| `max_rps` | 每个 worker 的速率限制 (0 = 无限制) |
| `worker_concurrency` | 每个 worker 的并发作业数 |
在 worker 上设置 `SCOPE_PATH` 以指向 scope 文件。
### 测试包
测试包理所当然是 `test-packs/` 目录下的 YAML 文件。[看这里](.github/docs/test-packs.md)。每个测试包由多个步骤组成:
| 步骤类型 | 用途 |
| --------- | -------------------------------------------------------- |
| `http` | 发送请求(方法、路径、headers、body、JSON、form) |
| `assert` | 检查命名响应的状态、headers 或 body |
| `extract` | 将 regex group 捕获到变量中 |
| `finding` | 记录一个 finding |
示例 (`test-packs/juice-shop-detect.yaml`):
```
id: juice-shop-detect
name: Detect OWASP Juice Shop
steps:
- http:
id: root
method: GET
path: /
- assert:
response: root
status: 200
message: Homepage returned 200
- finding:
severity: critical
message: OWASP Juice Shop detected
```
### 环境变量
**control-api**
| 变量 | 默认值 | 描述 |
| -------------- | ------------------ | --------------------------------------- |
| `NATS_URL` | `nats://nats:4222` | NATS 连接 URL |
| `DATABASE_URL` | postgres DSN | 用于运行和事件的 Postgres 连接 |
**worker-rust**
| 变量 | 默认值 | 描述 |
| ------------------------ | ----------------------------------- | -------------------------------------------------------------------- |
| `NATS_URL` | `nats://nats:4222` | NATS 连接 URL |
| `DATABASE_URL` | postgres DSN | 用于批量状态写入的 Postgres 连接 |
| `SCOPE_PATH` | `/app/scopes/local-juice-shop.yaml` | Scope 文件路径 |
| `HELLION_VERBOSE_EVENTS` | `false` | 存储所有事件还是仅存储高信号事件 |
| `BENCHMARK_MODE` | `false` | 跳过事件插入(状态更新仍会写入) |
| `STATE_BATCH_SIZE` | `64` | 每次 Postgres 批量刷新的事件数 |
| `PG_POOL_SIZE` | `12` | 每个 worker 的连接数 (`replicas × PG_POOL_SIZE < max_connections`) |
水平扩展 worker:
```
docker compose up -d --scale worker-rust=4
```
## 项目结构
```
Hellion/
├── control/ # Go Control API + embedded web UI (control/web/)
├── worker/ # Rust job worker
├── scopes/ # Worker scope definitions
├── test-packs/ # YAML test pack definitions
├── tests/ # e2e, benchmark, and queue scripts
├── docker-compose.yml
└── .github/docs/ # Architecture, API, test pack, and performance docs
```
## 测试与基准测试
```
# 端到端功能测试
bash tests/e2e.sh
# 仅 Queue 吞吐量(不等待完成)
RUNS=50 bash tests/queue-only.sh
# 完整 benchmark:Queue + Worker 完成(轮询 GET /runs/stats)
RUNS=1000 TIMEOUT_SEC=300 ./tests/bench.sh
```
在 compose 网络内部运行脚本时,请设置 `API=http://control-api:8080`。可以通过覆盖 `RUNS` 和 `TIMEOUT_SEC` 来进行更大或更长时间的基准测试。请参阅 [性能指南](.github/docs/performance.md) 了解参考吞吐量和调优建议。
## 开发
### 本地构建
```
# Worker
cd worker && cargo build
# Control API
cd control && go build .
```
### 重建容器
```
docker compose build worker-rust control-api
docker compose up -d
```
标签:CISA项目, Go语言, Rust, Web漏洞扫描, 分布式架构, 可视化界面, 安全测试, 攻击性安全, 日志审计, 版权保护, 程序破解, 网络流量审计, 网络测绘, 请求拦截, 通知系统, 高并发