不能用
import zipfile
from tqdm import tqdm
import itertools as it
def extractFile(zipFile, password):
try:
zipFile.extractall(pwd= bytes(password, "utf8" ))
print('******************************************************************')
print("压缩包密码是" + password) #破解成功
print("压缩包密码是" + password)
print("压缩包密码是" + password)
s = input('程序暂停,任意键终止')
except:
pass #失败,就跳过
def main():
zipFile = zipfile.ZipFile('FM 资料\FM.zip')
# PwdLists = open('passdict.txt') #读入所有密码
# set_unit = 'ABCDEFGHILMNOPQRSTUVWXYZabcdefghilmnopqistuvwxyz1234567890'
set_unit = 'abcdefghilmnopqistuvwxyz1234567890'
for length in range(6,8):
print(length)
Pwd1 = []
for e in it.combinations_with_replacement(set_unit, length):
Pwd = ''.join(e)
Pwd1.append(Pwd)
for i in tqdm(range(len(Pwd1))):
guess = extractFile(zipFile, Pwd1[i])
if __name__ == '__main__':
main()