picoctf/forensics/endianness_v2/solve.py

16 lines
336 B
Python
Executable File

#!/usr/bin/env python3
with open('challengefile', 'rb') as file:
content = file.read()
def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n]
buffer = []
for word in chunks(content, 4):
buffer.append(bytes(reversed(word)))
with open('challengefile.jpg', 'wb') as file:
file.write(b''.join(buffer))