Last active
November 29, 2025 15:43
-
-
Save yarienkiva/22c46612e256878418713119d4f5e431 to your computer and use it in GitHub Desktop.
Because I like being able to see all the flags being submitted :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import time | |
| import requests | |
| API_URL = os.environ.get("API_URL", "https://ctf.heroctf.fr/api/v1").rstrip("/") | |
| CTFD_TOKEN = os.environ.get( | |
| "CTFD_TOKEN", | |
| "ctfd_TOKEN_GOES_HERE", | |
| ) | |
| def ok(s): | |
| return "\033[92m {}\033[00m".format(s) | |
| def ko(s): | |
| return "\033[91m {}\033[00m".format(s) | |
| r = requests.get( | |
| f"{API_URL}/submissions", | |
| headers={ | |
| "Authorization": f"Token {CTFD_TOKEN}", | |
| "Content-Type": "application/json", | |
| }, | |
| ).json() | |
| latest_submission = r["meta"]["pagination"]["total"] | |
| while True: | |
| r = requests.get( | |
| f"{API_URL}/submissions/{latest_submission}", | |
| headers={ | |
| "Authorization": f"Token {CTFD_TOKEN}", | |
| "Content-Type": "application/json", | |
| }, | |
| ).json() | |
| if "message" in r: | |
| time.sleep(3) | |
| continue | |
| else: | |
| latest_submission += 1 | |
| # flag submitted, right or wrong | |
| flag = r["data"]["provided"] | |
| # if the flag's correct or not | |
| corr = r["data"]["type"] | |
| team = r["data"]["team"]["name"] | |
| user = r["data"]["user"]["name"] | |
| chall = r["data"]["challenge"]["name"] | |
| out = f"{latest_submission-1} at {int(time.time())}: {flag!r} by {user!r} ({team!r}) in {chall!r}" | |
| print(ok(out) if corr == "correct" else ko(out)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment