CTFshow—Crypto 13 2021-11-22 打开题目所给文件,仅有一个base.txt,并且很长,直接跳到末尾发现等号,于是猜测应该是base32或base64。 由于base家族编码以后密文比明文更长,所以猜测base.txt是加密很多次过后的结果,由于不确定过程中究竟用了几种加密,写脚本的时候可以分情况遍历。脚本如下: 12345678910111213141516171819202122232425262728293031323334import base64s=''with open('base.txt', 'r', encoding='UTF-8') as f: s=''.join(f.readlines()).encode('utf-8')src=s while True: try: src=s s=base64.b16decode(s) str(s,'utf-8') continue except: pass try: src=s s=base64.b32decode(s) str(s,'utf-8') continue except: pass try: src=s s=base64.b64decode(s) str(s,'utf-8') continue except: pass breakwith open('result.txt','w', encoding='utf-8') as file: file.write(str(src,'utf-8'))print("Decryption complete!") 结果: crypto ctfshow ctfshow 扫一扫,分享到微信