Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions challenges/mock-track-apache-php/track.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion ctf/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 8 additions & 2 deletions ctf/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand All @@ -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
Expand Down
Loading