Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
fix deployment stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mud-ali committed Apr 21, 2024
1 parent 0856562 commit ccf54c5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
9 changes: 5 additions & 4 deletions physics-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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/*

RUN wget -O ynetd.c https://raw.githubusercontent.com/johnsonjh/ynetd/master/ynetd.c \
&& 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
Expand All @@ -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"]
7 changes: 3 additions & 4 deletions physics-test/chall.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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)
expose: 8148/tcp
5 changes: 3 additions & 2 deletions physics-test/solve.py
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down

0 comments on commit ccf54c5

Please sign in to comment.