Created
February 25, 2020 09:48
-
-
Save mightbesimon/2e0d76ac2e4b293386b2aad9d547da32 to your computer and use it in GitHub Desktop.
crack a list of 'email:md5hash' from a wordlist of passwords
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
import hashlib | |
import uuid | |
HASHFILE = 'example.hash' | |
WORDLIST = 'example.dict' | |
def md5(password): | |
return hashlib.md5(password.encode()).hexdigest() | |
with open(HASHFILE, 'r') as file: creds = file.read().split('\n') | |
hashcred = [line.split(':') for line in creds] | |
emails = [h[0] for h in hashcred] | |
hashes = [h[1] for h in hashcred] | |
with open(WORDLIST, 'r') as file: pwlist = file.read().split('\n') | |
hashlist = [md5(pw) for pw in pwlist] | |
matches = list(set(hashes) & set(hashlist)) | |
emails = [emails[idx] for idx in [hashes.index(h) for h in matches]] | |
password = [pwlist[idx] for idx in [hashlist.index(h) for h in matches]] | |
cred = list(zip(emails, password)) | |
with open('pw.txt', 'w') as file: file.write(''.join('%s:%s\n' % line for line in cred)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment