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:
@@ -0,0 +1,21 @@
|
||||
FROM php:8.2-apache-bookworm
|
||||
|
||||
ARG PASSWORD
|
||||
|
||||
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
|
||||
RUN echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
|
||||
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
|
||||
RUN service ssh start
|
||||
|
||||
COPY src/ /var/www/html
|
||||
RUN mkdir /var/www/html/backups
|
||||
RUN chown -R www-data:www-data /var/www/html/backups
|
||||
RUN chmod -R 777 /var/www/html/backups
|
||||
|
||||
RUN touch /flag.txt
|
||||
COPY start.sh .
|
||||
|
||||
RUN chmod +x start.sh
|
||||
CMD ./start.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
Acquire::AllowInsecureRepositories "true";
|
||||
Acquire::AllowDowngradeToInsecureRepositories "true";
|
||||
Apt::Get::AllowUnauthenticated "true";
|
||||
@@ -0,0 +1,18 @@
|
||||
services:
|
||||
crawlback:
|
||||
container_name: crawlback_container
|
||||
hostname: crawlback
|
||||
restart: always
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
- PASSWORD=$PASSWORD_21000
|
||||
volumes:
|
||||
- ../receiver/flags/crawlback.txt:/flag.txt:ro
|
||||
- ../utils/bashrc:/root/.bashrc:ro
|
||||
- ../utils/preexec.sh:/root/.preexec.sh:ro
|
||||
ports:
|
||||
- "21000:80"
|
||||
- "21022:22"
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
function get($url){
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_RETURNTRANSFER => 1,
|
||||
CURLOPT_URL => $url,
|
||||
));
|
||||
|
||||
$resp = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
|
||||
return $resp;
|
||||
}
|
||||
|
||||
function save($data){
|
||||
$filename = 'backups/' . randstr(8) . '.html';
|
||||
$fp = fopen($filename, 'w');
|
||||
fwrite($fp, $data);
|
||||
fclose($fp);
|
||||
return $filename;
|
||||
}
|
||||
|
||||
function randstr($length){
|
||||
$str = '';
|
||||
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
$size = strlen($chars);
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$str .= $chars[rand(0, $size - 1)];
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$url = $_POST["url"];
|
||||
$data = get($url);
|
||||
header('Location: ' . save($data));
|
||||
|
||||
} else {
|
||||
echo "Invalid request method";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<title>Crawlback</title>
|
||||
</head>
|
||||
<body class="bg-white">
|
||||
<div class="grid h-screen place-content-center">
|
||||
<div>
|
||||
<h1 class="tracking-wide text-sky-500 text-9xl font-bold">Crawlback Machine</h1>
|
||||
</div>
|
||||
<label class="block">
|
||||
<span class="sr-only">URL to Crawlback</span>
|
||||
<form action="crawlback.php" method="post">
|
||||
<div class="grid grid-cols-1 gap-2">
|
||||
<input type="text" id="url" name="url" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-sky-500 focus:border-sky-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-sky-500 dark:focus:border-sky-500" required placeholder="https://ctftime.org"></input>
|
||||
<input type="submit" value="fetch" class="text-white bg-sky-500 hover:bg-sky-600 focus:ring-4 focus:outline-none focus:ring-sky-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-sky-600 dark:hover:bg-sky-700 dark:focus:ring-sky-800">
|
||||
</div>
|
||||
</form>
|
||||
</label>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,2 @@
|
||||
/usr/sbin/sshd -D &
|
||||
apache2-foreground
|
||||
Reference in New Issue
Block a user