picoctf/forensics/whitepages/solve.py

23 lines
418 B
Python
Raw Normal View History

2024-09-03 18:48:23 +02:00
#!/usr/bin/env python3
import binascii
with open('whitepages.txt') as file:
content = file.read()
bits = []
for ws in content:
if ws == ' ':
bits.append(1)
else:
bits.append(0)
def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n]
for byte in chunks(bits, 8):
bitstring = ''.join(str(bit) for bit in byte)
i = int(bitstring, 2)
print(chr(i), end='')