daas setup
This commit is contained in:
26
DownUnderCTF 2023/misc/daas/daas/Dockerfile
Normal file
26
DownUnderCTF 2023/misc/daas/daas/Dockerfile
Normal file
@@ -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)
|
||||||
24
DownUnderCTF 2023/misc/daas/daas/daas.py
Normal file
24
DownUnderCTF 2023/misc/daas/daas/daas.py
Normal file
@@ -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 :(")
|
||||||
1
DownUnderCTF 2023/misc/daas/daas/flag.txt
Normal file
1
DownUnderCTF 2023/misc/daas/daas/flag.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
DUCTF{...}
|
||||||
Reference in New Issue
Block a user