最重要的还是字典!字典!字典!
import zipfile
import traceback
#读取字典
def read_dicts(filename):
dicts = []
with open(filename, 'r') as fp:
dicts = [pwd.strip() for pwd in fp.readlines()]
return dicts
#解压压缩包
def zipfuck(zip_f,pwd):
try:
zip_f.extractall('./temp',pwd=pwd.encode())
return pwd
except Exception as e:
if 'Bad password' in str(e):
return False
traceback.print_exc()
if __name__ == '__main__':
dict_file = './zip_dict.txt' #字典路径
zip_file = zipfile.ZipFile('./test.zip') #压缩文件路径
for password in read_dicts(dict_file):
result = zipfuck(zip_file,password)
if result:
print(f'[+] get password:{result}')
break
else:
print('[-] not found password.')
实测
转载:https://blog.csdn.net/qq_41328963/article/details/106241209
查看评论