picoctf/forensics/endianness_v2/solve.py

16 lines
336 B
Python
Raw Normal View History

2024-09-05 19:25:07 +02:00
#!/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))