diff --git a/physics-test/Dockerfile b/physics-test/Dockerfile index 4aeba26..d7b6539 100644 --- a/physics-test/Dockerfile +++ b/physics-test/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:latest as build +FROM --platform=linux/amd64 ubuntu:20.04 AS build RUN apt-get update -y && apt-get install -y gcc && apt-get install -y wget && apt-get install -y unzip && rm -rf /var/lib/apt/lists/* @@ -6,7 +6,7 @@ RUN wget -O ynetd.c https://raw.githubusercontent.com/johnsonjh/ynetd/master/yne && gcc -o ynetd ynetd.c -FROM --platform=linux/amd64 python:3.8-slim-buster AS deployer +FROM --platform=linux/amd64 python:3.12-slim-bookworm AS deployer RUN useradd -m -d /home/ctf -u 12345 ctf WORKDIR /home/ctf @@ -17,10 +17,11 @@ RUN chmod +x ynetd # copy over source and set permissions COPY physics-test.py physics-test.py -RUN chown -R root:root /home/ctf +COPY flag.txt . +RUN chown -R root:root /home/ctf # run and expose USER ctf -EXPOSE 9999 +EXPOSE 8148 CMD ["./ynetd", "-p", "8148", "python3 physics-test.py 2>&1"] \ No newline at end of file diff --git a/physics-test/chall.yaml b/physics-test/chall.yaml index 3c95f17..07209d0 100644 --- a/physics-test/chall.yaml +++ b/physics-test/chall.yaml @@ -3,9 +3,9 @@ categories: - misc value: 100 flag: - file: ./flag.txt + file: ./flag.txt description: |- - Help me get an A in Physics! My teacher made this review program for us. + Help me get an A in Physics! My teacher made this review program for us. hints: - How is the program checking your answer? After all, it's possible to write a correct answer in multiple ways (e.g. x+y vs y+x vs 0+x+y, etc). - What information/feedback do you get from each question? How can you use it to your advantage? @@ -15,5 +15,4 @@ visible: true deploy: nc: build: . - expose: 8148/tcp -# NOTE: When deployed, check that error messages are visible (you can see that "flag" is in the error message) \ No newline at end of file + expose: 8148/tcp \ No newline at end of file diff --git a/physics-test/solve.py b/physics-test/solve.py index 4848372..c0eae87 100644 --- a/physics-test/solve.py +++ b/physics-test/solve.py @@ -1,8 +1,9 @@ from pwn import * # running on local machine -# replace this with remote() when deployed -p = process(['python3', 'physics-test.py']) +# replace this with remote url +# p = process(['python3', 'physics-test.py']) +p = remote('localhost', 8148) # answers for each of the problems answers = [