复现楚慧杯 ez_zip

发布于 2023-12-19  72 次阅读


这一道题里面是四千多个压缩包压在一起的,手动解开肯定是不行的,那么就需要脚本来解开这一个套娃压缩包:

import io
import zipfile
 
with open("ez_zip的附件.zip", "rb") as f:
    data = f.read()
 
info = "taptap"
 
while True:
    with zipfile.ZipFile(io.BytesIO(data), "r") as zf:
        all_files_processed = True
        for i in zf.filelist:
            fileName = i.filename.encode("cp437").decode("gbk")
            if zipfile.is_zipfile(io.BytesIO(zf.read(i.filename))):
                print(fileName)
                data = zf.read(i.filename)
                all_files_processed = False
                
                info += f" {fileName.replace('.zip', '')}"
            else:
                print(fileName)
                with open(fileName, "wb") as f:
                    f.write(zf.read(i.filename))
 
        if all_files_processed:
            break
 
print(info)

解压文成后可以获得一个txt文件,把里面的加号改为1,减号改为0,再二进制转ascll就可以得到flag

+-+++-++ +-+++++- +-+-++-- +-++++-- +-+-+-++ +-+++--+ +----+-- ++--+++- ++--++++ +--+++-- ++--+-+- ++---+++ ++--++-+ ++--+-+- ++---+++ +--+++-- +--+++-- +--++--+ ++--+++- +--++-+- ++--+--- +--+++-- ++--+--+ ++--++-- ++--+++- +--++-+- ++--+-+- ++---++- ++--+++- ++--+++- +--++-+- +--++-++ ++--+--+ +--++++- +--+++-- +--+++-- ++--+-++ +--++-+- +--++-++ +-----+-

所以解出来flag为:DASCTF{10c58258ccf1e7c631e5911ed6acc4ed}


The world's full of lonely people afraid to make the first move.