神秘的base
题目描述
EvAzEwo6E9RO4qSAHq42E9KvEv5zHDt34GtdHGJaHD7NHG42bwd=神奇密码:
xbQTZqjN8ERuwlzVfUIrPkeHd******LK697o2pSsGD+ncgm3CBh/Xy1MF4JAWta
解题思路
这个题,上午一直零解,后来放出了hint,提示了base64换表。
这时候,再次观察一下,发现下方一行就是新的码表,但是需要爆破6位,上方就是换表后flag的编码。
解题代码
import itertools
import base64
target="OYiv05"
x="EvAzEwo6E9RO4qSAHq42E9KvEv5zHDt34GtdHGJaHD7NHG42bwd="
a = list(target)
list1 = []
b = list(itertools.permutations(a, len(target)))
for i in b:list1.append("".join(i))
print(len(list1))
string2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
c1="xbQTZqjN8ERuwlzVfUIrPkeHd"
c2="LK697o2pSsGD+ncgm3CBh/Xy1MF4JAWta"
for i in list1:c=c1+i+c2#print(c)#c=f"xbQTZqjN8ERuwlzVfUIrPkeHd{i}LK697o2pSsGD+ncgm3CBh/Xy1MF4JAWta"fl=base64.b64decode(x.translate(str.maketrans(string2, c)))fl=str(fl)if "\\x" not in fl and "/" not in fl and '''"''' not in fl and ";" not in fl and "~" not in fl:print(base64.b64decode(x.translate(str.maketrans(string2, c))))#flag{8ee3021432edffaa57527461952e632c}
小试牛刀
题目描述
ipfm\x82Kj]p~l?\x82ogw\x85mt[K\x8br\x97
题目分析
c=b'ipfm\x82Kj]p~l?\x82ogw\x85mt[K\x8br\x97'
target="flag"for i in range(len(target)):print(c[i]-ord(target[i]))
用flag头观察一下,发现变形凯撒
解题代码
c=b'ipfm\x82Kj]p~l?\x82ogw\x85mt[K\x8br\x97'
target="flag"
x=3
flag=""
for i in range(len(c)):flag+=chr(c[i]-x)#print(chr(c[i]-x))x+=1
print(flag)#flag{CaSer_1s_VerY_E4sY}