解压有很多文件,按名称排下序:
开始以为找到最后一个文件就行了:
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()
- to_bytes():整数转二进制对象
- misc中python脚本会用到的进制、字符转换
真的不容易啊,爆破密码(6位、小写字母和数字也是从别的wp那里知道的):
得到图片打不开,注意到 JFIF
和末尾是jpg的结尾标识 FF D9
,修改文件头部标识为 FF D8 FF E0
:
flag{0c6b489ca956e2fd94dce12be4bf0729}