BUUCTF 一路到底

解压有很多文件,按名称排下序:

开始以为找到最后一个文件就行了:

import re

current_path = "C:/Users/SoberJoker/Downloads/files/"

start = open(current_path + "start.txt","r")
content = start.read()
while True:
    filename = re.findall(r" ([A-Za-z0-9.]+)$",content)
    if filename:
        nextfile = open(current_path + filename[0],"r")
        content = nextfile.read()
        nextfile.close()
    else:
        break
print(content)
start.close()

发现不是那回事:

这时候注意到 start.txt 开头的字符串 20555,换算成十六进制:

这不是zip压缩包的16进制标识吗?看一下下一个文件:

果然是,修改一下脚本,将每个txt开头的数字转换成二进制写一个zip

import re

current_path = "C:/Users/SoberJoker/Downloads/files/"

start = open(current_path + "start.txt","r")
zipfile = open("1.zip","wb")
content = start.read()
while True:
    num = re.findall(r"^[0-9]+",content)[0]
    zipfile.write((int(num)).to_bytes(2, byteorder = 'big'))
    filename = re.findall(r" ([A-Za-z0-9.]+)$",content)
    if filename:
        nextfile = open(current_path + filename[0],"r")
        content = nextfile.read()
        nextfile.close()
    else:
        break
print(content)
start.close()
zipfile.close()

真的不容易啊,爆破密码(6位、小写字母和数字也是从别的wp那里知道的):

得到图片打不开,注意到 JFIF和末尾是jpg的结尾标识 FF D9,修改文件头部标识为 FF D8 FF E0

flag{0c6b489ca956e2fd94dce12be4bf0729}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值