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

2021-09-22|

import zipfile
import string
import itertools
myzipfile = 'zipsecretfile.zip'
def uncompress(zipfilename,password):
    try:
        zfile = zipfile.ZipFile(zipfilename)
        zfile.extractall('./',pwd=password.encode('utf-8'))
        return True
    except:
        return False

chars = string.ascii_lowercase+string.digits
print('正在解压......')
for c in itertools.permutations(chars,4):
    password = ''.join(c)
    res = uncompress(myzipfile,password)
    if res:
        print('解压成功',password)
        break

标签: password zipfile import string zipfilename 解压 uncompress itertools myzipfile return
出处: https://www.toutiao.com/a7010261792328892940/

文明发言,请先登录

文明上网理性发言,请遵守国家法律法规。

最新评论

©2003- 黑基网 黑名单存档手机版网站地图免责条款法律声明隐私保护