Skip to content

Instantly share code, notes, and snippets.

@narbehaj
Last active October 16, 2017 08:19
Show Gist options
  • Save narbehaj/607940c6fa61a8f455c9d68074037667 to your computer and use it in GitHub Desktop.
Save narbehaj/607940c6fa61a8f455c9d68074037667 to your computer and use it in GitHub Desktop.
Simple Python Bruteforce
from hashlib import md5
import random
from itertools import chain, product
def bruteforce(charset, maxlength):
return (''.join(candidate)
for candidate in chain.from_iterable(product(charset, repeat=i)
for i in range(2, maxlength + 1)))
m = md5()
with open('md5.txt', 'w') as file_:
for i in bruteforce('abcdefghijklmnopqrstuvwxyz_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ*!@#$%^&()-=][}{;/.,', 10):
m.update(str(i).encode('utf-8'))
file_.writelines('{}\t{}\n'.format(m.hexdigest(), i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment