INNER CODE UNIT · Python
get_screenshot
project-sekai-ctf/sekaictf-2025 · pwn/umiyuri-kaikeitan/challenge/app/app.py:119
def get_screenshot(uuid):
# Check if this task exists
task_doc = tasks_collection.find_one({"uuid": uuid})
if not task_doc:
abort(404)
# Check if the task has finished and return the screenshot if it's there
if task_doc["finished"]:
screenshot_path = os.path.join(app.config["SCREENSHOTS_FOLDER"], f"{uuid}.jpg")
if os.path.exists(screenshot_path):
return send_file(screenshot_path)
abort(404)
# Get the task status
status_response: TaskStatusResponse = task_status(task_doc["task_id"])
if status_response.error:
return "An error has occurred, please try submitting your exploit again.", 500