Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # get dictionary file here: http://www.math.sjsu.edu/~foster/dictionary.txt
- import zipfile
- import sys
- import itertools
- def begin():
- exit = 0
- x = 0
- zip = zipfile.ZipFile(file, "r") # zip file name
- with open('dictionary.txt') as f: # dictionary file name
- con = f.read().splitlines() # set con to contain the text document as a list
- while x != 349999: # number of words in dictionary minus 1
- if exit != 0:
- sys.exit(0)
- try:
- password = con[x] # set password to x in list
- zip.setpassword(password) # try it
- zip.extractall()
- zip.printdir()
- zip.close()
- x = 349999
- print '************************'
- print password, 'accepted' # if password is correct
- print '************************'
- exit = 1
- except: # if password is wrong
- print password, 'bad'
- x += 1 # x + 1
- chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_$&#@ " # possible characters
- for length in range(0,20):
- for attempt in itertools.product(chars,repeat = length):
- if exit != 0:
- sys.exit(0)
- password = ''.join(attempt)
- print password, 'bad'
- try:
- zip.setpassword(password) # try it
- zip.extractall()
- zip.printdir()
- zip.close()
- print password, 'accepted'
- exit = 1
- except:
- pass
- file = raw_input('Locked ZIP file name: ')
- begin()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement