diff --git a/chapters/exploitation-techniques/shellcodes/drills/08-challenge-shellcode-after/Dockerfile b/chapters/exploitation-techniques/shellcodes/drills/08-challenge-shellcode-after/Dockerfile new file mode 100644 index 0000000..165ca64 --- /dev/null +++ b/chapters/exploitation-techniques/shellcodes/drills/08-challenge-shellcode-after/Dockerfile @@ -0,0 +1,28 @@ +# syntax=docker/dockerfile:1.4 +# +# Model: multi-stage build +# • build stage: compiles the shellcode exercise +# • runtime stage: runs the exe on port 31346 + +########## Build ########## +FROM gcc:12 AS builder +WORKDIR /src + +COPY src/ . + +RUN make + +########## Runtime ########## +FROM python:3.9-slim +WORKDIR /app + +RUN apt-get update && \ + apt-get install -y --no-install-recommends binutils cpp && \ + pip install pwntools==4.14.1 + +COPY --from=builder /src/vuln /app/vuln +COPY sol/ /app/ + +EXPOSE 31346 + +CMD ["/bin/sh", "-c", "/app/vuln"] diff --git a/chapters/exploitation-techniques/shellcodes/drills/08-challenge-shellcode-after/Makefile b/chapters/exploitation-techniques/shellcodes/drills/08-challenge-shellcode-after/Makefile new file mode 100644 index 0000000..2c87b4a --- /dev/null +++ b/chapters/exploitation-techniques/shellcodes/drills/08-challenge-shellcode-after/Makefile @@ -0,0 +1,17 @@ +PORT ?= 31346 +IMG_NAME ?= 08-challenge-shellcode-after +CONT_NAME ?= $(IMG_NAME)-cnt + +build: + docker build -t $(IMG_NAME) . + +run: build + docker run -it -p $(PORT):$(PORT) --name $(CONT_NAME) $(IMG_NAME) + +stop: + docker stop $(CONT_NAME) + +clean: stop + docker rm $(CONT_NAME) + +.PHONY: build run stop clean