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

Commit 912f716

Browse files
committed
favicons and minor improvements
1 parent d6d211d commit 912f716

12 files changed

+33
-19
lines changed

hints/flags.py renamed to flags.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@
2121
"Almost there"
2222
]
2323
}
24-
}
24+
}
25+
26+
# if __name__ == "__main__":
27+
# print(stages)

hints/routes.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
from flask import Blueprint, render_template, request, redirect, url_for, flash, make_response, session
22
import datetime
3-
from flags import stages
3+
from flags import stages # import everything from flags.py
44
bp = Blueprint('ctf', __name__)
55

6-
7-
86
current_stage = 1
97
hint_index = 0
108

@@ -59,9 +57,10 @@ def flags():
5957
# flash a message to the user
6058

6159
flash("No new hints :( Try harder!", 'info')
60+
# hide the button till they get to next stage
6261

6362
hints = stages[current_stage]['hints'][:hint_index + 1]
64-
return render_template('flags.html', stage=current_stage, hints=hints, hint_index=hint_index, submitted_flags=submitted_flags)
63+
return render_template('flags.html', stage=current_stage, hints=hints, hint_index=hint_index, submitted_flags=submitted_flags, num_hints=len(stages[current_stage]['hints']))
6564

6665

6766
@bp.route('/', methods=['GET']) # also for index
@@ -75,15 +74,16 @@ def index():
7574
if "current_stage" not in session:
7675
session['current_stage'] = 1
7776

78-
flash("Welcome to the CTF, please read the following messages: ", 'info')
77+
flash("Welcome to the CTF, please read the following:", 'info')
7978
brief = """
80-
This site is not required to solve the CTF challenge. It does not store any of your flags, so make sure to keep track of them yourself!
79+
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. The flags are not hidden on this site. You need to find them on your own. Good luck!
80+
8181
\n
82-
Do not use this site for any illegal activities, please do not attack it in any way as it harms other users who are solving the CTF.
83-
The site collects logs for security purposes.
84-
This site is not a part of the CTF challenge itself, but a tool to help you keep track of your progress. The flags are not hidden on this site. You need to find them on your own. Good luck!
82+
Do not use this site for any illegal activities, please do not attack it in any way as it harms other users who are solving the CTF. The site collects logs for security purposes.
8583
\n
8684
"""
85+
# everwhere where is /n, replace with <br> for html
86+
brief = brief.split('\n')
8787

8888
return render_template('index.html', summary=brief)
8989

@@ -96,12 +96,16 @@ def restart():
9696
flash("Progress reset. You are back to Stage 1.", 'info')
9797
# reroute to index
9898
return redirect(url_for('ctf.index'))
99-
# resp = make_response(redirect(url_for('ctf.index')))
100-
# resp.set_cookie('stage', '1', httponly=True)
101-
# resp.set_cookie('hint_index', '0', httponly=True)
102-
# flash("Progress reset. You are back to Stage 1.", 'info')
103-
# return resp
10499

100+
# error pages
101+
@bp.app_errorhandler(404)
102+
def page_not_found(error):
103+
return render_template('404.html'), 404
104+
105+
# nice page for anything else using message.html and return 500
106+
@bp.app_errorhandler(500)
107+
def internal_server_error(error):
108+
return render_template('message.html', title="500 Internal Server Error", message="Please try again later"), 500
105109

106110

107111
@bp.context_processor
Loading
23.5 KB
Loading
5.83 KB
Loading
544 Bytes
Loading
899 Bytes
Loading

hints/static/favicons/favicon.ico

15 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}

hints/templates/404.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ <h1 class="error">
1616

1717
{% block body %}
1818
<h2>Oops! Looks like the page doesn't exist anymore</h2>
19-
<a href="{{ url_for('index') }}">Click Here</a> to go to the Home Page
20-
19+
<a href="{{ url_for('ctf.index') }}">Click Here</a> to return to the Home Page
2120
{% endblock %}
2221

2322
{% endblock %}

hints/templates/flags.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@ <h4>Hints:</h4>
4040
{% else %}
4141
<p>No hints revealed yet.</p>
4242
{% endif %}
43+
4344
<form method="POST">
4445
<button type="submit" name="reveal_hint" class="btn btn-secondary">Reveal Next Hint</button>
4546
</form>
46-
{#<!-- {% if hint_index < len(stages[stage]['hints']) - 1 %} -->
47+
48+
{#<!-- {% if hint_index < num_hints-1 %}
49+
-->
4750
<form method="POST">
4851
<button type="submit" name="reveal_hint" class="btn btn-secondary">Reveal Next Hint</button>
4952
</form>

hints/templates/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ <h1 class="text-center">CTF Platform</h1>
2424
<!-- give a brief summary of the challenge -->
2525
<div class="mt-4">
2626
<h3>Challenge Summary</h3>
27-
<p>{{ summary }}</p>
27+
{% for para in summary %}
28+
<p>{{para}}</p>
29+
{% endfor %}
30+
31+
<!-- <p>{{ summary }}</p> -->
2832
</div>
2933
<!-- button: start CTF -->
3034
<div class="mt-4">

0 commit comments

Comments
 (0)