TJCTF2020 - Tap Dancing
Posted on mar. 02 juin 2020 in CTF
solves : 215
Points: 25
Written by agcdragon
My friend is trying to teach me to dance, but I am not rhythmically coordinated! They sent me a list of dance moves but they're all numbers! Can you help me figure out what they mean so I can learn the dance?
NOTE: Flag is not in flag format.
We have this text as cipher text: 1101111102120222020120111110101222022221022202022211
.
We have three different char, so not binary encode. Another cipher method that use three different char is Morse.
Let's try to convert it to Morse. We can try so different combinations to get the working one. The correct one give us this:
1 -
2 .
0
-- ----- .-. ... . -. ----- - -... ....- ... . ...--
We can use the following python code to perform the decoding or any online tool:
MORSE_CODE_DICT = { 'A':'.-', 'B':'-...',
'C':'-.-.', 'D':'-..', 'E':'.',
'F':'..-.', 'G':'--.', 'H':'....',
'I':'..', 'J':'.---', 'K':'-.-',
'L':'.-..', 'M':'--', 'N':'-.',
'O':'---', 'P':'.--.', 'Q':'--.-',
'R':'.-.', 'S':'...', 'T':'-',
'U':'..-', 'V':'...-', 'W':'.--',
'X':'-..-', 'Y':'-.--', 'Z':'--..',
'1':'.----', '2':'..---', '3':'...--',
'4':'....-', '5':'.....', '6':'-....',
'7':'--...', '8':'---..', '9':'----.',
'0':'-----', ', ':'--..--', '.':'.-.-.-',
'?':'..--..', '/':'-..-.', '-':'-....-',
'(':'-.--.', ')':'-.--.-'}
def decrypt(message):
message += ' '
decipher = ''
citext = ''
for letter in message:
if (letter != ' '):
i = 0
citext += letter
else:
i += 1
if i == 2 :
decipher += ' '
else:
decipher += list(MORSE_CODE_DICT.keys())[list(MORSE_CODE_DICT
.values()).index(citext)]
citext = ''
return decipher
message = "-- ----- .-. ... . -. ----- - -... ....- ... . ...--"
print("tjctf{" + decrypt(message).lower() + "}")
Let's run it and get the flag!
╰─ python decode.py
tjctf{m0rsen0tb4se3}