-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathctf_platform.sql
More file actions
250 lines (224 loc) · 11.4 KB
/
Copy pathctf_platform.sql
File metadata and controls
250 lines (224 loc) · 11.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
-- Active: 1752662486672@@127.0.0.1@3306@ctf_platform
/*
Navicat Premium Dump SQL
Source Server : yolo
Source Server Type : MySQL
Source Server Version : 80040 (8.0.40)
Source Host : localhost:3306
Source Schema : ctf_platform
Target Server Type : MySQL
Target Server Version : 80040 (8.0.40)
File Encoding : 65001
Date: 15/07/2025 22:37:35
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for attachments
-- ----------------------------
DROP TABLE IF EXISTS `attachments`;
CREATE TABLE `attachments` (
`id` int NOT NULL AUTO_INCREMENT,
`filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`original_filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`filepath` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`challenge_id` int NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `challenge_id`(`challenge_id` ASC) USING BTREE,
CONSTRAINT `attachments_ibfk_1` FOREIGN KEY (`challenge_id`) REFERENCES `challenges` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of attachments
-- ----------------------------
-- ----------------------------
-- Table structure for attack_simulations
-- ----------------------------
DROP TABLE IF EXISTS `attack_simulations`;
CREATE TABLE `attack_simulations` (
`id` int NOT NULL AUTO_INCREMENT,
`attack_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`attack_level` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`simulation_result` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`success_probability` int NULL DEFAULT NULL,
`created_at` datetime NULL DEFAULT NULL,
`challenge_id` int NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `challenge_id`(`challenge_id` ASC) USING BTREE,
CONSTRAINT `attack_simulations_ibfk_1` FOREIGN KEY (`challenge_id`) REFERENCES `challenges` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of attack_simulations
-- ----------------------------
-- ----------------------------
-- Table structure for categories
-- ----------------------------
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
`color` varchar(7) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `name`(`name` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of categories
-- ----------------------------
INSERT INTO `categories` VALUES (1, 'Web', 'Web安全题目', '#7aa2f7');
INSERT INTO `categories` VALUES (2, 'Crypto', '密码学题目', '#bb9af7');
INSERT INTO `categories` VALUES (3, 'Reverse', '逆向工程题目', '#7dcfff');
INSERT INTO `categories` VALUES (4, 'Pwn', '二进制漏洞题目', '#f7768e');
INSERT INTO `categories` VALUES (5, 'Forensics', '取证分析题目', '#9ece6a');
INSERT INTO `categories` VALUES (6, 'Misc', '杂项题目', '#e0af68');
-- ----------------------------
-- Table structure for challenges
-- ----------------------------
DROP TABLE IF EXISTS `challenges`;
CREATE TABLE `challenges` (
`id` int NOT NULL AUTO_INCREMENT,
`title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`flag` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`points` int NULL DEFAULT NULL,
`difficulty` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`is_active` tinyint(1) NULL DEFAULT NULL,
`created_at` datetime NULL DEFAULT NULL,
`is_ai_generated` tinyint(1) NULL DEFAULT NULL,
`ai_scenario_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
`category_id` int NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `category_id`(`category_id` ASC) USING BTREE,
CONSTRAINT `challenges_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of challenges
-- ----------------------------
INSERT INTO `challenges` VALUES (1, 'Welcome to CTF', '这是一道简单的入门题目。Flag就在页面源码中!\n\n', 'flag{welcome_to_neon_ctf}', 50, 'Easy', 1, '2025-07-15 14:33:45', 0, NULL, 1);
-- ----------------------------
-- Table structure for defense_strategies
-- ----------------------------
DROP TABLE IF EXISTS `defense_strategies`;
CREATE TABLE `defense_strategies` (
`id` int NOT NULL AUTO_INCREMENT,
`defense_level` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`strategy_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`estimated_effectiveness` int NULL DEFAULT NULL,
`created_at` datetime NULL DEFAULT NULL,
`simulation_id` int NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `simulation_id`(`simulation_id` ASC) USING BTREE,
CONSTRAINT `defense_strategies_ibfk_1` FOREIGN KEY (`simulation_id`) REFERENCES `attack_simulations` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of defense_strategies
-- ----------------------------
-- ----------------------------
-- Table structure for hint_unlocks
-- ----------------------------
DROP TABLE IF EXISTS `hint_unlocks`;
CREATE TABLE `hint_unlocks` (
`id` int NOT NULL AUTO_INCREMENT,
`unlocked_at` datetime NULL DEFAULT NULL,
`user_id` int NOT NULL,
`hint_id` int NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `user_id`(`user_id` ASC) USING BTREE,
INDEX `hint_id`(`hint_id` ASC) USING BTREE,
CONSTRAINT `hint_unlocks_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `hint_unlocks_ibfk_2` FOREIGN KEY (`hint_id`) REFERENCES `hints` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of hint_unlocks
-- ----------------------------
-- ----------------------------
-- Table structure for hints
-- ----------------------------
DROP TABLE IF EXISTS `hints`;
CREATE TABLE `hints` (
`id` int NOT NULL AUTO_INCREMENT,
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`cost` int NULL DEFAULT NULL,
`challenge_id` int NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `challenge_id`(`challenge_id` ASC) USING BTREE,
CONSTRAINT `hints_ibfk_1` FOREIGN KEY (`challenge_id`) REFERENCES `challenges` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of hints
-- ----------------------------
INSERT INTO `hints` VALUES (1, '查看页面源代码,Flag可能隐藏在HTML注释中', 5, 1);
INSERT INTO `hints` VALUES (2, '使用Ctrl+U或F12开发者工具查看源码', 10, 1);
-- ----------------------------
-- Table structure for submissions
-- ----------------------------
DROP TABLE IF EXISTS `submissions`;
CREATE TABLE `submissions` (
`id` int NOT NULL AUTO_INCREMENT,
`flag_submitted` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`is_correct` tinyint(1) NULL DEFAULT NULL,
`points_awarded` int NULL DEFAULT NULL,
`submitted_at` datetime NULL DEFAULT NULL,
`user_id` int NOT NULL,
`challenge_id` int NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `user_id`(`user_id` ASC) USING BTREE,
INDEX `challenge_id`(`challenge_id` ASC) USING BTREE,
CONSTRAINT `submissions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `submissions_ibfk_2` FOREIGN KEY (`challenge_id`) REFERENCES `challenges` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of submissions
-- ----------------------------
-- ----------------------------
-- Table structure for user_ai_usages
-- ----------------------------
DROP TABLE IF EXISTS `user_ai_usages`;
CREATE TABLE `user_ai_usages` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL,
`feature_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`query` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`model_used` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`created_at` datetime NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `user_id`(`user_id` ASC) USING BTREE,
CONSTRAINT `user_ai_usages_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of user_ai_usages
-- ----------------------------
-- ----------------------------
-- Table structure for user_evaluations
-- ----------------------------
DROP TABLE IF EXISTS `user_evaluations`;
CREATE TABLE `user_evaluations` (
`id` int NOT NULL AUTO_INCREMENT,
`evaluation_report` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`overall_score` int NULL DEFAULT NULL,
`created_at` datetime NULL DEFAULT NULL,
`user_id` int NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `user_id`(`user_id` ASC) USING BTREE,
CONSTRAINT `user_evaluations_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of user_evaluations
-- ----------------------------
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int NOT NULL AUTO_INCREMENT,
`username` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`email` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`password_hash` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`is_admin` tinyint(1) NULL DEFAULT NULL,
`score` int NULL DEFAULT NULL,
`last_submit` datetime NULL DEFAULT NULL,
`created_at` datetime NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `username`(`username` ASC) USING BTREE,
UNIQUE INDEX `email`(`email` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;