Files
ctf/2026/srdnlen_quals/forensic/chapter2/get_image.py
2026-03-09 21:44:25 +01:00

16 lines
442 B
Python

from PIL import Image, ImageOps
# Read the XORed binary data
with open('./final.bin', 'rb') as f:
data = f.read()
# Interpret the 262,144 bytes as a 512x512 Grayscale image
img = Image.frombytes('L', (512, 512), data)
# The XOR differences might be very dark, so we auto-contrast it to make the flag pop
img = ImageOps.autocontrast(img)
# Save the final image
img.save('the_armory.png')
print("The forge is lit. Open the_armory.png")