2.7 [GXYCTF2019]Is this base?


首先打开题目发现有很多行base64,想到base64隐写。所谓的base64隐写就是通过在base64最后几个字节中隐藏信息,所以要使用很多行来存储信息。看到有很多行base64首先要想到base64隐写!


使用脚本跑即可,附上脚本:

1
2
3
4
5
6
7
8
9
10
11
b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
with open('1.txt', 'rb') as f:
bin_str = ''
for line in f.readlines():
stegb64 = ''.join(line.split())
rowb64 = ''.join(stegb64.decode('base64').encode('base64').split())
offset = abs(b64chars.index(stegb64.replace('=','')[-1])-b64chars.index(rowb64.replace('=','')[-1]))
equalnum = stegb64.count('=') #no equalnum no offset
if equalnum:
bin_str += bin(offset)[2:].zfill(equalnum * 2)
print ''.join([chr(int(bin_str[i:i + 8], 2)) for i in xrange(0, len(bin_str), 8)])

得到flag

#
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×