zip层层压缩,写脚本爆破:
import zipfile
import os
current_path = r"C:/Users/SoberJoker/Downloads/attachment/"
if __name__ == "__main__":
pwd = ""
ls = os.listdir(current_path)
while True:
try:
former = ls[0]
f = zipfile.ZipFile(current_path + ls[0])
pwd = ls[0].split('.')[0]
for file in f.namelist():
f.extract(file, current_path, pwd.encode())
f.close()
os.remove(current_path + former)
ls = os.listdir(current_path)
except:
break
print(ls[0])
- 脚本思路是:在一个文件夹中进行所有操作
- 首先获取解压密码,即文件名
- 解压到当前目录
- 删除之前的压缩包
- 当尝试解压得到的文件,抛出异常时,退出循环并打印文件名
文件内容:
(255, 255, 255)
(255, 255, 255)
(255, 255, 255)
(255, 255, 255)
(255, 255, 255)
(255, 255, 255)
(255, 255, 255)
(255, 255, 255)
(255, 255, 255)
………………
四万条数据,也就是分辨率200*200,根据RGB绘图:
from PIL import Image
x = y = 200
img = Image.new("RGB",(x,y))
f = open("Autopy/misc/draw/dots.txt",'r')
for width in range(0,x):
for height in range(0,y):
line = f.readline().lstrip('(').rstrip(')\n')
rgb = line.split(', ')
img.putpixel((width,height),(int(rgb[0]),int(rgb[1]),int(rgb[2])))
img.save('flag.jpg')
- Image.new()方法,顾名思义,是用来new一个新的图像,具体参数如下:
- mode:模式,通常用"RGB"这种模式
- size:生成的图像大小
- color:生成图像的颜色,默认为0,即黑色。
- img.putpixel(),修改指定像素点