mansz81

Hash-Cracker

Oct 7th, 2022
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.83 KB | None | 0 0
  1. import hashlib,binascii
  2. hash_type=input("Enter the hash type\n1 md5\n2 sha1\n3 Sha224\n4 SHA256\n5 SHA512\n6 NTLM\n")
  3. path_to_wordlist = input ("Enter path to word list\n")
  4. input_hash=input("Enter the hash crack\n")
  5. def md5_crack(hash_to_crack,path_to_wordlist):
  6.     c = 1
  7.     with open (path_to_wordlist, encoding='utf-8') as file1:
  8.         for line in file1:
  9.             current_pass = line.replace('\n', '').rstrip()
  10.             hash_current = hashlib.md5 (current_pass.encode('utf-8')).hexdigest()
  11.             c += 1
  12.             if c%100000 == 0:
  13.                 print (f"Done {c} passwords current{current_pass}")
  14.             if hash_current == hash_to_crack:
  15.                 print (f"Password found ---> {current_pass}")
  16.                 break
  17. def sha1_crack(hash_to_crack,path_to_wordlist):
  18.     c = 1
  19.     with open (path_to_wordlist, encoding='utf-8') as file1:
  20.         for line in file1:
  21.             current_pass = line.replace('\n', '').rstrip()
  22.             hash_current = hashlib.sha1(current_pass.encode('utf-8')).hexdigest()
  23.             c += 1
  24.             if c%100000 == 0:
  25.                 print (f"Done {c} passwords current{current_pass}")
  26.             if hash_current == hash_to_crack:
  27.                 print (f"Password found ---> {current_pass}")
  28.                 break
  29. def sha224_crack(hash_to_crack,path_to_wordlist):
  30.     c = 1
  31.     with open (path_to_wordlist, encoding='utf-8') as file1:
  32.         for line in file1:
  33.             current_pass = line.replace('\n', '').rstrip()
  34.             hash_current = hashlib.sha224(current_pass.encode('utf-8')).hexdigest()
  35.             c += 1
  36.             if c%100000 == 0:
  37.                 print (f"Done {c} passwords current{current_pass}")
  38.             if hash_current == hash_to_crack:
  39.                 print (f"Password found ---> {current_pass}")
  40.                 break
  41. def sha256_crack(hash_to_crack,path_to_wordlist):
  42.     c = 1
  43.     with open (path_to_wordlist, encoding='utf-8') as file1:
  44.         for line in file1:
  45.             current_pass = line.replace('\n', '').rstrip()
  46.             hash_current = hashlib.sha256(current_pass.encode('utf-8')).hexdigest()
  47.             c += 1
  48.             if c%100000 == 0:
  49.                 print (f"Done {c} passwords current{current_pass}")
  50.             if hash_current == hash_to_crack:
  51.                 print (f"Password found ---> {current_pass}")
  52.                 break
  53. def sha512_crack(hash_to_crack,path_to_wordlist):
  54.     c = 1
  55.     with open (path_to_wordlist, encoding='utf-8') as file1:
  56.         for line in file1:
  57.             current_pass = line.replace('\n', '').rstrip()
  58.             hash_current = hashlib.sha512(current_pass.encode('utf-8')).hexdigest()
  59.             c += 1
  60.             if c%100000 == 0:
  61.                 print (f"Done {c} passwords current{current_pass}")
  62.             if hash_current == hash_to_crack:
  63.                 print (f"Password found ---> {current_pass}")
  64.                 break
  65. def NTLM_crack(hash_to_crack,path_to_wordlist):
  66.     c = 1
  67.     with open (path_to_wordlist, encoding='utf-8') as file1:
  68.         for line in file1:
  69.             current_pass = line.replace('\n', '').rstrip()
  70.             hash_current = hashlib.NTLM(current_pass.encode('utf-8')).hexdigest()
  71.             c += 1
  72.             if c%100000 == 0:
  73.                 print (f"Done {c} passwords current{current_pass}")
  74.             if hash_current == hash_to_crack:
  75.                 print (f"Password found ---> {current_pass}")
  76.                 break
  77.  
  78. if hash_type =="1":
  79.      md5_crack (input_hash, path_to_wordlist)
  80. if hash_type =="2":
  81.      sha1_crack(input_hash, path_to_wordlist)
  82. if hash_type == "3":
  83.     sha224_crack(input_hash, path_to_wordlist)
  84. if hash_type =="4":
  85.      sha256_crack(input_hash, path_to_wordlist)
  86. if hash_type =="5":
  87.      sha512_crack(input_hash, path_to_wordlist)
  88. if hash_type =="6":
  89.      NTLM_crack(input_hash, path_to_wordlist)
  90.  
Advertisement
Add Comment
Please, Sign In to add comment