#!/usr/bin/env python
# encoding: utf-8
import pyzipper
def extract_file(zip_file, password):
with pyzipper.AESZipFile(zip_file, 'r', compression=pyzipper.ZIP_LZMA, encryption=pyzipper.WZ_AES) as f:
f.setpassword(password.encode('utf-8'))
f.extractall()
def judge(list_flag):
for flag in list_flag:
if not flag:
return False
return True
def main():
list_zip = ["xxxx.zip", "yyyy.zip"]
list_flag = [False, False]
dict_name = "wordlist.txt"
dict_file = open(dict_name)
lines = dict_file.readlines()
size = len(lines)
zip_size = len(list_zip)
for index in range(size):
for index2 in range(size):
w1 = lines[index].replace('\n', '')
w2 = lines[index2].replace('\n', '')
pwd = w1 + "_" + w2
if judge(list_flag):
print("done")
return
for i in range(zip_size):
if list_flag[i]:
continue
try:
extract_file(list_zip[i], pwd)
print("[+] Found %s password: %s" % (list_zip[i], pwd))
list_flag[i] = True
except Exception as e:
pass
if __name__ == '__main__':
main()