-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add files for the Dockerfile and few modifications to the sol_got_ove…
…rwrite.py for 02-rwslotmachine2 Signed-off-by: Bianca Ioana <[email protected]>
- Loading branch information
Showing
4 changed files
with
74 additions
and
13 deletions.
There are no files selected for viewing
Empty file.
33 changes: 33 additions & 0 deletions
33
...s-and-defensive-strategies/defense-mechanisms/activities/02-rwslotmachine2/sol/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Build Stage | ||
FROM gcc:latest AS build | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Copy the source code into the container | ||
COPY rwslotmachine2.c . | ||
|
||
# Compile the source code into an executable | ||
RUN gcc rwslotmachine2.c -o rwslotmachine2 -Wall -Wextra | ||
|
||
# Runtime Stage | ||
# FROM debian:bullseye-slim | ||
FROM ubuntu:latest | ||
|
||
# Install necessary runtime libraries | ||
RUN apt-get update && apt-get install -y \ | ||
libc6 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Copy the compiled executable from the builder stage | ||
# COPY --from=build /app/rwslotmachine2 . | ||
COPY --from=build /app/rwslotmachine2 /app/rwslotmachine2 | ||
|
||
# Expose the port where the program will operate | ||
EXPOSE 31345 | ||
|
||
# Run the program | ||
CMD ["./rwslotmachine2"] |
17 changes: 17 additions & 0 deletions
17
...ensive-strategies/defense-mechanisms/activities/02-rwslotmachine2/sol/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## Building and Running | ||
|
||
1. Build the Docker image: | ||
```bash | ||
docker build -t rwslotmachine2 . | ||
``` | ||
|
||
|
||
2. Run the Docker image: | ||
```bash | ||
docker run -p 31345:31345 rwslotmachine2 | ||
``` | ||
|
||
3. Test with the Python exploit: | ||
```bash | ||
python3 sol_got_overwrite.py | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters