paulussimanjuntak 6 роки тому
джерело
коміт
c9c071ab79
2 змінених файлів з 6 додано та 5 видалено
  1. +4
    -3
      ping-service/Dockerfile
  2. +2
    -2
      ping-service/chall/ping-service.py

+ 4
- 3
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

+ 2
- 2
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 :

Завантаження…
Відмінити
Зберегти