Password Cracking

SHA256, SHA512, MD5 hasher

#!/usr/bin/python

import hashlib

hashvalue = input("[*] Enter a string to hash: ") 
print("\n")

hashmd5 = hashlib.md5()
hashmd5.update(hashvalue.encode())
print("[+]The MD5 hash is: " + hashmd5.hexdigest())

hashsha1 = hashlib.sha1()
hashsha1.update(hashvalue.encode())
print("[+]The SHA1 hash is: " + hashsha1.hexdigest())

hashsha224 = hashlib.sha224()
hashsha224.update(hashvalue.encode())
print("[+]The SHA224 hash is: " + hashsha224.hexdigest())

hashsha256 = hashlib.sha256()
hashsha256.update(hashvalue.encode())
print("[+]The SHA256 hash is: " + hashsha256.hexdigest())

hashsha512 = hashlib.sha512()
hashsha512.update(hashvalue.encode())
print("[*]The SHA512 hash is: " + hashsha512.hexdigest())

SHA1 Hash decoder with Online Dictionary

#!/usr/bin/python

from urllib.request import urlopen
import hashlib
from termcolor import colored

sha1hash = input("[*] Enter SHA1 hash value: ")

passwordList = str(urlopen('https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-10000.txt').read(), 'utf-8')

for password in passwordList.split('\n'):
	hashguess = hashlib.sha1(bytes(password, 'utf-8')).hexdigest()
	if hashguess == sha1hash:
		print(colored("[+] The password is: " + str(password),'green'))
		quit()
	else:
		print(colored("[-] Password guess " + str(password) + " does not match, trying next one",'red'))

print("Password is not in the password list")

Password from MD5 Hash

#!/usr/bin/python

import hashlib
from termcolor import colored

def tryOpen(wordlist):
	global pass_file
	try:
		pass_file = open(wordlist, "r")
	except:
		print("[!!] No such file at that path")
		quit()
	
pass_hash = input("[*] Enter MD5 hash value: ")
wordlist = input("[*] Enter path to the password file: ")

tryOpen(wordlist)

for word in pass_file:
	print(colored("[-] Trying: " + word.strip('\n'), 'red'))
	encoded_word = word.encode('utf-8')
	md5digest = hashlib.md5(encoded_word.strip()).hexdigest()

	if md5digest == pass_hash:
		print(colored("[+] Password found: " + word, 'green'))
		exit(0)

print("[--] Password not in list")

Crypt passwords with Salt

Last updated