Python Winzip Password Tester without dictionary

534 Views Asked by At

I am trying to build a winzip file cracker without a dictionary attack (For an essay on password security). It needs to scroll through the "combos" iteration trying each combination until the passwords is found. So close to being done but currently it needs the password entry as a single string which is required to be converted to bytes whereas I need it to try each output of the combostotal

Thank you in advance for any help

I have saved it in a sandbox https://onlinegdb.com/ryRYih2im

Link to the file is here https://drive.google.com/open?id=1rpkJnImBJdg_aoiVpX4x5PP0dpEum2fS

Click for screenshot

1

There are 1 best solutions below

0
Yura Beznos On

Simple zip brute force password cracker

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