diff --git a/challenges/mock-track-apache-php/track.yaml b/challenges/mock-track-apache-php/track.yaml index 0996448..f2bf751 100644 --- a/challenges/mock-track-apache-php/track.yaml +++ b/challenges/mock-track-apache-php/track.yaml @@ -16,9 +16,24 @@ flags: cfss: "CFSS:0.3/TS:B/E:M/HSFC:N=4-7" tags: discourse: mock_track_apache_php_flag_1 -services: - - name: HTTP-80 - instance: mock-track-apache-php - address: '9000:d37e:c40b:c5e8:216:3eff:fed5:1ca1' - port: 80 - check: http +instances: + mock-track-apache-php: + image: "images:ubuntu/24.04" + profiles: + - "default" + - "containers" + type: "container" + description: "Mock Apache + PHP track" + # This second half of a MAC address was automatically generated. The first half is just below + hwaddr: "00:16:3e:6c:c3:c0" + # This is the subdomain value for this machine. Do NOT include .ctf, it will be automatically added. + # For example, if the value of the record is a.b.c, a DNS record will be created for a.b.c.ctf + record: "mock.track" + # This second half of the IPv6 is derived from the hwaddr. + ipv6: "9000:d37e:c40b:aa70:216:3eff:fe6c:c3c0" + config: {} + devices: [] + services: + - name: HTTP-80 + port: 80 + check: http diff --git a/ctf/__main__.py b/ctf/__main__.py index 2c064d2..0606e1a 100644 --- a/ctf/__main__.py +++ b/ctf/__main__.py @@ -30,7 +30,8 @@ from ctf.version import app as version_app app = Typer( - help="CLI tool to manage CTF challenges as code. Run from the root CTF repo directory or set the CTF_ROOT_DIR environment variable to run the tool." + help="CLI tool to manage CTF challenges as code. Run from the root CTF repo directory or set the CTF_ROOT_DIR environment variable to run the tool.", + no_args_is_help=True, ) app.add_typer(validate_app) app.add_typer(init_app) diff --git a/ctf/stats.py b/ctf/stats.py index 9fb53ec..0a87c8e 100644 --- a/ctf/stats.py +++ b/ctf/stats.py @@ -107,7 +107,13 @@ def stats( if number_of_flags > stats["most_flags_in_a_track"]: stats["most_flags_in_a_track"] = number_of_flags stats["number_of_flags"] += number_of_flags - stats["number_of_services"] += len(track_yaml["services"]) + instances = track_yaml.get("instances", {}).values() + services = track_yaml.get("services", []) + [ + service + for instance in instances + for service in instance.get("services", []) + ] + stats["number_of_services"] += len(services) stats["number_of_points_per_track"][track] = 0 for flag in track_yaml["flags"]: flags.append(flag["value"]) @@ -118,7 +124,7 @@ def stats( if flag["value"] not in stats["flag_count_per_value"]: stats["flag_count_per_value"][flag["value"]] = 0 stats["flag_count_per_value"][flag["value"]] += 1 - for service in track_yaml["services"]: + for service in services: if service["port"] not in stats["number_of_services_per_port"]: stats["number_of_services_per_port"][service["port"]] = 0 stats["number_of_services_per_port"][service["port"]] += 1