HacktheBox – Deceitful Batman

The Deceitful Batman challenge is a challenge that can be recognized by the repetitive use of just two characters. Some research online led me to a page on the Baconian Cypher. This cypher can be recognized by the use of just two characters in a specific sequence. Just by creating a small python script with a list of corresponding characters (an N instead of a B being used here though). The following solution works for this specific Cypher.

#!/usr/bin/env python3
import re
cypher = 'NAANAAANNNAANAAAANANANANAAAAAAAANNAANAAANAAANANNAAAAAAAANNNAANAAAAANAANAAAA'

#Baconian cypher converted to a batman cypher 
baconian = { 'AAAAA':'A', 'AAAAN':'B', 'AAANA':'C', 'AAANN':'D', 'AANAA':'E', 
             'AANAN':'F', 'AANNA':'G', 'AANNN':'H', 'ANAAA':'I', 'ANAAN':'K',
             'ANANA':'L', 'ANANN':'M', 'ANNAA':'N', 'ANNAN':'O', 'ANNNA':'P',
             'ANNNN':'Q', 'NAAAA':'R', 'NAAAN':'S', 'NAANA':'T', 'NAANN':'U/V',
             'NANAA':'W', 'NANAN':'X', 'NANNA':'Y', 'NANNN':'Z' }
flag=''
#For loop to loop through all sequences of 5 characters. 
for i in re.findall('.{1,5}',cypher):
    flag += baconian.get(i)

print(flag)

When this script is executed, the following result should appear:
Solution to deceitfulbatman challenge hackthebox