|
1 | 1 | from flask import Blueprint, render_template, request, redirect, url_for, flash, make_response, session
|
2 | 2 | import datetime
|
3 |
| - |
| 3 | +from flags import stages |
4 | 4 | bp = Blueprint('ctf', __name__)
|
5 | 5 |
|
6 |
| -# Sample dictionary with flags and multiple hints |
7 |
| -stages = { |
8 |
| - 1: { |
9 |
| - "flag": "flag{stage1}", |
10 |
| - "hints": [ |
11 |
| - "This is the least revealing hint for stage 1.", |
12 |
| - "This is a more revealing hint for stage 1.", |
13 |
| - "This is the most revealing hint for stage 1." |
14 |
| - ] |
15 |
| - }, |
16 |
| - 2: { |
17 |
| - "flag": "flag{stage2}", |
18 |
| - "hints": [ |
19 |
| - "This is the least revealing hint for stage 2.", |
20 |
| - "This is a more revealing hint for stage 2.", |
21 |
| - "This is the most revealing hint for stage 2." |
22 |
| - ] |
23 |
| - }, |
24 |
| - 3: { |
25 |
| - "flag": "flag{stage3}", |
26 |
| - "hints": [ |
27 |
| - "Almost there" |
28 |
| - ] |
29 |
| - } |
30 |
| -} |
| 6 | + |
31 | 7 |
|
32 | 8 | current_stage = 1
|
33 | 9 | hint_index = 0
|
@@ -88,27 +64,33 @@ def flags():
|
88 | 64 | return render_template('flags.html', stage=current_stage, hints=hints, hint_index=hint_index, submitted_flags=submitted_flags)
|
89 | 65 |
|
90 | 66 |
|
91 |
| -@bp.route('/', methods=['GET', 'POST']) # also for index |
92 |
| -@bp.route('/index', methods=['GET', 'POST']) |
93 |
| -@bp.route('/home', methods=['GET', 'POST']) |
94 |
| -@bp.route('/index.html', methods=['GET', 'POST']) |
| 67 | +@bp.route('/', methods=['GET']) # also for index |
| 68 | +@bp.route('/index', methods=['GET']) |
| 69 | +@bp.route('/home', methods=['GET']) |
| 70 | +@bp.route('/index.html', methods=['GET']) |
95 | 71 | def index():
|
96 | 72 | # initialize session variables
|
97 | 73 | if "submitted_flags" not in session:
|
98 | 74 | session['submitted_flags'] = []
|
99 | 75 | if "current_stage" not in session:
|
100 | 76 | session['current_stage'] = 1
|
101 | 77 |
|
102 |
| - flash("Welcome to the CTF! Can you find the flags?", 'info') |
| 78 | + flash("Welcome to the CTF, please read the following messages: ", 'info') |
103 | 79 | brief = """
|
104 |
| - 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. |
| 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! |
| 81 | + \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. |
105 | 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!
|
| 85 | + \n |
106 | 86 | """
|
107 | 87 |
|
108 |
| - return render_template('index.html', summary= brief) |
| 88 | + return render_template('index.html', summary=brief) |
109 | 89 |
|
110 |
| -@bp.route('/restart') |
111 |
| -@bp.route('/reset') |
| 90 | +@bp.route('/restart', methods=['GET']) |
| 91 | +@bp.route('/restart.html', methods=['GET']) |
| 92 | +@bp.route('/reset', methods=['GET']) |
| 93 | +@bp.route('/reset.html', methods=['GET']) |
112 | 94 | def restart():
|
113 | 95 | session.clear()
|
114 | 96 | flash("Progress reset. You are back to Stage 1.", 'info')
|
|
0 commit comments