Codsmp.zip ✦
def xor(data, key): return bytes(a ^ b for a, b in zip(data, itertools.cycle(key)))
data = open('archive.enc','rb').read() key = b' ' decoded = bytes(b ^ 0x20 for b in data) print(decoded[:64]) Result:
def extract_flag(buf): import re m = re.search(br'FLAG\[^]+\}', buf) return m.group(0).decode() if m else None codsmp.zip
def xor(data, key): return bytes(a ^ b for a, b in zip(data, itertools.cycle(key)))
$ binwalk -e archive.enc # no known file signatures def xor(data, key): return bytes(a ^ b for
Inside this zip you will find a binary payload and a python script. The binary is encrypted with a custom XOR scheme. Your job is to recover the original binary and locate the flag.
workdir/ ├─ README.txt ├─ payload.bin ├─ secret.py └─ archive.enc 2.1 README.txt Welcome to the CODSMP challenge! workdir/ ├─ README
$ unzip codsmp.zip -d workdir Now we have a working directory:
# ----------------------------------------------------------------- # 2. Decode archive.enc (single‑byte XOR 0x20) enc = (work/'archive.enc').read_bytes() dec = xor(enc, b' ') # 0x20 == space == 32 decimal inner_zip = work/'inner.zip' inner_zip.write_bytes(dec)