feat: challenge registry-driven platform + XVI/XVII imports + admin toggle + domain rename

- Rename repo/domain: attack-defense-platform / attackdefense.imrnes.team (all refs replaced)
- challenge_registry.json: single source of truth (28 challs across gemastik18/xvi/xvii)
- teams.py: registry-driven CHALLENGES, set_challenge_enabled, sync_challenge_runtime
  (apply enable/disable to live teams: build/up or stop/remove + receiver restart)
- compose_gen.py: render per-team compose from canonical per-challenge templates
  (image reuse, per-team ports 30xxx, flag mounts, passwords)
- gen_canonical_composes.py: canonical docker-compose.yml for all services
- import_new_challenges.py: import XVI/XVII services + EOL base image fixes
  (debian:buster→bookworm, node:14→20, python:3.7-slim→3.11)
- receiver: xvi package (10 checkers) + xvii package (12 generic checkers),
  Challenge base reads PASSWORD_<team_port> from env; gen_receiver_main.py
  generates per-team main.py from registry
- main.py: /api/challenges returns full registry; PATCH /api/challenges/<name>
  toggles enabled + applies to live teams
- index.html: 🏗️ Challenge Manager tab (toggle per challenge, grouped by set)
- SLA bonus now dynamic (all enabled challenges, not hardcoded 6)
This commit is contained in:
MythEclipse committed 2026-09-25 14:04:33 +08:00
1 parent c35b23a37f
commit c6fd9ec268
1317 files changed
+306586 -128

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
FROM python:3.11-slim-bookworm
ARG PASSWORD
ENV DEBIAN_FRONTEND noninteractive
RUN echo root:${PASSWORD} | chpasswd
COPY apt-insecure.conf /etc/apt/apt.conf.d/99gemastik-insecure
RUN apt-get -o Acquire::AllowInsecureRepositories=true update && apt-get install -y openssh-server curl nano
RUN echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
RUN service ssh start
RUN useradd --user-group --system --create-home --no-log-init --shell /bin/bash ctf
WORKDIR /home/ctf/app
COPY requirements.txt .
RUN pip install -r ./requirements.txt && rm ./requirements.txt
RUN echo "GEMASTIK{PLACEHOLDER}" > /flag.txt
COPY src/ .
COPY start.sh .
RUN chmod +x start.sh
CMD ./start.sh
+3
View File
@@ -0,0 +1,3 @@
Acquire::AllowInsecureRepositories "true";
Acquire::AllowDowngradeToInsecureRepositories "true";
Apt::Get::AllowUnauthenticated "true";
+18
View File
@@ -0,0 +1,18 @@
services:
more-less:
container_name: more-less_container
hostname: more-less
restart: always
build:
context: .
args:
- PASSWORD=$PASSWORD_22000
volumes:
- ../receiver/flags/more-less.txt:/flag.txt:ro
- ../utils/bashrc:/root/.bashrc:ro
- ../utils/preexec.sh:/root/.preexec.sh:ro
ports:
- "22000:8000"
- "22022:22"
extra_hosts:
- "host.docker.internal:host-gateway"
+2
View File
@@ -0,0 +1,2 @@
fastapi[standard]
pyyaml
+30
View File
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="https://cdn.tailwindcss.com"></script>
<title>ML</title>
</head>
<body class="bg-white">
<div class="grid h-screen place-content-center">
<div>
<h1 class="tracking-wide text-cyan-500 text-9xl font-bold px-2">ML</h1>
</div>
<form action="/" method="POST" enctype="multipart/form-data">
<label class="block">
<span class="sr-only">Choose YAML file</span>
<input type="file" id="file" name="file" class="block w-full text-sm text-gray-500
file:mr-4 file:py-2 file:px-4
file:rounded-md file:border-0
file:text-sm file:font-semibold
file:bg-cyan-500 file:text-white
hover:file:bg-cyan-600"/>
<div class="block w-full py-2">
<button type="submit" class="w-full py-2 px-4 rounded-md border-0 font-semibold bg-gradient-to-r from-teal-300 to-cyan-500 text-sm text-white hover:file:bg-cyan-600"> Convert </button>
</div>
</label>
</form>
</div>
</body>
</html>
+14
View File
@@ -0,0 +1,14 @@
from fastapi import FastAPI, File, UploadFile
from fastapi.responses import HTMLResponse
from yaml import load, Loader
app = FastAPI()
html = open("index.html").read()
@app.get("/")
def index():
return HTMLResponse(content=html, status_code=200)
@app.post("/")
def upload_file(file: UploadFile = File(...)):
return load(file.file, Loader=Loader)
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
/usr/sbin/sshd -D &
su ctf -c "fastapi run"