codeFest 20: Sanity Check 2

Sanity Check

Category: Web

100 points

do not confuse encodINg wiD Encryption XD !

Solution

Found some base64 looking string in the source code of CTF main webpage.

<!-- cGJxcnNyZmd7UTBobzFsXzNhcDBxM3FfRmdlMWE4fQ== -->

Let’s try to decode it.

echo cGJxcnNyZmd7UTBobzFsXzNhcDBxM3FfRmdlMWE4fQ== | base64 -d
pbqrsrfg{Q0ho1l_3ap0q3q_Fge1a8}

That’s not flag. Seems that it has to be unroted13 first.

from string import ascii_uppercase, ascii_lowercase
flag = 'pbqrsrfg{Q0ho1l_3ap0q3q_Fge1a8}'
flip = True
alphabet = ''
for c in flag:
    if c in ascii_lowercase + ascii_uppercase:
        if c in ascii_lowercase:
            alphabet = ascii_lowercase
        elif c in ascii_uppercase:
            alphabet = ascii_uppercase
        if flip:
            idx = alphabet.index(c) - 13
        else:
            idx = alphabet.index(c) + 13
        if idx > len(alphabet):
            idx -= len(alphabet)
        print(alphabet[idx], end='')
        flip = not flip
    else:
        print(c, end='')
codefest{D0ub1y_3nc0d3d_Str1n8}

Flag

codefest{D0ub1y_3nc0d3d_Str1n8}

Privacy Policy
luc © 2021