TJCTF2020 - Typewriter

Posted on mar. 02 juin 2020 in CTF

solves : 395

Points: 30

Written by jpes707

Oh no! I thought I typed down the correct flag for this problem on my typewriter, but it came out all jumbled on the paper. Someone must have switched the inner hammers around! According to the paper, the flag is zpezy{ktr_gkqfut_hxkhst_tyukokkgotyt_hoftqhhst_ykxoz_qxilrtxiyf}.

Hint: a becomes q, b becomes w, c becomes e, f becomes y, j becomes p, t becomes z, and z becomes m. Do you see the pattern?

With the hint, the solution is quite obvisous: we need to map the char back to qwerty keyboard layout.

flag = "zpezy\{ktr_gkqfut_hxkhst_tyukokkgotyt_hoftqhhst_ykxoz_qxilrtxiyf}"

layout = {
'a': 'q',
'b': 'w',
'c': 'e',
'd': 'r',
'e': 't',
'f': 'y',
'g': 'u',
'h': 'i',
'i': 'o',
'j': 'p',
'k': 'a',
'l': 's',
'm': 'd',
'n': 'f',
'o': 'g',
'p': 'h',
'q': 'j',
'r': 'k',
's': 'l',
't': 'z',
'u': 'x',
'v': 'c',
'w': 'v',
'x': 'b',
'y': 'n',
'z': 'm',
'_': '_',
'{': '{',
'}': '}'

result = ""

for c in flag:
    for name, age in layout.items():
        if age == c:
            result += name


Run it and get some points!

╰─ python