没有字典的Python Winzip密码测试器

时间:2018-10-23 15:07:21

标签: python itertools winzip

我正在尝试构建一个没有字典攻击的Winzip文件破解程序(有关密码安全性的文章)。它需要在“组合”迭代中滚动,尝试每种组合,直到找到密码。如此接近完成,但目前它需要将密码输入作为单个字符串输入,该字符串必须转换为字节,而我需要使用它来尝试组合的每个输出

在此先感谢您的帮助

我已将其保存在沙箱https://onlinegdb.com/ryRYih2im

链接到文件在这里 https://drive.google.com/open?id=1rpkJnImBJdg_aoiVpX4x5PP0dpEum2fS

Click for screenshot

1 个答案:

答案 0 :(得分:0)

简单的zip暴力破解密码

from itertools import product
from zipfile import ZipFile, BadZipFile
import string

def find_pw():
    pw_length = 1
    while True:
        s = string.ascii_lowercase
        for x in product(s, repeat=pw_length):
            pwd = "".join(x)
            with ZipFile("test.zip") as zf:
                try:
                    zf.extractall(pwd=bytes(pwd, "UTF-8"))
                    print("Password is {}".format(pwd))
                    return
                except RuntimeError as e:
                    pass
                except BadZipFile as e:
                    pass
        pw_length += 1