Artwork
Category: Cryptography
50 points
Take a look at this artwork.
File: art.md
Solution
The attached file looks like a utf-16 encoded mess. But, in fact it isn’t. The script below is self-explaining.
Workflow is as below:
- drop all the non-printable characters
- base58 decode the payload
- base64 decode the payload
- replace all ‘I’ and ‘l’ with ‘0’ and ‘1’
- read the payload as binary written string
- get the flag ;-)
import base58
import base64
from string import printable
file = open('/home/luc/Pobrane/securedebug/art.md', 'rb').read()
flag_encoded = ''.join([chr(i) if chr(i) in printable else '' for i in file])
flag_b58_decoded = base58.b58decode(flag_encoded)
flag_b64_decoded = base64.b64decode(flag_b58_decoded)
flag_binary = flag_b64_decoded.replace(b'I', b'0').replace(b'l', b'1')
flag = bytes.fromhex(hex(int(flag_binary.decode('utf-8'), 2))[2:])
print(flag.decode('utf-8'))
Flag
SBCTF{73h_4r7_0f_D3c1Ph3r1Ng}