diff --git a/DownUnderCTF 2023/misc/daas/daas/Dockerfile b/DownUnderCTF 2023/misc/daas/daas/Dockerfile new file mode 100644 index 00000000..e4a06979 --- /dev/null +++ b/DownUnderCTF 2023/misc/daas/daas/Dockerfile @@ -0,0 +1,26 @@ +FROM aflplusplus/aflplusplus:latest + +ENV TMP_ENABLED=1 + +RUN mkdir /root/chal +COPY ./flag.txt /root/chal +COPY ./daas.py /root/chal/pwn +#RUN mv /root/chal/daas.py /root/chal/pwn + +RUN chmod +x /root/chal/pwn + +# decompyle3 only supports python <= 3.8 +RUN apt-get update \ + && apt-get install -y libssl-dev openssl build-essential zlib1g-dev wget \ + && cd /tmp \ + && wget https://www.python.org/ftp/python/3.8.10/Python-3.8.10.tgz \ + && tar xzvf Python-3.8.10.tgz \ + && cd Python-3.8.10 \ + && ./configure \ + && make \ + && make install \ + && rm -rf /var/lib/apt/lists/* + +# 3.9.0 is latest version of decompyle3 as of writing this challenge +RUN /usr/local/bin/python3.8 -m pip install decompyle3==3.9.0 +#RUN mv /root/chal/flag.txt /home/ctf/chal/flag_$(tr -dc a-f0-9 < /dev/urandom | head -c32) diff --git a/DownUnderCTF 2023/misc/daas/daas/daas.py b/DownUnderCTF 2023/misc/daas/daas/daas.py new file mode 100644 index 00000000..ea2d989c --- /dev/null +++ b/DownUnderCTF 2023/misc/daas/daas/daas.py @@ -0,0 +1,24 @@ +#!/usr/local/bin/python3.8 + +import subprocess +import sys +import tempfile +import base64 + +print("Welcome to my .pyc decompiler as a service!") +try: + pyc = base64.b64decode(input('Enter your pyc (base64):\n')) +except: + print('There was an error with your base64 :(') + exit(1) + +with tempfile.NamedTemporaryFile(suffix='.pyc') as sandbox: + sandbox.write(pyc) + sandbox.flush() + pipes = subprocess.Popen(["/usr/local/bin/decompyle3", sandbox.name], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = pipes.communicate() + if pipes.returncode == 0 and len(stderr) == 0: + print(stdout.decode()) + else: + print(stderr.decode()) + print("There was an error in decompilation :(") diff --git a/DownUnderCTF 2023/misc/daas/daas/flag.txt b/DownUnderCTF 2023/misc/daas/daas/flag.txt new file mode 100644 index 00000000..ce2eee7d --- /dev/null +++ b/DownUnderCTF 2023/misc/daas/daas/flag.txt @@ -0,0 +1 @@ +DUCTF{...}