diff options
| author | Louis Burda <quent.burda@gmail.com> | 2025-01-17 23:44:26 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2025-01-17 23:44:26 +0100 |
| commit | e3c6fb69c782d51f9b0aeba493d9897c5e9f5c48 (patch) | |
| tree | adab60d1ab812b54fc12e67bcf5ba3c3fb4690cc /server | |
| download | nullcon2023-babyrand-master.tar.gz nullcon2023-babyrand-master.zip | |
Diffstat (limited to 'server')
| -rw-r--r-- | server/Dockerfile | 13 | ||||
| -rw-r--r-- | server/app.py | 18 | ||||
| -rw-r--r-- | server/docker-compose.yml | 8 | ||||
| -rw-r--r-- | server/requirements.txt | 1 |
4 files changed, 40 insertions, 0 deletions
diff --git a/server/Dockerfile b/server/Dockerfile new file mode 100644 index 0000000..40881ad --- /dev/null +++ b/server/Dockerfile @@ -0,0 +1,13 @@ +FROM ubuntu:latest + +RUN apt update && apt install -y python3 python3-pip socat + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY app.py . +RUN chmod +x app.py + +CMD [ "socat", "TCP-LISTEN:9000,fork", "EXEC:./app.py" ] diff --git a/server/app.py b/server/app.py new file mode 100644 index 0000000..f0418b0 --- /dev/null +++ b/server/app.py @@ -0,0 +1,18 @@ +#!/usr/bin/python3 -u + +import random +import os + +max_retries = 100 +for _ in range(max_retries): + print("Hints:") + for i in range(9): + print(random.getrandbits(32)) + + real = random.getrandbits(32) + print("Guess:") + resp = input() + if int(resp) == real: + print("FLAG", os.getenv("FLAG")) + +print("No tries left, sorry!") diff --git a/server/docker-compose.yml b/server/docker-compose.yml new file mode 100644 index 0000000..0ae4df2 --- /dev/null +++ b/server/docker-compose.yml @@ -0,0 +1,8 @@ +version: "3.1" +services: + babyrand: + build: . + ports: + - "9094:9000" + environment: + - "FLAG=ENO{U_Gr4du4t3d_R4nd_4c4d3mY!}" diff --git a/server/requirements.txt b/server/requirements.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/server/requirements.txt @@ -0,0 +1 @@ + |
