Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.

Commit e8598ef

Browse files
committed
more hints
1 parent 566a457 commit e8598ef

File tree

2 files changed

+28
-31
lines changed

2 files changed

+28
-31
lines changed

flags.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
"Blind in one eye, deaf in the other.",
66
"Zoom in, zoom out, and you'll find what you seek.",
77
"You have the audacity to ask for another hint, so soon?",
8-
"Spectro",
9-
"Linearity is a myth.",
8+
"Spectre", #spectrogram
9+
"Linearity is a myth.", #linear in spectrogram
10+
"Look in the mirror, that's your competition.",
1011
],
1112
"notes": "It doesn't get easier, you just get better.",
1213
},
@@ -16,9 +17,10 @@
1617
"Dig a little deeper.",
1718
"Are you using Any of the right tools?",
1819
"Try browsing a little more.",
19-
"CAA",
20+
"Don't find your certificate in the worth, find your worth in the certificate",
21+
"Check your CArtification at the door.",
2022
],
21-
"notes": "A bad workman always blames his tools.",
23+
"notes": "Meta-data is your friend.",
2224
},
2325
3: {
2426
"flag": "{Its4m34Br0w53r}",
@@ -38,7 +40,8 @@
3840
"You cannot reach the right destination by walking on the wrong path",
3941
"A path is a prior interpretation of the best way to traverse a landscape.",
4042
"One new notification",
41-
"Check the trash.",
43+
"One man's trash is another man's treasure.", # recycle bin
44+
"Reduce, Reuse, Recycle",
4245
],
4346
"notes": "Some flags can unlock more than one door.",
4447
},
@@ -62,4 +65,4 @@
6265
],
6366
"notes": "Nearly there!",
6467
}
65-
}
68+
}

hints/routes.py

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ def flags():
4040
if not submitted_flag.isascii(): # make sure its ascii only and not invalid
4141
flash("Invalid flag. Please try again.", "danger")
4242
return redirect(url_for("ctf.flags"))
43-
# everything before the first { can be case insensitive
44-
43+
4544

4645
if submitted_flag in submitted_flags:
4746
flash("You already submitted this flag.", "info")
@@ -55,49 +54,44 @@ def flags():
5554
current_stage += 1
5655
hint_index = 0
5756
elif current_stage == len(stages):
58-
flash(
57+
flash( # if the user has completed all the stages, then flash a message
5958
"You have completed all the stages. Congratulations!",
6059
"success")
6160
return render_template(
6261
"error.html",
6362
title="Congratulations!",
6463
message="You have completed all the stages of the CTF. ",
6564
)
66-
# if the user has completed all the stages, then flash a
67-
# message
6865
session["current_stage"] = current_stage
6966
else:
7067
found = False
71-
# if the flag is for a different stage, then put them on their
72-
# stage
68+
# if the flag is for a different stage, then warn them
7369
for stage, stage_data in stages.items():
74-
if submitted_flag == stage_data["flag"]:
70+
if submitted_flag == stage_data["flag"]: # out of order
7571
flash(
76-
f"That's the flag for stage {stage}, but in the wrong order", "info")
77-
current_stage = stage
72+
f"That's the flag for stage {stage}, but in the wrong order, try to go back and find the right one", "info")
73+
# current_stage = stage
7874
hint_index = 0
7975
found = True
8076

81-
if submitted_flag not in submitted_flags:
77+
if submitted_flag not in submitted_flags: # no duplicates
8278
submitted_flags.append(submitted_flag)
8379
session["submitted_flags"] = submitted_flags
8480

85-
# check if they got all the flags (even if they are out
86-
# of order)
81+
# check if they got all the flags (even if they are out of order)
8782
if sorted(submitted_flags) == sorted(
8883
[stage_data["flag"] for stage_data in stages.values()]
8984
):
9085
flash(
9186
"You have completed all the stages. Congratulations!", "success", )
9287
return render_template(
93-
"error.html",
88+
"error.html", #not really an error, but a message
9489
title="Congratulations!",
9590
message="You have completed all the stages of the CTF. ",
96-
)
97-
# if the user has completed all the stages, then flash a
98-
# message
91+
),200
92+
# if the user has completed all the stages, then flash a message
9993
break
100-
# else:
94+
# after going through all stages, flag isn't there
10195
if not found:
10296
flash("Incorrect flag. Try again.", "danger")
10397

@@ -115,17 +109,17 @@ def flags():
115109
flash(
116110
"Exhausted all hints for this stage :( Try harder!", "warning")
117111
# hide the button till they get to next stage
118-
session["hint_index"] = hint_index
119-
hints = stages[current_stage]["hints"][:hint_index]
120-
notes = stages[current_stage].get("notes")
112+
session["hint_index"] = hint_index # update the hint index
113+
hints = stages[current_stage]["hints"][:hint_index] # get the hints based on the hint index
114+
notes = stages[current_stage].get("notes") # get the notes if they exist
121115
return render_template(
122116
"flags.html",
123117
title=f"CTFlask - Stage {current_stage}",
124118
stage=current_stage,
125-
hints=hints,
126-
hint_index=hint_index,
127-
submitted_flags=submitted_flags,
128-
num_hints=len(stages[current_stage]["hints"]),
119+
hints=hints, # hints to display
120+
hint_index=hint_index, # current hint index
121+
submitted_flags=submitted_flags,
122+
num_hints=len(stages[current_stage]["hints"]), # total number of hints
129123
notes=notes,
130124
)
131125

0 commit comments

Comments
 (0)