You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 11, 2025. It is now read-only.
"You have completed all the stages. Congratulations!",
57
58
"success")
58
59
returnrender_template(
59
-
"message.html",
60
+
"error.html",
60
61
title="Congratulations!",
61
62
message="You have completed all the stages of the CTF. ",
62
63
)
@@ -87,7 +88,7 @@ def flags():
87
88
flash(
88
89
"You have completed all the stages. Congratulations!", "success", )
89
90
returnrender_template(
90
-
"message.html",
91
+
"error.html",
91
92
title="Congratulations!",
92
93
message="You have completed all the stages of the CTF. ",
93
94
)
@@ -128,18 +129,20 @@ def flags():
128
129
129
130
130
131
@bp.route("/", methods=["GET"]) # also for index
131
-
@bp.route("/index", methods=["GET"])
132
132
@bp.route("/home", methods=["GET"])
133
+
@bp.route("/index", methods=["GET"])
133
134
@bp.route("/index.html", methods=["GET"])
134
135
defindex():
135
-
# initialize session variables
136
+
# initialize session variables if they don't exist
136
137
if"submitted_flags"notinsession:
137
138
session["submitted_flags"] = []
138
139
if"current_stage"notinsession:
139
140
session["current_stage"] =1
140
141
if"hint_index"notinsession:
141
142
session["hint_index"] =0
142
-
143
+
if"token"notinsession:
144
+
session["token"] =str(uuid.uuid4()) # generate a random token
145
+
143
146
flash("Welcome to the CTF, please read the following:", "info")
144
147
brief="""
145
148
Using this site is not required to solve the CTF challenge and is not a part of the CTF challenge itself, but a tool to help you keep track of your progress. You need to find the flags on your own and not via this site itself. Good luck!
@@ -158,10 +161,11 @@ def index():
158
161
@bp.route("/reset", methods=["GET"])
159
162
@bp.route("/reset.html", methods=["GET"])
160
163
defrestart():
161
-
session.clear()
162
-
flash("Progress reset. You are back to Stage 1.", "info")
164
+
[session.pop(key, None)
165
+
forkeyinlist(session.keys())] # clear the session
166
+
flash("Progress reset. You are back to the first stage.", "info")
163
167
# reroute to index
164
-
returnredirect(url_for("ctf.index"))
168
+
returnredirect(url_for("ctf.index"), code=301)
165
169
166
170
167
171
# error pages
@@ -170,12 +174,12 @@ def page_not_found(error):
170
174
returnrender_template("404.html"), 404
171
175
172
176
173
-
# nice page for anything else using message.html and return 500
177
+
# nice page for anything else using error.html and return 500
0 commit comments