Skip to content

Commit c4a777f

Browse files
authored
Add connection_info that's supported in CTFd 3.4 (#68)
* Adds support for the connection_info field that's supported for Challenges in CTFd 3.4
1 parent f35c4bc commit c4a777f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

ctfcli/spec/challenge-example.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ image: null
3232
host: null
3333

3434
# Optional settings
35+
36+
# connection_info is used to provide a link, hostname, or instructions on how to connect to a challenge
37+
connection_info: nc hostname 12345
38+
3539
# Can be removed if unused
3640
attempts: 5
3741

@@ -98,7 +102,6 @@ hints:
98102
requirements:
99103
- "Warmup"
100104
- "Are you alive"
101-
- 1
102105

103106
# The state of the challenge.
104107
# If the field is omitted, the challenge is visible by default.

ctfcli/utils/challenge.py

+6
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ def sync_challenge(challenge, ignore=[]):
4646
if challenge.get("attempts") and "attempts" not in ignore:
4747
data["max_attempts"] = challenge.get("attempts")
4848

49+
if challenge.get("connection_info") and "connection_info" not in ignore:
50+
data["connection_info"] = challenge.get("connection_info")
51+
4952
data["state"] = "hidden"
5053

5154
installed_challenges = load_installed_challenges()
@@ -219,6 +222,9 @@ def create_challenge(challenge, ignore=[]):
219222
if challenge.get("attempts") and "attempts" not in ignore:
220223
data["max_attempts"] = challenge.get("attempts")
221224

225+
if challenge.get("connection_info") and "connection_info" not in ignore:
226+
data["connection_info"] = challenge.get("connection_info")
227+
222228
s = generate_session()
223229

224230
r = s.post("/api/v1/challenges", json=data)

0 commit comments

Comments
 (0)