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:
1 parent
c35b23a37f
commit
c6fd9ec268
1317 files changed
+306586
-128
No files matched your search
@@ -0,0 +1,25 @@
|
||||
FROM python:3.11-slim-bookworm
|
||||
|
||||
ARG PASSWORD
|
||||
|
||||
WORKDIR /opt
|
||||
|
||||
COPY apt-insecure.conf /etc/apt/apt.conf.d/99gemastik-insecure
|
||||
RUN apt-get -o Acquire::AllowInsecureRepositories=true update
|
||||
RUN apt-get -y --allow-unauthenticated install -y nano openssh-server curl
|
||||
|
||||
RUN echo root:${PASSWORD} | chpasswd
|
||||
RUN echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
|
||||
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
|
||||
RUN service ssh start
|
||||
|
||||
COPY src/ .
|
||||
|
||||
RUN mkdir -p uploads/
|
||||
RUN pip install -r requirements.txt
|
||||
RUN chmod +x ./start.sh
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 22
|
||||
|
||||
CMD ./start.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
Acquire::AllowInsecureRepositories "true";
|
||||
Acquire::AllowDowngradeToInsecureRepositories "true";
|
||||
Apt::Get::AllowUnauthenticated "true";
|
||||
@@ -0,0 +1,18 @@
|
||||
services:
|
||||
s3:
|
||||
container_name: s3_container
|
||||
hostname: s3
|
||||
restart: always
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
- PASSWORD=$PASSWORD_20000
|
||||
volumes:
|
||||
- ../receiver/flags/s3.txt:/flag.txt:ro
|
||||
- ../utils/bashrc:/root/.bashrc:ro
|
||||
- ../utils/preexec.sh:/root/.preexec.sh:ro
|
||||
ports:
|
||||
- "20000:80"
|
||||
- "20022:22"
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
@@ -0,0 +1 @@
|
||||
PLACEHOLDER
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python3
|
||||
from flask import Flask, request, redirect, render_template
|
||||
import os
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config["MAX_CONTENT_LENGTH"] = 1024
|
||||
|
||||
|
||||
@app.route("/upload", methods=["POST"])
|
||||
def aplot():
|
||||
try:
|
||||
file = request.files["file"]
|
||||
filename = file.filename
|
||||
path = os.path.join("uploads/", filename)
|
||||
assert filename and ".." not in filename and "flag" not in filename
|
||||
assert not os.path.exists(path)
|
||||
file.save(os.path.join("uploads/", filename))
|
||||
return f'Download <a href="/download?filename={filename}">here</a>'
|
||||
except:
|
||||
return ">:("
|
||||
|
||||
|
||||
@app.route("/download", methods=["GET"])
|
||||
def donlot():
|
||||
try:
|
||||
filename = request.args.get("filename")
|
||||
assert filename and ".." not in filename
|
||||
return open(os.path.join("uploads/", filename)).read()
|
||||
except:
|
||||
return ">:("
|
||||
|
||||
|
||||
@app.route("/", methods=["POST", "GET"])
|
||||
def index():
|
||||
return render_template("index.html")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host="0.0.0.0", port=80, debug=False)
|
||||
@@ -0,0 +1 @@
|
||||
Flask
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
/usr/sbin/sshd -D &
|
||||
chmod +x ./main.py
|
||||
./main.py
|
||||
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Stupid Storage Service</title>
|
||||
</head>
|
||||
<body>
|
||||
<form action="/upload" method="post" enctype="multipart/form-data">
|
||||
<input type="file" name="file">
|
||||
<input type="submit">
|
||||
</form>
|
||||
<a href=""></a>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user