From c9c071ab79ee89ef1378f9ebc1236f6947a04ec3 Mon Sep 17 00:00:00 2001 From: paulussimanjuntak Date: Sat, 3 Nov 2018 16:52:28 +0800 Subject: [PATCH] ping-service --- ping-service/Dockerfile | 7 ++++--- ping-service/chall/ping-service.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ping-service/Dockerfile b/ping-service/Dockerfile index 7d2df0d..999d2a7 100644 --- a/ping-service/Dockerfile +++ b/ping-service/Dockerfile @@ -4,21 +4,22 @@ 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 apt-get install curl netcat-openbsd vim nano openssh-server socat lib32ncurses5 python python-pip python-dev iputils-ping -y RUN adduser --disabled-password --gecos "" ksl RUN echo "ksl:sebuahrahasiamas" | chpasswd ADD chall/. /chall WORKDIR /chall +RUN cp /bin/ping /usr/local/bin/ RUN echo 'KSL{U14RZ_M4M4NXX_KERENZX_4ANEETTT!!}' > /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 chmod 700 /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 /bin/ping RUN chown root:ksl /chall/ping-service.py # ubah nama file diff --git a/ping-service/chall/ping-service.py b/ping-service/chall/ping-service.py index 7fe780e..87a4a11 100755 --- a/ping-service/chall/ping-service.py +++ b/ping-service/chall/ping-service.py @@ -50,7 +50,7 @@ def main(): userNumber = raw_input("Masukkan pilihan (1-3): ") if userNumber == "1" : host = raw_input("\nMasukkan alamat host : ") - p1 = subprocess.Popen(['ping','-c 5', host], stdout=subprocess.PIPE) + p1 = subprocess.Popen(['/usr/local/bin/ping','-c 5', host], stdout=subprocess.PIPE) output = p1.communicate()[0] print output exit() @@ -61,7 +61,7 @@ def main(): for o in range(user): host = raw_input("Masukkan alamat host ke " +str(o+1) +" : ") hosts= re.sub('[|,;]', '', host) - pings = MaManX('ping -c 5 ' + hosts ) + pings = MaManX('/usr/local/bin/ping -c 5 ' + hosts ) if (pings == 0): print host.upper(), "IS UP MAMANX" else :