Pragyan 2020 - ASCII Sentence

Posted on mer. 26 février 2020 in CTF

solves : 123

Decode this

8951116499911082102898878115975057102908657109985070102908786108885053110907210811910072108102908710451975182112885057105102816161

Since it's ASCII, we need to create correct value in order to process it.

import base64

decode = "8951116499911082102898878115975057102908657109985070102908786108885053110907210811910072108102908710451975182112885057105102816161"
asci = []

x = 0
while x < len(decode):
    if int(decode[x]) == 1:
        asci.append(chr(int(decode[x] + decode[x+1] + decode[x+2])))
        i = 3
    else:
        asci.append(chr(int(decode[x] + decode[x+1])))
        i = 2
    x += i
    pass

print("".join(asci))
print("base64 decode: " + str(base64.b64decode("".join(asci))))

Let's run the script and get the decoded string:

$ python ascii.py
Y3t1cnRfYXNsa29fZV9mb2FfZWVlX25nZHlwdHlfZWh3a3RpX29ifQ==
base64 decode: b'c{urt_aslko_e_foa_eee_ngdypty_ehwkti_ob}'

Ok, we got some clear text but shuffled. After some looking after Rail-fence and try all ROT possibilities, we split the sting in three parts:

pty_ehwkti_ob}
_foa_eee_ngdy
c{urt_aslko_e

If you read by column, you have the flag: p_ctf{you_are_the_weakest_link_good_bye}.