题目:拼在一起解下base64就有flag
打开附件,发现都是68个小的压缩文件,且是加密的,根据题目提示,考虑crc32碰撞。
import zipfile
import string
import binascii
import base64
d = open('rs.zip', 'wb')
b64 = ''
dic = string.ascii_letters + string.digits + '{}_+/='
def CrackCrc(crc):
for i in dic:
for j in dic:
for k in dic:
for h in dic:
s = i + j + k + h
if crc == (binascii.crc32(s.encode())):
# b64+=s
return s
def CrackZip():
ts = ''
for i in range(68):
print(str(i) + '开始\n')
fn = '1\\' + 'out' + str(i) + '.zip'
with open(fn, 'r') as ob:
crc = zipfile.ZipFile(fn, 'r').getinfo('data.txt').CRC
# obf=ob.read()
# crc = ''.join(obf[14:18])
ts += CrackCrc(crc)
print(str(i) + 'end\n')
return ts
b64 = CrackZip()
print("CRC32碰撞完成")
print(b64)
ds = base64.b64decode(b64)
d.write(ds)
d.close()
得到:z5BzAAANAAAAAAAAAKo+egCAIwBJAAAAVAAAAAKGNKv+a2MdSR0zAwABAAAAQ01UCRUUy91BT5UkSNPoj5hFEVFBRvefHSBCfG0ruGnKnygsMyj8SBaZHxsYHY84LEZ24cXtZ01y3k1K1YJ0vpK9HwqUzb6u9z8igEr3dCCQLQAdAAAAHQAAAAJi0efVT2MdSR0wCAAgAAAAZmxhZy50eHQAsDRpZmZpeCB0aGUgZmlsZSBhbmQgZ2V0IHRoZSBmbGFnxD17AEAHAA==
是base64编码,解密后得到乱码,010查看可以发现有flag.txt字样:考虑压缩文件,补齐文件头得到
打开后发现
flag{nev3r_enc0de_t00_sm4ll_fil3_w1th_zip}
标签:zip,b64,base64,misc,dic,crc,import,压缩包 From: https://blog.csdn.net/mails2008/article/details/140430063