微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

.zip 文件的密码破解程序没有给出错误我如何解决它?

如何解决.zip 文件的密码破解程序没有给出错误我如何解决它?

我的 .zip 文件密码破解程序在第 53 行 (z.extract(Item)) 处停止,没有错误消息。正在制作密码,但我不确定发生了什么。

import zipfile

input("press enter to start...")

#characterlist
Charlist = ("abcdefghijklmnopqrstuvwxyz")
Com = [] #complete combination list 

#error handling
while True:
    try:
        rg = int(input("Range of char: ")) #how big is the password
        break
    except ValueError:
        print("Please use an integer")
        print( )

#calculation of all possible tries
total = 26**rg

print( )
print("thease are all the possible outcomes with the amount of characters the password has")
print(total)
print( )

#combination
for current in range(int(rg)):
    Alph = [i for i in Charlist]
    for x in range(current):
        Alph = [y + i for i in Charlist for y in Alph] #the combination
    Com = Com + Alph

#zipfile error handling
while True:
    try:
        file = input("Zipfile name: ") #the name of the zip file that has the locked items in
        z = zipfile.ZipFile(file + ".zip") #the zip name + the .zip
        break
    except FileNotFoundError:
        print("File was not found (ps. do not add .zip to the end of the zip file name)")
        print( )

#number of tries
Tr = 0
Item = input("Name of file that is secured + its type (eg: .txt): ") #the file that you want to crack

for password in Com:
    try:
        Tr += 1 #incrementation of tries
        z.setpassword(password.encode('ascii')) #setting password
        z.extract(Item)
        print(f'Passcode was found,the passcode was {password}') #from here to the end area isn't being read :(
        print(f'It was found at try number {Tr}')
        break
    except:
        pass

input("press enter to close...")

错误”消息:

Zipfile name: example
Name of file that is secured + its type (eg: .txt): example.txt
press enter to close...
>>> 

它结束时没有提供反馈,也没有做任何事情。应该发生什么:

Zipfile name: example
Name of file that is secured + its type (eg: .txt): example.txt
Passcode was found,the passcode was 'example'
It was found at try number 'x'
press enter to close...
>>> 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。