HackTheBox Encryption Bot Challenge
https://app.hackthebox.com/challenges/453
Description
My friend send me a encrypted message by using encryption bot. This is a important message. Can you decrypt the message for me?
Exploitation
#!/usr/bin/python3
def decode(encoded):
chars = "RSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQabcdefghijklmnopqrstuvwxyz"
binary = ''
for c in encoded:
idx = chars.index(c)
binary += format(idx, '06b')
flag = ''
for i in range(0, len(binary), 8):
chunk = binary[i:i+8]
if len(chunk) == 8:
flag += chr(int(chunk, 2))
return flag
encrypted = "9W8TLp4k7t0vJW7n3VvMCpWq9WzT3C8pZ9Wz"
print(f"Encrypted: {encrypted}")
print(f"Flag: {decode(encrypted)}")
Summary
Encryption Bot: reverse the validation logic, model the transform, and recover the accepted input.