import zipfile37 as zf
import itertools
filename = '2021年中国研究生数学建模竞赛赛题.zip'
# password = 'ws12'
# uncompressor
def uncompress(filename,password):
try:
with zf.ZipFile(filename) as zfile:
zfile.extractall('./',pwd = password.encode('utf-8')) # 解压到当前目录
return True
except:
return False
chars = 'abcdefghijklmnnopqrstuvwxyz0123456789'
# Password Builder
for char in itertools.permutations(chars,4):
# 假设是四位字符
password = ''.join(char)
#print(password)
#调用前面uncompress方法
result = uncompress(filename,password)
if not result:
print('解压失败!',password)
else:
print('解压成功',password)
break
用Python破解压缩包测试代码--2021年中国研究生数学建模竞赛赛题
最新推荐文章于 2023-09-24 11:52:01 发布