BMZCTF 2018 AFCTF BASE

下载附件,是一个文本,很大,打开看了下,是一个很长的字符串,有0~9,A~Z,怀疑是16进制,

BMZCTF 2018 AFCTF BASE

解码后,看到后面有个“=”,怀疑是base64。

BMZCTF 2018 AFCTF BASE

多次base64后,看到结尾是“=”,但解码后是乱码,看到题目是base。怀疑不是base32,就是base16。

写脚本:

import base64

with open (r'C: \flag_encode.txt','r',encoding='utf-8') as f:
    for a in f:
        while 1:
            try :
                a=base64.b64decode(a).decode("utf-8")
            except:
                pass
            try:
                a=base64.b32decode(a).decode("utf-8")
            except:
                pass
            try:
                a=base64.b16decode(a).decode('utf-8')
            except:
                pass

            if "{" in a:

                print (a)

                break

运行后得到flag

上一篇:【阿里云天池Python训练营】Task1:Python基础入门:从变量到异常处理


下一篇:Python笔记:【九】异常与错误