用python暴力破解有密码的zip文件

import zipfileimport stringimport itertoolsmyzipfile = 'zipsecretfile.zip'def uncompress(zipfilename,password):try:zfile = zipfile.ZipFile(zipfilename)zfile.extractall('./',pwd=password.encode('utf-8'))return Trueexcept:return Falsechars = string.ascii_lowercase+string.digitsprint('正在解压......')for c in itertools.permutations(chars,4):password = ''.join(c)res = uncompress(myzipfile,password)if res:print('解压成功',password)break
【用python暴力破解有密码的zip文件】


    推荐阅读