Skip to content

Instantly share code, notes, and snippets.

@rdkls
Created April 2, 2019 23:53
Show Gist options
  • Save rdkls/89134d6e173faf179bbeb18dbf3cfd95 to your computer and use it in GitHub Desktop.
Save rdkls/89134d6e173faf179bbeb18dbf3cfd95 to your computer and use it in GitHub Desktop.
#!/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