import os
from zipfile import ZipFile
import itertools as its
def pass_pwd(path,pwd):
type_text= os.path.splitext(path)[-1][1:]#比如123.text 经过处理就变成text
if type_text=='zip':
with ZipFile(path, 'r') as zip:
try:
zip.extractall("./new_file", pwd=str(pwd).encode('utf-8'))
print(f"成功{pwd}")
return True
except Exception as e:
pass
def creat_pwd(length):#使用迭代器
words = '1234567890asd'
for i in range(1, length):
base = its.product(words, repeat=i)
for i in base:
yield ''.join(i)
if __name__ == '__main__':
for p in creat_pwd(4):
flag = pass_pwd('./org_file/one.zip', p)
if flag:
break
压缩包密码破解
最新推荐文章于 2024-05-29 19:24:44 发布