Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 1.43 KB

一路到底.md

File metadata and controls

59 lines (40 loc) · 1.43 KB

一路到底

知识点

python提取压缩包文件名

解题

给了一个压缩包,解压后发现有很多文件,文件内容比较类似

51728 : The next is d08299c283bf96c9e64439ceca8be04f.txt

猜测前面的是16进制信息,后面给的是下一个文件的文件名,且转为16进制长度不超过4,根据顺序读取,编写代码

# 指定目录
import os
import binascii

dir = "/mnt/c/Users/cc/Downloads/38ff11ef-e3d3-4f8a-b163-3d300bc016ea/files"

hexdata = ''

with open(os.path.join(dir, 'start.txt'), 'r') as f:
    cont = f.read()
    # print(hex_data)
    hexdata += hex(int(cont.split(':')[0].strip()))[2:]
    next_file = cont.split(' ')[-1].strip()
    while True:
        path = os.path.join(dir, next_file)
        try:
            with open(path, 'r') as f:
                cont = f.read()
                hexdata += "{:04x}".format(int(cont.split(':')[0].strip()))
                next_file = cont.split(' ')[-1].strip()
        except:
            break

with open('flag.zip','wb') as f:
    f.write(binascii.unhexlify(hexdata))

image-20231206163503186

发现压缩包有密码,也没有伪加密,爆破密码

image-20231207095117175

解压后得到

image-20231207095223281

image-20231207095243702

文件头异常,应该时jpg文件,修改文件头FF D8 DD E0

image-20231207095336355