| @ -0,0 +1,32 @@ | |||||
| # 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 ruby-full -y | |||||
| RUN adduser --disabled-password --gecos "" ksl | |||||
| RUN echo "ksl:sebuahrahasiamas" | chpasswd | |||||
| ADD chall/. /chall #membuat direktory chall | |||||
| WORKDIR /chall #direktory chall akan digunakan sebagai tempat kerja | |||||
| RUN cp /usr/bin/ruby /usr/local/bin/ | |||||
| RUN echo 'KSL{t3RM1naL_Linux_3azy}' > /chall/flag.txt # ubah isi flagnya | |||||
| # Secure ENV | |||||
| RUN echo 'alias kill="echo no kill please!"' >> ~/.bashrc | |||||
| RUN chmod 700 /tmp /usr/bin/* /bin/* /dev/shm #memberi hak akses | |||||
| 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 /usr/bin/ruby | |||||
| RUN chown root:ksl /chall/service_agent.rb # ubah nama file | |||||
| RUN chmod 775 /chall/service_agent.rb # ubah nama file | |||||
| # Run Service | |||||
| RUN echo '#!/bin/bash'"\n(socat TCP-LISTEN:7000,reuseaddr,fork EXEC:"/chall/service_agent.rb,su=nobody")" > /var/tmp/.start.sh && chmod +x /var/tmp/.start.sh | |||||
| CMD ["/var/tmp/.start.sh"] | |||||
| @ -0,0 +1,27 @@ | |||||
| #!/usr/local/bin/ruby | |||||
| def main | |||||
| puts "================================================================================================================================================================================================" | |||||
| puts "=============================================================================SELAMAT DATANG DI PORTAL RAHASIA===================================================================================" | |||||
| puts "================================================================================================================================================================================================" | |||||
| print "Masukan Kode Rahasia Agen: " | |||||
| code = gets.chomp | |||||
| if code == "KSL_SECRET_TEAM007" then | |||||
| puts "================================================================================================================================================================================================" | |||||
| puts "==========================================================Selamat datang agen KSL, ini adalah sesi control panel anda. Gunakan dengan bijak!====================================================" | |||||
| puts "================================================================================================================================================================================================" | |||||
| print "Enter Secret Command : " | |||||
| sc = gets.chomp | |||||
| system("#{sc}") | |||||
| else | |||||
| abort "Maaf Kode yang anda salah!" | |||||
| end | |||||
| end | |||||
| if __FILE__ == $0 | |||||
| $stdout.sync = true | |||||
| $stdin.sync = true | |||||
| main | |||||
| end | |||||
| @ -0,0 +1,2 @@ | |||||
| #!/bin/bash | |||||
| socat TCP-LISTEN:5000,reuseaddr,fork EXEC:./service_agent.rb | |||||