Skip to content

Commit dadff95

Browse files
author
githubnull
committed
docs: update project documentation for v1.6.0
- Update README.md and README_EN.md with new features - Update AGENTS.md with detailed project structure and features - Update CLAUDE.md with comprehensive guidance - Update USAGE_GUIDE.md with header rules and scope configuration - Update version to 1.6.0 in config.py
1 parent 85e7fe4 commit dadff95

6 files changed

Lines changed: 658 additions & 95 deletions

File tree

AGENTS.md

Lines changed: 101 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,41 @@ sqlmapWebUI/
1818
│ │ ├── api/ # API routes
1919
│ │ │ ├── chromeExApi/ # Chrome extension API
2020
│ │ │ ├── burpSuiteExApi/ # Burp Suite plugin API
21-
│ │ │ └── commonApi/ # Common APIs (auth, headers)
21+
│ │ │ └── commonApi/ # Common APIs (auth, headers, config)
2222
│ │ ├── model/ # Data models
23+
│ │ │ ├── requestModel/ # Request DTOs
24+
│ │ │ ├── Task.py # Task model
25+
│ │ │ ├── HeaderScope.py # Header scope configuration
26+
│ │ │ ├── PersistentHeaderRule.py # Persistent header rules
27+
│ │ │ ├── SessionHeader.py # Session-level headers
28+
│ │ │ └── ...
2329
│ │ ├── service/ # Business logic layer
30+
│ │ │ ├── taskService.py # Task management
31+
│ │ │ └── headerRuleService.py # Header rules management
2432
│ │ ├── utils/ # Utility functions
33+
│ │ │ ├── header_processor.py # Header processing
34+
│ │ │ ├── scope_matcher.py # Scope matching logic
35+
│ │ │ └── task_monitor.py # Task monitoring
2536
│ │ ├── third_lib/sqlmap/ # SQLMap integration (git submodule)
2637
│ │ ├── app.py # FastAPI application core
2738
│ │ └── main.py # Entry point
2839
│ ├── frontEnd/ # Vue 3 frontend (TypeScript + Vite)
2940
│ │ └── src/
3041
│ │ ├── api/ # API request functions
3142
│ │ ├── components/# Shared components
43+
│ │ │ ├── TaskFilter.vue # Task filtering component
44+
│ │ │ ├── TaskSummary.vue # Task statistics summary
45+
│ │ │ └── ScopeConfigPanel.vue # Scope configuration UI
3246
│ │ ├── stores/ # Pinia state management
47+
│ │ │ ├── task.ts # Task state store
48+
│ │ │ └── config.ts # Config state store
3349
│ │ ├── types/ # TypeScript type definitions
3450
│ │ ├── utils/ # Utility functions
3551
│ │ └── views/ # Page views
52+
│ │ ├── Home/ # Dashboard
53+
│ │ ├── TaskList/ # Task list page
54+
│ │ ├── TaskDetail/ # Task detail page
55+
│ │ └── Config/ # Configuration page
3656
│ ├── burpEx/ # Burp Suite extensions
3757
│ │ ├── legacy-api/ # Legacy Burp API (Java 11)
3858
│ │ └── montoya-api/ # Montoya API (Java 17, Burp 2023.1+)
@@ -49,11 +69,42 @@ sqlmapWebUI/
4969

5070
| Component | Technologies |
5171
|-----------|-------------|
52-
| Backend | Python 3.13+, FastAPI, SQLMap, SQLite |
72+
| Backend | Python 3.13+, FastAPI, SQLMap, SQLite, uv |
5373
| Frontend | Vue 3, TypeScript, PrimeVue, Pinia, Vite |
5474
| Burp Plugins | Java 11 (Legacy), Java 17 (Montoya) |
5575
| Package Managers | uv (Python), pnpm (Node.js), Maven (Java) |
5676

77+
## Core Features
78+
79+
### Task Management
80+
- Create/monitor/stop SQL injection scan tasks
81+
- Real-time log viewing
82+
- Batch operations (batch stop, batch delete, flush all)
83+
- Multi-dimensional filtering (URL, message, status, date range, injection status)
84+
- Sorting by multiple fields
85+
- Summary statistics row in task list
86+
- Smart polling (adjusts refresh rate based on task status)
87+
88+
### Header Rules Management
89+
- **Persistent Rules**: Long-term header rules stored in database
90+
- Full CRUD operations
91+
- Priority-based ordering (0-100)
92+
- Multiple replace strategies (REPLACE, APPEND, PREPEND, etc.)
93+
- **Session Headers**: Temporary headers with TTL expiration
94+
- **Scope Configuration**: URL matching for targeted header application
95+
- Protocol pattern (http/https)
96+
- Hostname pattern (supports wildcards)
97+
- Port pattern (supports multiple values)
98+
- Path pattern (supports wildcards)
99+
- Regex support for complex matching
100+
- **Batch Import**: Import multiple headers from text
101+
102+
### VulnShop Lab
103+
- 8 SQL injection vulnerability types
104+
- 3 WAF difficulty levels (Easy/Medium/Hard)
105+
- Light/Dark theme support
106+
- One-click database reset
107+
57108
## Development Commands
58109

59110
### Backend
@@ -100,12 +151,14 @@ mvn clean package -DskipTests
100151
- Follow PEP 8 style guidelines
101152
- Use async/await for I/O operations in FastAPI
102153
- Models use Pydantic for validation
154+
- Service classes are singletons
103155

104156
### TypeScript (Frontend)
105157
- Strict TypeScript mode enabled
106158
- Use Composition API with `<script setup>`
107159
- State management through Pinia stores
108160
- PrimeVue components for UI consistency
161+
- Use computed properties for derived data
109162

110163
### Java (Burp Plugins)
111164
- Legacy API: Java 11 compatibility
@@ -135,6 +188,19 @@ export const fetchData = async (params: RequestParams): Promise<ResponseType> =>
135188
}
136189
```
137190

191+
### Header Rules API Endpoints
192+
```
193+
GET /commonApi/header/persistent-header-rules # List all rules
194+
GET /commonApi/header/persistent-header-rules/:id # Get single rule
195+
POST /commonApi/header/persistent-header-rules # Create rule
196+
PUT /commonApi/header/persistent-header-rules/:id # Update rule
197+
DELETE /commonApi/header/persistent-header-rules/:id # Delete rule
198+
POST /commonApi/header/session-headers # Set session headers
199+
GET /commonApi/header/session-headers # Get session headers
200+
DELETE /commonApi/header/session-headers # Clear session headers
201+
POST /commonApi/header/header-processing/preview # Preview header processing
202+
```
203+
138204
## Git Workflow
139205

140206
### Commit Message Format (Conventional Commits)
@@ -159,6 +225,7 @@ ci: CI/CD changes
159225
Automatic build and release is triggered when pushing tags matching:
160226
- `release-v[0-9]+.[0-9]+.[0-9]+*`
161227
- `v[0-9]+.[0-9]+.[0-9]+-release*`
228+
- `release/v[0-9]+.[0-9]+.[0-9]+*`
162229

163230
Release artifacts:
164231
- `sqlmapwebui-{version}.zip` - Backend with integrated frontend
@@ -180,6 +247,12 @@ Release artifacts:
180247
3. Use PrimeVue components for consistent UI
181248
4. Add state management in Pinia store if needed
182249

250+
### Adding Header Rule with Scope
251+
1. Backend: Rule with scope field (optional, null = global)
252+
2. Frontend: Use ScopeConfigPanel component
253+
3. Scope supports: protocol, host, port, path patterns
254+
4. Scope matching uses AND logic for all configured fields
255+
183256
### Modifying VulnShop Lab
184257
1. Backend logic in `server.py` route handlers
185258
2. Database operations in `database.py`
@@ -204,6 +277,11 @@ Backend allows CORS from:
204277
- `localhost:5173-5176` (frontend dev)
205278
- `localhost:8775` (backend)
206279

280+
### Database
281+
- Task data stored in memory (DataStore singleton)
282+
- Header rules stored in SQLite (`header_rules.db`)
283+
- Automatic database migration for schema changes
284+
207285
## File Dependencies
208286

209287
### Backend Entry Point
@@ -217,3 +295,24 @@ Backend allows CORS from:
217295
```bash
218296
git submodule update --remote
219297
```
298+
299+
## Testing
300+
301+
### Backend Tests
302+
```bash
303+
cd src/backEnd
304+
python -m pytest tests/
305+
```
306+
307+
Test files:
308+
- `test_scope_matcher.py` - Scope matching logic tests
309+
- `test_header_processor_scope.py` - Header processor tests
310+
- `test_api_endpoints.py` - API endpoint tests
311+
312+
### Frontend Development
313+
```bash
314+
cd src/frontEnd
315+
pnpm run dev # Start with hot reload
316+
pnpm run lint # Run linter
317+
pnpm run build # Build production
318+
```

CLAUDE.md

Lines changed: 105 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,27 @@ sqlmapWebUI/
2525
### 后端架构 (src/backEnd/)
2626
- `main.py` - 主入口文件,配置 SQLMap 导入路径
2727
- `app.py` - FastAPI 应用核心,包含 CORS 配置、路由挂载
28+
- `config.py` - 版本号和全局配置
2829
- `api/` - API 路由模块
2930
- `chromeExApi/` - Chrome 扩展相关 API
3031
- `burpSuiteExApi/` - Burp Suite 扩展相关 API
31-
- `commonApi/` - 通用 API(认证、请求头规则等)
32+
- `commonApi/` - 通用 API
33+
- `headerController.py` - 请求头规则管理 API
34+
- `authController.py` - 认证 API
35+
- `configController.py` - 配置管理 API
3236
- `model/` - 数据模型定义
37+
- `Task.py` - 任务模型
38+
- `HeaderScope.py` - 请求头作用域配置
39+
- `PersistentHeaderRule.py` - 持久化请求头规则
40+
- `SessionHeader.py` - 会话级请求头
41+
- `HeaderDatabase.py` - 请求头数据库操作
3342
- `service/` - 业务逻辑层
34-
- `utils/` - 工具函数(请求头处理、作用域匹配等)
43+
- `taskService.py` - 任务管理服务
44+
- `headerRuleService.py` - 请求头规则服务(单例模式)
45+
- `utils/` - 工具函数
46+
- `header_processor.py` - 请求头处理器
47+
- `scope_matcher.py` - 作用域匹配器
48+
- `task_monitor.py` - 任务监控
3549
- `third_lib/sqlmap/` - SQLMap 第三方库集成
3650

3751
### 前端架构 (src/frontEnd/)
@@ -40,16 +54,31 @@ sqlmapWebUI/
4054
- Vite 构建工具,自动导入 Vue API 和组件
4155
- 构建输出到后端的 `static` 目录
4256

57+
主要视图:
58+
- `views/Home/` - 首页仪表盘,显示任务统计
59+
- `views/TaskList/` - 任务列表,支持过滤/排序/批量操作
60+
- `views/TaskDetail/` - 任务详情,显示日志/结果/配置
61+
- `views/Config/` - 配置页面(Tab 布局)
62+
- 系统配置
63+
- Header 规则管理
64+
- 会话 Header 管理
65+
66+
关键组件:
67+
- `components/TaskFilter.vue` - 任务过滤器
68+
- `components/TaskSummary.vue` - 任务汇总统计
69+
- `components/ScopeConfigPanel.vue` - 作用域配置面板
70+
71+
状态管理:
72+
- `stores/task.ts` - 任务状态,包含过滤、排序、统计计算
73+
- `stores/config.ts` - 配置状态
74+
4375
### VulnShop 靶场 (src/vulnTestServer/)
4476
独立的漏洞测试环境,包含:
4577
- `server.py` - Python HTTP 服务器,处理所有 API 请求
4678
- `database.py` - SQLite 数据库管理,包含漏洞 SQL 查询
4779
- `waf.py` - WAF 模块,支持 3 种难度级别
4880
- `config.py` - 配置文件(端口、难度等)
4981
- `static/` - 前端静态资源
50-
- `index.html` - 单页应用入口
51-
- `css/style.css` - 样式表,支持 CSS 变量主题切换
52-
- `js/app.js` - 前端 JavaScript 应用
5382

5483
**支持的漏洞类型**:
5584
- Error-based (POST /api/user/login)
@@ -65,6 +94,31 @@ sqlmapWebUI/
6594

6695
功能:右键菜单发送请求、配置管理、活动日志
6796

97+
## 核心功能
98+
99+
### 任务管理
100+
- 创建/监控/停止 SQL 注入扫描任务
101+
- 实时日志查看
102+
- 批量操作(批量停止、批量删除、清空全部)
103+
- 多维度过滤(URL、报文、状态、日期范围、注入状态)
104+
- 多字段排序
105+
- 汇总统计行
106+
- 智能轮询(根据任务状态调整刷新频率)
107+
108+
### 请求头规则管理
109+
- **持久化规则**: 存储在数据库的长期规则
110+
- 完整 CRUD 操作
111+
- 优先级排序 (0-100)
112+
- 多种替换策略
113+
- **会话级规则**: 带 TTL 的临时规则
114+
- **作用域配置**: 可选的 URL 匹配规则
115+
- 协议匹配 (http/https)
116+
- 主机名匹配(支持通配符)
117+
- 端口匹配(支持多值)
118+
- 路径匹配(支持通配符)
119+
- 正则表达式支持
120+
- **批量导入**: 从文本批量导入请求头
121+
68122
## 开发命令
69123

70124
### 后端开发
@@ -85,6 +139,7 @@ pnpm run build # 构建生产版本
85139
### VulnShop 靶场
86140
```bash
87141
cd src/vulnTestServer
142+
pip install flask
88143
python server.py
89144
```
90145

@@ -111,6 +166,11 @@ mvn clean package -DskipTests
111166
- 启用 gzip 压缩
112167
- 手动代码分割: vendor、primevue、utils
113168

169+
### 数据库
170+
- 任务数据存储在内存(DataStore 单例)
171+
- 请求头规则存储在 SQLite (`header_rules.db`)
172+
- 自动数据库迁移(schema 变更时自动添加新列)
173+
114174
## 主题系统
115175

116176
### 前端 (Vue 3 + PrimeVue)
@@ -130,11 +190,19 @@ mvn clean package -DskipTests
130190
1.`src/backEnd/api/` 对应模块中创建路由
131191
2.`app.py` 中注册路由
132192
3. 前端在 `src/frontEnd/src/api/` 中添加对应请求函数
193+
4. 更新 TypeScript 类型定义
133194

134195
### 添加新的前端页面
135196
1.`src/frontEnd/src/views/` 中创建页面组件
136197
2. 在路由配置中添加新路由
137198
3. 使用 PrimeVue 组件保持 UI 一致性
199+
4. 在 Pinia store 中添加状态管理
200+
201+
### 添加带作用域的请求头规则
202+
1. 后端:规则包含 scope 字段(可选,null = 全局)
203+
2. 前端:使用 ScopeConfigPanel 组件
204+
3. 作用域支持:协议、主机、端口、路径模式
205+
4. 匹配逻辑:所有配置字段使用 AND 逻辑
138206

139207
### 修改 SQLMap 集成
140208
1. SQLMap 代码位于 `src/backEnd/third_lib/sqlmap/`
@@ -153,6 +221,19 @@ mvn clean package -DskipTests
153221
2. 运行 `mvn clean package -DskipTests`
154222
3. 生成的 JAR 文件在 `target/` 目录
155223

224+
## 测试
225+
226+
### 后端测试
227+
```bash
228+
cd src/backEnd
229+
python -m pytest tests/
230+
```
231+
232+
测试文件:
233+
- `test_scope_matcher.py` - 作用域匹配测试
234+
- `test_header_processor_scope.py` - 请求头处理器测试
235+
- `test_api_endpoints.py` - API 端点测试
236+
156237
## 安全考虑
157238

158239
此项目为授权安全测试工具,仅用于:
@@ -168,3 +249,22 @@ VulnShop 靶场仅绑定 127.0.0.1,禁止暴露到公网。
168249
- 代码变更需提交至 Git 仓库并打上版本标签
169250
- 使用 `git push origin --tags` 同步标签到远程
170251
- 遵循语义化版本号规范
252+
253+
### 提交信息格式
254+
```
255+
feat: 新功能
256+
fix: 修复 bug
257+
perf: 性能优化
258+
refactor: 代码重构
259+
docs: 文档更新
260+
test: 测试相关
261+
chore: 构建/维护
262+
ci: CI/CD 变更
263+
```
264+
265+
### 发布流程
266+
1. 更新 `config.py` 中的 VERSION
267+
2. 提交代码:`git add . && git commit -m "..."`
268+
3. 创建标签:`git tag release-v1.x.x`
269+
4. 推送:`git push origin master && git push origin --tags`
270+
5. GitHub Actions 自动构建和发布

0 commit comments

Comments
 (0)