Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import hashlib
- import random
- def dict_attack(pwds):
- print("[*] Starting dictionary attack...")
- f = open('Dictionary.txt', 'r')
- words = f.readlines()
- f.close()
- cracked = []
- for pwd in pwds:
- print("[-] Testing for {}...".format(pwd))
- for w in words:
- word = w.strip('\n')
- word = word.strip(' ')
- hashed = hashlib.md5(word.encode())
- # Uncomment this line if you want it to show everything it tries print("[-] Trying {} as {}...".format(word, hashed.hexdigest()))
- if hashed.hexdigest() == pwd:
- print("[+] Found {} as {}, updating...".format(pwd, word))
- cracked.append(word)
- break
- print("[-] {}/{} passwords found!".format(len(cracked), len(pwds)))
- return cracked
- def main():
- # Write in the passwords list if you want customized passwords
- passwords = []
- """
- If you want randomly generated passwords, uncomment the """'s
- f = open('Dictionary.txt', 'r')
- words = f.readlines()
- f.close()
- for b in range(0, 10):
- passwords.append(random.choice(words))
- passwords[b] = passwords[b].strip('\n')
- passwords[b] = passwords[b].strip(' ')
- """
- hashed_passwords = []
- for p in passwords:
- hashed_passwords.append(hashlib.md5(p.encode()).hexdigest())
- #print(hashed_passwords)
- print(dict_attack(hashed_passwords))
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement