攻防世界-MISC-新手練習(xí)區(qū):base64stego(python)
1.第一步是偽加密,用360壓縮可無視。
python2:
# -*- coding: cp936 -*-
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)])??# 8位一組
標(biāo)簽: