.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 (将#修改为@)