Advertisement
PlayerHK

Untitled

May 12th, 2022
891
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.21 KB | None | 0 0
  1. import hashlib
  2. import time
  3.  
  4. hash_type = input("Enter the hash type\n1 md5\n2 sha1\n3 NTLM\n")
  5. path_to_wordlist = input("Enter path to word list\n")
  6. input_hash = input("Enter the hash t crack\n")
  7.  
  8. def md5_crack(hash_to_crack,path_to_wordlist):
  9.     global c
  10.     c = 1
  11.     with open(path_to_wordlist,encoding='utf-8') as file1:
  12.         for line in file1:
  13.             current_pass = line.replace('\n','').rstrip()
  14.             hash_current = hashlib.md5(current_pass.encode('utf-8')).hexdigest()
  15.             c += 1
  16.             if c%100000 == 0:
  17.                 print(f"Done {c} passwords current ---> {current_pass}")
  18.             if hash_current == hash_to_crack:
  19.                 print(f"Password found ---> {current_pass}")
  20.                 break
  21.  
  22. def sha1_crack(hash_to_crack,path_to_wordlist):
  23.     c = 1
  24.     with open(path_to_wordlist,encoding='utf-8') as file1:
  25.         for line in file1:
  26.             current_pass = line.replace('\n','').rstrip()
  27.             hash_current = hashlib.sha1(current_pass.encode('utf-8')).hexdigest()
  28.             c += 1
  29.             if c%100000 == 0:
  30.                 print(f"Done {c} passwords current ---> {current_pass}")
  31.             if hash_current == hash_to_crack:
  32.                 print(f"Password found ---> {current_pass}")
  33.                 break
  34.            
  35. def ntlm_crack(hash_to_crack,path_to_wordlist):
  36.     c = 1
  37.     with open(path_to_wordlist,encoding='utf-8') as file1:
  38.         for line in file1:
  39.             current_pass = line.replace('\n','').rstrip()
  40.             hash_current = hashlib.new('md4',current_pass.encode('utf-16le')).hexdigest()
  41.             c += 1
  42.             if c%100000 == 0:
  43.                 print(f"Done {c} passwords current ---> {current_pass}")
  44.             if hash_current == hash_to_crack:
  45.                 print(f"Password found ---> {current_pass}")
  46.                 break
  47.                  
  48. if hash_type == "1":
  49.     time1 = time.time()
  50.     md5_crack(input_hash,path_to_wordlist)
  51.     time2 = time.time()
  52.     diff = time2-time1
  53.     wps = float(c)/float(diff)
  54.     print(f"time taken:{diff} {wps} w/s")
  55. elif hash_type == "2":
  56.     sha1_crack(input_hash,path_to_wordlist)
  57. elif hash_type == "3":
  58.     ntlm_crack(input_hash.lower(),path_to_wordlist)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement