Merge branch 'main' of github.com:rayhanhanaputra/gemastik18-final
This commit is contained in:
@@ -26,7 +26,7 @@ COPY chall/ /home/ctfuser/chall
|
||||
COPY ./entrypoint.sh /entrypoint.sh
|
||||
|
||||
RUN chmod +x /entrypoint.sh /home/ctfuser/chall/run.sh && \
|
||||
chown -R root:root /home/ctfuser/chall && chmod -R 555 /home/ctfuser/chall
|
||||
chown -R ctfuser:ctfuser /home/ctfuser/chall && chmod -R 755 /home/ctfuser/chall
|
||||
|
||||
EXPOSE 9000 22
|
||||
CMD ["/entrypoint.sh"]
|
||||
CMD ["/entrypoint.sh"]
|
||||
|
||||
@@ -27,7 +27,11 @@ COPY ./src /home/ctfuser/chall/src
|
||||
COPY ./start.sh /start.sh
|
||||
RUN chmod +x /start.sh /home/ctfuser/chall/src/run.sh
|
||||
|
||||
RUN chown -R root:root /home/ctfuser/chall && chmod -R 555 /home/ctfuser/chall
|
||||
RUN chown -R root:root /home/ctfuser/chall && \
|
||||
chmod -R 555 /home/ctfuser/chall && \
|
||||
chown ctfuser:ctfuser /home/ctfuser/chall/src/Pailier.py && \
|
||||
chmod 755 /home/ctfuser/chall/src/Pailier.py
|
||||
|
||||
EXPOSE 8000 22
|
||||
CMD ["/start.sh"]
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
import signal
|
||||
from Pailier import *
|
||||
from Crypto.Util.number import *
|
||||
signal.alarm(10)
|
||||
signal.alarm(50)
|
||||
with open("/flag.txt", "rb") as f:
|
||||
flag = f.read()
|
||||
flag = bytes_to_long(flag)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import signal
|
||||
from Pailier import *
|
||||
from Crypto.Util.number import *
|
||||
signal.alarm(10)
|
||||
signal.alarm(50)
|
||||
with open("/flag.txt", "rb") as f:
|
||||
flag = f.read()
|
||||
flag = bytes_to_long(flag)
|
||||
|
||||
@@ -2,8 +2,8 @@ FROM python:3.12-slim
|
||||
|
||||
ARG PASSWORD=root
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV HOME=/home/ctf
|
||||
WORKDIR /home/ctf/chall
|
||||
ENV HOME=/home/ctfuser
|
||||
WORKDIR /home/ctfuser/chall
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
openssh-server \
|
||||
@@ -15,19 +15,22 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
bash \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN useradd -m -d /home/ctf -s /bin/bash ctf && \
|
||||
echo "ctf:${PASSWORD}" | chpasswd
|
||||
RUN useradd -m -d /home/ctfuser -s /bin/bash ctfuser && \
|
||||
echo "ctfuser:${PASSWORD}" | chpasswd
|
||||
|
||||
RUN mkdir -p /var/run/sshd
|
||||
|
||||
COPY requirements.txt /tmp/requirements.txt
|
||||
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
||||
|
||||
COPY ./src /home/ctf/chall/src
|
||||
COPY ./src /home/ctfuser/chall/src
|
||||
COPY ./start.sh /start.sh
|
||||
RUN chmod +x /start.sh /home/ctf/chall/src/run.sh
|
||||
RUN chmod +x /start.sh /home/ctfuser/chall/src/run.sh
|
||||
|
||||
RUN chown -R root:root /home/ctf/chall && chmod -R 555 /home/ctf/chall
|
||||
RUN chown -R root:root /home/ctfuser/chall && \
|
||||
chmod -R 555 /home/ctfuser/chall && \
|
||||
chown ctfuser:ctfuser /home/ctfuser/chall/src/chall.py && \
|
||||
chmod 755 /home/ctfuser/chall/src/chall.py
|
||||
|
||||
EXPOSE 8000 22
|
||||
CMD ["/start.sh"]
|
||||
|
||||
@@ -11,7 +11,7 @@ grep -q "^PasswordAuthentication" /etc/ssh/sshd_config && \
|
||||
sed -i "s/^PasswordAuthentication.*/PasswordAuthentication yes/" /etc/ssh/sshd_config || \
|
||||
echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
|
||||
|
||||
echo "AllowUsers ctf" >> /etc/ssh/sshd_config
|
||||
echo "AllowUsers ctfuser" >> /etc/ssh/sshd_config
|
||||
|
||||
/usr/sbin/sshd
|
||||
|
||||
@@ -21,4 +21,4 @@ if [ -n "$FLAG" ]; then
|
||||
chown root:root /flag.txt
|
||||
fi
|
||||
|
||||
exec su -c "cd /home/ctf/chall/src && ./run.sh" -s /bin/bash ctf
|
||||
exec su -c "cd /home/ctfuser/chall/src && ./run.sh" -s /bin/bash ctfuser
|
||||
|
||||
Reference in New Issue
Block a user