diff --git a/server/api/problem.py b/server/api/problem.py index 56c035f..6ee206a 100644 --- a/server/api/problem.py +++ b/server/api/problem.py @@ -2,7 +2,7 @@ import hashlib import logger import os -from flask import Blueprint, session, request +from flask import Blueprint, jsonify, session, request from flask import current_app as app from werkzeug import secure_filename @@ -120,3 +120,16 @@ def problem_submit(): else: return { "success": 0, "message": "Problem does not exist!" } + +@blueprint.route("/data", methods=["POST"]) +#@api_wrapper # Disable atm due to json serialization issues: will fix +@login_required +def problem_data(): + problems = Problems.query.add_columns("pid", "name", "category", "description", "hint", "value", "solves").order_by(Problems.value).filter_by(disabled=False).all() + jason = [] + + for problem in problems: + problem_files = [ str(_file.location) for _file in Files.query.filter_by(pid=int(problem.pid)).all() ] + jason.append({"pid": problem[1], "name": problem[2] ,"category": problem[3], "description": problem[4], "hint": problem[5], "value": problem[6], "solves": problem[7], "files": problem_files}) + + return jsonify(data=jason) diff --git a/server/config.py b/server/config.py index 8d3112c..a28a51f 100644 --- a/server/config.py +++ b/server/config.py @@ -15,7 +15,7 @@ SECRET_KEY = key SQLALCHEMY_DATABASE_URI = "mysql://root:i_hate_passwords@localhost/easyctf" SQLALCHEMY_TRACK_MODIFICATIONS = False -UPLOAD_FOLDER = os.path.normpath("uploads") +UPLOAD_FOLDER = os.path.normpath("files") CTF_BEGIN = 0 # To be used later CTF_END = 0 # To be used later diff --git a/web/admin/submission.html b/web/admin/submission.html deleted file mode 100644 index 7affe51..0000000 --- a/web/admin/submission.html +++ /dev/null @@ -1,109 +0,0 @@ - - -
- - -` + data[i]["description"] + `
+Do we even need this problem, just take the flag.
- EasyCTF{no}
-
This is a very very hard problem. Here it is:
- EasyCTF{yes}
-