Models
Challenge
¶
Bases: Model
Represents a challenge.
Attributes:
Name | Type | Description |
---|---|---|
author |
str
|
The author of the challenge. |
category |
str
|
The category of the challenge. |
description |
str
|
The description of the challenge. |
difficulty |
str
|
The difficulty of the challenge. |
name |
str
|
The name of the challenge. |
folder_name |
str
|
The folder name for the challenge. Must follow the pattern |
files |
list[Path | HttpUrl]
|
The list of files for the challenge. |
requirements |
list[str]
|
The list of requirements needed to unlock the challenge. |
extras |
dict[str, str | int | float | bool]
|
Extra information for the challenge. |
flags |
list[Flag]
|
The list of flags for the challenge. |
hints |
list[Hint]
|
The list of hints for the challenge. |
services |
list[Service]
|
The list of services for the challenge. |
Source code in src\ctf_architect\models\challenge.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|
ChallengeFile
¶
Bases: Model
Represents a chall.toml config file.
Attributes:
Name | Type | Description |
---|---|---|
version |
str
|
The specification version. |
challenge |
Challenge
|
The challenge object. |
Source code in src\ctf_architect\models\challenge.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
from_challenge
classmethod
¶
from_challenge(challenge: Challenge) -> ChallengeFile
Create a ChallengeFile object from a Challenge object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
challenge |
Challenge
|
The Challenge object to convert. |
required |
Returns:
Name | Type | Description |
---|---|---|
ChallengeFile |
ChallengeFile
|
The converted ChallengeFile object. |
Source code in src\ctf_architect\models\challenge.py
230 231 232 233 234 235 236 237 238 239 240 |
|
Flag
¶
Bases: Model
Represents a challenge flag.
Attributes:
Name | Type | Description |
---|---|---|
flag |
str
|
The flag string. |
regex |
bool
|
Specifies whether the flag is a regular expression. Defaults to False. |
case_insensitive |
bool
|
Specifies whether the flag is case-insensitive. Defaults to False. |
Source code in src\ctf_architect\models\challenge.py
14 15 16 17 18 19 20 21 22 23 24 25 |
|
Hint
¶
Bases: Model
Represents a challenge hint.
Attributes:
Name | Type | Description |
---|---|---|
cost |
int
|
The cost of the hint. |
content |
str
|
The content of the hint. |
requirements |
list[int]
|
The list of requirements needed to unlock the hint. |
Source code in src\ctf_architect\models\challenge.py
28 29 30 31 32 33 34 35 36 37 38 39 |
|
Service
¶
Bases: Model
Represents a challenge service.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the service. |
path |
Path
|
The path to the service. |
port |
int
|
The port of the service. Allowed to be unspecified if the service is internal or |
ports |
list[int]
|
The list of ports of the service. Allowed to be unspecified if the service is internal or |
type |
Literal['web', 'tcp', 'ssh', 'secret', 'internal']
|
The type of the service. |
extras |
dict[str, Any]
|
The extra information about the service to be passed to the docker compose file. Defaults to None. |
Source code in src\ctf_architect\models\challenge.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
ConfigFile
¶
Bases: Model
Represents a ctf_config.toml config file.
Attributes:
Name | Type | Description |
---|---|---|
version |
str
|
The specification version. |
config |
CTFConfig
|
The CTF config object. |
Source code in src\ctf_architect\models\ctf_config.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
from_ctf_config
classmethod
¶
from_ctf_config(config: CTFConfig) -> ConfigFile
Create a ConfigFile object from a CTFConfig object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config |
CTFConfig
|
The CTFConfig object to convert. |
required |
Returns:
Name | Type | Description |
---|---|---|
ConfigFile |
ConfigFile
|
The converted ConfigFile object. |
Source code in src\ctf_architect\models\ctf_config.py
71 72 73 74 75 76 77 78 79 80 81 |
|
CTFConfig
¶
Bases: Model
Represents the configuration for a CTF.
Attributes:
Name | Type | Description |
---|---|---|
categories |
list[str]
|
The list of categories for the CTF. |
difficulties |
list[str]
|
The list of difficulties for the CTF. |
flag_format |
str | None
|
The flag format for the CTF. |
starting_port |
int | None
|
The starting port for services in the CTF. |
name |
str
|
The name of the CTF. |
extras |
list[ExtraField] | None
|
The list of extra fields for challenges in the CTF. |
Source code in src\ctf_architect\models\ctf_config.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
CheckResult
¶
Bases: Model
Represents the result of a check.
Attributes:
Name | Type | Description |
---|---|---|
status |
CheckStatus
|
The status of the check. |
code |
str
|
The code of the check. |
level |
SeverityLevel
|
The severity level of the check. |
message |
str
|
The message of the check. Defaults to None. |
Source code in src\ctf_architect\models\lint.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
CheckStatus
¶
Bases: StrEnum
Status of a check.
Source code in src\ctf_architect\models\lint.py
32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
LintResult
¶
Bases: Model
Represents the result of a lint check.
Attributes:
Name | Type | Description |
---|---|---|
challenge_path |
Path
|
The path to the challenge. |
passed |
list[CheckResult]
|
Checks that passed. |
ignored |
list[CheckResult]
|
Checks that were ignored. |
skipped |
list[CheckResult]
|
Checks that were skipped. |
failed |
list[CheckResult]
|
Checks that failed. |
errors |
list[CheckResult]
|
Checks that had errors |
Source code in src\ctf_architect\models\lint.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
SeverityLevel
¶
Bases: Enum
Severity level of a rule.
Source code in src\ctf_architect\models\lint.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
WARNING
class-attribute
instance-attribute
¶
WARNING = 1
Challenge will be able to be loaded, but may have issues
ERROR
class-attribute
instance-attribute
¶
ERROR = 2
Challenge will be unable to be loaded, but other rules can be checked
FATAL
class-attribute
instance-attribute
¶
FATAL = 3
Challenge will be unable to be loaded, non-fatal rules cannot be checked
PortMapping
¶
Bases: Model
Represents a port mapping for a service.
Attributes:
Name | Type | Description |
---|---|---|
from_port |
int
|
The starting port for the mapping. |
to_port |
int | None
|
The ending port for the mapping. |
Source code in src\ctf_architect\models\port_mapping.py
7 8 9 10 11 12 13 14 15 16 |
|
PortMappingFile
¶
Bases: Model
Represents a port_mapping.json file.
Attributes:
Name | Type | Description |
---|---|---|
version |
str
|
The specification version. |
mapping |
dict[str, list[PortMapping]]
|
The port mapping object. |
Source code in src\ctf_architect\models\port_mapping.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
from_mapping
classmethod
¶
from_mapping(
mapping: dict[str, list[PortMapping]]
) -> PortMappingFile
Create a PortMappingFile object from a port mapping object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mapping |
dict[str, list[PortMapping]]
|
The port mapping object to convert. |
required |
Returns:
Name | Type | Description |
---|---|---|
PortMappingFile |
PortMappingFile
|
The converted PortMappingFile object. |
Source code in src\ctf_architect\models\port_mapping.py
30 31 32 33 34 35 36 37 38 39 40 |
|