导语
pillar的刷题日记
zip
开局一个压缩包,打开全是压缩包
每个压缩包都不大,crc暴破。但是并不是很会,就去看了别人的脚本
import zipfile import string import binascii
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())): f.write(s) return
def CrackZip(): for i in range(0,68): file = 'out'+str(i)+'.zip' crc = zipfile.ZipFile(file,'r').getinfo('data.txt').CRC CrackCrc(crc) print('\r'+"loading:{:%}".format(float((i+1)/68)),end='')
dic = string.ascii_letters + string.digits + '+/=' f = open('out.txt','w') print("\nCRC32begin") CrackZip() print("CRC32finished") f.close()
|
用zipfile来读取zip中的crc32。
暴破完了就得到
z5BzAAANAAAAAAAAAKo+egCAIwBJAAAAVAAAAAKGNKv+a2MdSR0zAwABAAAAQ01UCRUUy91BT5UkSNPoj5hFEVFBRvefHSBCfG0ruGnKnygsMyj8SBaZHxsYHY84LEZ24cXtZ01y3k1K1YJ0vpK9HwqUzb6u9z8igEr3dCCQLQAdAAAAHQAAAAJi0efVT2MdSR0wCAAgAAAAZmxhZy50eHQAsDRpZmZpeCB0aGUgZmlsZSBhbmQgZ2V0IHRoZSBmbGFnxD17AEAHAA==
base64解码,显然是字节流
用脚本写进文件
import base64
s='z5BzAAANAAAAAAAAAKo+egCAIwBJAAAAVAAAAAKGNKv+a2MdSR0zAwABAAAAQ01UCRUUy91BT5UkSNPoj5hFEVFBRvefHSBCfG0ruGnKnygsMyj8SBaZHxsYHY84LEZ24cXtZ01y3k1K1YJ0vpK9HwqUzb6u9z8igEr3dCCQLQAdAAAAHQAAAAJi0efVT2MdSR0wCAAgAAAAZmxhZy50eHQAsDRpZmZpeCB0aGUgZmlsZSBhbmQgZ2V0IHRoZSBmbGFnxD17AEAHAA==' fd=open('result.bin','wb+') b=base64.b64decode(s) fd.write(b) fd.close()
|
十六进制编辑器打开一看
提示我们修补文件,得到flag,且在最后显然是一个文件的尾部,经过查询,发现是rar的尾部,但是显然没有rar头部,所以加个rar头部
52 61 72 21 1A 07 00
打开一看,注释里是flag(7z无法看到rar的注释,用winrar看注释吧)
flag{nev3r_enc0de_t00_sm4ll_fil3_w1th_zip}