no output/pwd print - zip cracker 进程已完成,退出代码为 0

no output/pwd print - zip cracker Process finished with exit code 0

import zipfile
import itertools
import string
from threading import Thread


def crack(zip, pwd):
    try:
        zip.extractall(pwd=str.encode(pwd))
        print("Success: Password is " + pwd)
    except:
        pass


zipFile = zipfile.ZipFile("/Users/Yamakasi/Desktop/PY/Mat1.zip")
myLetters = string.ascii_letters + string.digits + string.punctuation
for i in range(1, 1):
    for j in map("".join, itertools.product(myLetters, repeat=i)):
        t = Thread(target=crack, args=(zipFile, j))
        t.start()

#嘿@ll, 进程以退出代码 0 结束,但在 may zip cracker 上没有输出?问候并感谢您的帮助!

问题出在您的外部 for 循环上。它根本 运行。

range(i, j) 运行s 从 ij-1 所以 range(1, 1) 将 运行 从 10 这意味着根本不要 运行。

for i in range(1, 1):
    print("hi")

上面的代码没有 print 任何东西,因为 for 循环没有进入一次。如果你想 运行 for 循环一次,你应该使用:

for i in range(1, 2):
    print("hi")

输出:

hi