我正在尝试构建一个没有字典攻击的 winzip 文件破解器(关于密码安全的文章)。它需要滚动尝试每个组合的“组合”迭代,直到找到密码。如此接近完成,但目前它需要将密码输入作为单个字符串,需要将其转换为字节,而我需要它来尝试组合总数的每个输出
预先感谢您的任何帮助
我已将其保存在沙箱中https://onlinegdb.com/ryRYih2im
文件链接在这里 https://drive.google.com/open?id=1rpkJnImBJdg_aoiVpX4x5PP0dpEum2fS
我正在尝试构建一个没有字典攻击的 winzip 文件破解器(关于密码安全的文章)。它需要滚动尝试每个组合的“组合”迭代,直到找到密码。如此接近完成,但目前它需要将密码输入作为单个字符串,需要将其转换为字节,而我需要它来尝试组合总数的每个输出
预先感谢您的任何帮助
我已将其保存在沙箱中https://onlinegdb.com/ryRYih2im
文件链接在这里 https://drive.google.com/open?id=1rpkJnImBJdg_aoiVpX4x5PP0dpEum2fS
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