-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
67 lines (52 loc) · 1.69 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Use an official Python runtime as a parent image
FROM python:3.10-slim
# Set the working directory
WORKDIR /ctf
# Install necessary tools
RUN apt-get update && apt-get install -y \
apache2 \
php \
libapache2-mod-php \
php-sqlite3 \
sqlite3 \
binutils \
steghide \
gcc \
gdb
# Remove default index.html
RUN rm -f /var/www/html/index.html
# Copy web exploitation challenge
COPY web/ /var/www/html/
# Ensure the database is set up correctly
COPY web/database.sql /var/www/html/database.sql
RUN sqlite3 /var/www/html/database.db < /var/www/html/database.sql
# Ensure the default Apache configuration uses PHP index files
RUN echo "<Directory /var/www/html/> \n\
Options Indexes FollowSymLinks \n\
AllowOverride None \n\
Require all granted \n\
</Directory> \n\
\n\
DirectoryIndex index.php \n\
\n\
<FilesMatch \.php$> \n\
SetHandler application/x-httpd-php \n\
</FilesMatch>" > /etc/apache2/sites-available/000-default.conf
# Debug: List contents of /var/www/html
RUN ls -la /var/www/html
# Copy reverse engineering challenge source
COPY reverse/reverseme.c /ctf/reverseme.c
# Compile reverse engineering challenge and clean up
RUN gcc -g -o /ctf/reverseme /ctf/reverseme.c && rm /ctf/reverseme.c
# Copy forensics challenge
COPY forensics/not_a_flag.jpg /ctf/not_a_flag.jpg
# Copy cryptography challenge
COPY crypto/crypto.txt /ctf/crypto.txt
# Copy binary exploitation challenge source
COPY binary/vuln.c /ctf/vuln.c
# Compile binary exploitation challenge and clean up
RUN gcc -o /ctf/vuln /ctf/vuln.c -fno-stack-protector -z execstack && rm /ctf/vuln.c
# Expose web server port
EXPOSE 80
# Start Apache in the foreground
CMD ["apachectl", "-D", "FOREGROUND"]