Простой взломщик паролей zip brute force
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