赞
踩
# -*-coding:utf-8-*- import itertools import time import zipfile filepath = "文件路径" uncompress_path = "解压路径" # 密码位数 pwd_num_list = [3,4,5] # 暴力破解全排列的字典 # pwd_dic = "abcdefghijklmnopqrstuvwxyz" pwd_dic = "abcdefghijklmnopqrstuvwxyz0123456789" # pwd_dic = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" # pwd_dic = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" # pwd_dic = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~!@#$%^&*()_+-=<>." def uncompress(filepath,password): try: with zipfile.ZipFile(filepath) as zFile: zFile.extractall(uncompress_path,pwd=password.encode("utf-8")) return True # if password=="1234": # return True except: return False count = 0 start_time = time.time() for pwd_num in pwd_num_list: for c in itertools.permutations(pwd_dic, pwd_num): count += 1 password = "".join(c) # print(password) if count % 10000 == 0: print("已尝试破解", count, "次") result = uncompress(filepath, password) if result: print("用时:", (time.time() - start_time), "秒") print("一共尝试了", count, "次") print("解压成功,密码是:", password) break
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。