嗯,我正在编写一个软件,它将使用"Passwords.txt"
文件中给定的密码(逐行读取[每行都有其密码])强制执行一个名为"Blockers password.zip"
的文件
问题是,我在ZipFile模块中得到了错误"Bad password for file"
,然后我进行了一些搜索,发现ZipFile模块不支持AES加密(PyZipper支持),所以我无法用它解密文件,现在,使用PyZipper,我得到了相同的错误,我不知道为什么
"Passwords.txt
“文件的内容:
https://prnt.sc/rueuf1
这是代码
import pyzipper
name_file = 'Passwords.txt'
# This file contains all the generated passwords
# for bruteforcing the file which has
# my blockers password
passwords_for_bruteforce = open(name_file, 'r')
# My goal here is use every password in the 'Passwords.txt' file
# to do a bruteforce on the 'Blockers password.zip'
# but it can't be bruteforced because of the "RuntimeError: Bad password for file"
# and the correct password is in the last line of the 'Passwords.txt'
for line in passwords_for_bruteforce:
password = line.rstrip('\n')
with pyzipper.AESZipFile('Blockers password.zip', 'r') as zip_file:
zip_file.pwd = password
zip_file.extractall()
passwords_for_bruteforce.close()
你想用暴力来对付它。这意味着您需要处理错误的密码,否则第一个密码必须是正确的,否则它将抛出您的错误。 正如@Todd所说,try/except块应该可以解决问题:
依我看,你也可以打开文件一次,然后尝试多次解压缩。这将为您节省一些IO操作
相关问题 更多 >
编程相关推荐