Created
April 2, 2019 23:53
-
-
Save rdkls/89134d6e173faf179bbeb18dbf3cfd95 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import zipfile | |
from itertools import product | |
filename = 'certs-20190403.zip' | |
pwd_len = 6 | |
from string import digits, ascii_uppercase, ascii_lowercase | |
chars = digits + ascii_uppercase + ascii_lowercase + '_' | |
print('Character set: %s' % chars) | |
fp = zipfile.ZipFile(filename) | |
passwords = product(chars, repeat=pwd_len) | |
total = len(list(passwords)) | |
print('Begin, %s passwords to try ...' % total) | |
n=0 | |
for password in product(chars, repeat=pwd_len): | |
password = ''.join(password) | |
if not n % 1000: | |
print('%s - %s of %s (%s%% complete)' % (password, n, total, round(float(n)/total*100, 2))) | |
try: | |
fp.extractall(pwd=password) | |
raise Exception('FOUND %s' % password) | |
except RuntimeError: | |
pass | |
n += 1 | |
print('Finished - no password for you') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment