Created
December 8, 2019 22:51
-
-
Save anmolj7/4cd2232066266e7e1a75bd09074fbc52 to your computer and use it in GitHub Desktop.
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 subprocess as sp | |
from hashlib import md5, sha1, sha384, sha224, sha512, sha256 | |
import os | |
HASHES = ['sha256', 'sha384', 'sha224', 'sha512', 'sha1', 'md5'] | |
def breakline(): | |
print('-'*80) | |
def clrscr(): | |
sp.call(['clear'], shell=True) | |
def give_choice(option: str): | |
breakline() | |
for i in range(1, len(HASHES)+1): | |
print(f'{i}) To {option} {HASHES[i-1]}') | |
breakline() | |
return input("Your Choice: ") | |
def main(): | |
breakline() | |
print("1) For Hashing.") | |
print("2) For Cracking/Bursting Hashes.") | |
print("0) To Exit.") | |
breakline() | |
choice = int(input("Your Choice: ")) | |
breakline() | |
if choice == 1: | |
choice = give_choice("Hash") | |
try: | |
choice = int(choice) | |
hash = HASHES[choice-1] | |
text = input("Enter the text to be hashed: ") | |
print(globals()[hash](text.encode('utf8')).hexdigest()) | |
except Exception as e: | |
print("Invalid Choice.") | |
elif choice == 2: | |
try: | |
choice = give_choice("Crack/Burst") | |
try: | |
choice = int(choice) | |
hash = HASHES[choice-1] | |
breakline() | |
print("1) Burst") | |
print("2) Crack") | |
print("BURST RECOMMENDED. FASTER.") | |
breakline() | |
choice = int(input("Your choice: ")) | |
if choice == 1: | |
hash_to_be_cracked = input("Enter the hash to be cracked: ") | |
try: | |
text = sp.check_call([f'buster -s {hash_to_be_cracked}'], shell=True) | |
#text = sp.call([f'buster -s {hash_to_be_cracked}'], shell=True) | |
except: | |
print("Downloading the hash buster.") | |
sp.call(['git clone https://github.com/s0md3v/Hash-Buster.git'], shell=True) | |
os.chdir("Hash-Buster") | |
sp.call(['make install'], shell=True) | |
text = sp.call([f'buster -s {hash_to_be_cracked}'], shell=True) | |
elif choice == 2: | |
file_name = input("Enter the wordlist (with extension): ") | |
hash_to_be_cracked = input("Enter the hash to be cracked: ") | |
with open(file_name) as f: | |
data = f.readlines() | |
cracked = False | |
for pp in data: | |
pp = pp.strip('\n') | |
curr_hash = str(globals()[hash](pp.encode('utf8')).hexdigest()) | |
if curr_hash == hash_to_be_cracked: | |
cracked = True | |
print("Cracked! The text is:", pp) | |
break | |
if not cracked: | |
print("Couldn't crack it using the given wordlist.") | |
except Exception as e: | |
print(str(e)) | |
print("Invalid Choice.") | |
except: | |
print("Invalid Choice.") | |
elif choice == 0: | |
exit() | |
else: | |
print("Invalid Choice.") | |
main() | |
if __name__ == "__main__": | |
clrscr() | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment