Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def hash_password(password, hash_type):
- if hash_type == '1':
- return hashlib.md5(password.encode()).hexdigest()
- elif hash_type == '2':
- return hashlib.sha1(password.encode()).hexdigest()
- elif hash_type == '3':
- # We need to change this part to bcrypt
- hashed = bcrypt.hashpw(password.encode(), bcrypt.gensalt())
- return hashed.decode()
- elif hash_type == '4':
- # Use binascii.crc32 directly without conversion
- return hex(binascii.crc32(password.encode()) & 0xFFFFFFFF)[2:] # Removing '0x' prefix and ensure it's 32 bits
- else:
- raise ValueError("Invalid hash type")
- def animate_password_crack(hash_input, password_list, hash_type):
- n = len(hash_input)
- box = [[' ' for _ in range(n)] for _ in range(3)]
- for i, char in enumerate(hash_input):
- box[0][i] = char
- for password in password_list:
- hashed_password = hash_password(password, hash_type)
- box[1] = list(hashed_password)
- box[2] = [random.choice(['✘', '✔']) for _ in range(len(hashed_password))]
- sys.stdout.write('\r')
- sys.stdout.write('┌' + '-' * (n * 2 - 1) + '┐\n')
- sys.stdout.write('|' + '|'.join(box[0]) + '|\n')
- sys.stdout.write('├' + '-' * (n * 2 - 1) + '┤\n')
- sys.stdout.write('|' + '|'.join(box[1]) + '|\n')
- sys.stdout.write('├' + '-' * (n * 2 - 1) + '┤\n')
- sys.stdout.write('|' + '|'.join(box[2]) + '|\n')
- sys.stdout.write('└' + '-' * (n * 2 - 1) + '┘\n')
- sys.stdout.write('\033[F' * 7)
- sys.stdout.flush()
- if hashed_password == hash_input:
- box[1] = list(password)
- box[2] = ['✔' for _ in range(len(hashed_password))]
- sys.stdout.write('\r')
- sys.stdout.write('┌' + '-' * (n * 2 - 1) + '┐\n')
- sys.stdout.write('|' + '|'.join(box[0]) + '|\n')
- sys.stdout.write('├' + '-' * (n * 2 - 1) + '┤\n')
- sys.stdout.write('|' + '|'.join(box[1]) + '|\n')
- sys.stdout.write('├' + '-' * (n * 2 - 1) + '┤\n')
- sys.stdout.write('|' + '|'.join(box[2]) + '|\n')
- sys.stdout.write('└' + '-' * (n * 2 - 1) + '┘\n')
- print("Matched Password:", password)
- with open('Results.txt', 'w') as results_file:
- results_file.write(f"{hash_input}:{password}\n")
- return password
- print("No matching password found!")
- return None
- hash_type = input("""
- ██████╗ ██╗ █████╗ ██████╗██╗ ██╗██╗ ██╗ █████╗ ████████╗ ██████╗ ██████╗ ██████╗ ██╗
- ██╔══██╗██║ ██╔══██╗██╔════╝██║ ██╔╝██║ ██║██╔══██╗╚══██╔══╝ ██╔════╝ ██╔═══██╗██╔══██╗ ██╗╚██╗
- ██████╔╝██║ ███████║██║ █████╔╝ ███████║███████║ ██║ ██║ ███╗██║ ██║██║ ██║ ╚═╝ ██║
- ██╔══██╗██║ ██╔══██║██║ ██╔═██╗ ██╔══██║██╔══██║ ██║ ██║ ██║██║ ██║██║ ██║ ██╗ ██║
- ██████╔╝███████╗██║ ██║╚██████╗██║ ██╗██║ ██║██║ ██║ ██║ ╚██████╔╝╚██████╔╝██████╔╝ ╚═╝██╔╝
- ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝
- ┌-----------------┐
- |Select your Mode |
- └┘└┘└┘└┘└┘└┘└┘└┘└┘┘
- ┌┐ ┌┐ ┌┐ ┌┐ ┌┐ ┌┐
- | 1. MD5 |
- | 2. SHA-1 |
- | 3. BCRYPT |
- | 4. CRC32 |
- └-----------------┘
- Enter the hash type : """)
- hash_input = input("Enter your hash: ")
- filename = input("Enter the filename containing passwords: ")
- with open(filename, 'r', encoding='utf-8', errors='ignore') as file:
- password_list = [line.strip() for line in file]
- print("Cracking...")
- matched_password = animate_password_crack(hash_input, password_list, hash_type)
- if matched_password:
- print("Matched Password:", matched_password)
- import os;os.system("pause")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement