-1

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

  • 3
    it would be better if you could extract your problem into something you could post here, most people wont follow an external link (except maybe to a sandbox where you can run the code) – Grady Player Oct 23 '18 at 15:10
  • can't you use a for loop and try each of them? – ZisIsNotZis Oct 23 '18 at 15:12
  • Thank you guys for the quick response. I have uploaded it to a sandbox at the link below https://onlinegdb.com/ryRYih2im . I get the idea of just looping it but just cant seen to get it to work – Craig Godbold Oct 23 '18 at 15:18

1 Answers1

0

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
Yura Beznos
  • 546
  • 4
  • 9