From 3f1635b8715c98cf68a256f59d1de52855178970 Mon Sep 17 00:00:00 2001 From: mamang Date: Sat, 20 Oct 2018 20:34:28 +0800 Subject: [PATCH] Add Environment Docker Python --- Docker Env/Dockerfile | 31 +++++++++++++++++++++++++++++++ Docker Env/TUTORIAL | 3 +++ 2 files changed, 34 insertions(+) create mode 100644 Docker Env/Dockerfile create mode 100644 Docker Env/TUTORIAL diff --git a/Docker Env/Dockerfile b/Docker Env/Dockerfile new file mode 100644 index 0000000..772170b --- /dev/null +++ b/Docker Env/Dockerfile @@ -0,0 +1,31 @@ +# Use ubuntu 16.04 +FROM ubuntu:16.04 + +RUN apt-get update && apt-get -y dist-upgrade --fix-missing --fix-broken + +# install socat editor ssh +RUN apt-get install curl netcat-openbsd vim nano openssh-server socat lib32ncurses5 python python-pip python-dev -y + +RUN adduser --disabled-password --gecos "" ksl +RUN echo "ksl:sebuahrahasiamas" | chpasswd + +ADD chall/. /chall +WORKDIR /chall + +RUN echo 'KSL{xxxxxxxxxxxxxxxxxx}' > /chall/flag.txt # ubah isi flagnya + +# Secure ENV + +RUN echo 'alias kill="echo no kill please!"' >> ~/.bashrc +RUN chmod 700 /tmp /var/tmp /usr/bin/* /bin/* /dev/shm +RUN chmod 755 /usr/bin/env /bin/dash /bin/bash /bin/sh /bin/nc /bin/cat /usr/bin/curl /usr/bin/groups /usr/bin/id /bin/ls /usr/bin/python + + +RUN chown root:ksl /chall/namafile.py # ubah nama file +RUN chmod 775 /chall/namafile.py # ubah nama file + +# Run Service + +RUN echo '#!/bin/bash'"\n(socat TCP-LISTEN:7000,reuseaddr,fork EXEC:"/chall/namafile.py,su=nobody")" > /var/tmp/.start.sh && chmod +x /var/tmp/.start.sh + +CMD ["/var/tmp/.start.sh"] \ No newline at end of file diff --git a/Docker Env/TUTORIAL b/Docker Env/TUTORIAL new file mode 100644 index 0000000..b326e5c --- /dev/null +++ b/Docker Env/TUTORIAL @@ -0,0 +1,3 @@ +docker build -t "nama_challenge" . +docker run -p "port_anda:7000" -it cobamaba # mode non-daemon utk debug +docker run -p "port_anda:7000" -itd cobamaba # mode daemon kalau dianggap program sudah fix berjalan