gipu/polictf/server/exploit-test.py

16 lines
478 B
Python

from pwn import *
import subprocess
key_re = re.compile(".*\"(.*)\".*")
r = remote("127.0.0.1", 8888)
first = r.recv()
key = key_re.match(first).group(1)
print("Using key: {}".format(key))
subprocess.check_call(["python3", "../../assembler/assembler.py", "{}".format(key), "../asms/decrypt.pstc", "./out.pasticciotto"])
with open("./out.pasticciotto") as f:
data = f.read()
r.send("{}\n".format(len(data)))
print(r.recv())
r.send("{}\n".format(data))
print(r.recv(100000))