



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A Python script for password cracking using Secure Hash Algorithm 1 (SHA-1) and Message Digest Algorithm 5 (MD5). The script takes user input for a password, generates the corresponding hash using each algorithm, and compares the generated hash with a list of common passwords to find a match.
What you will learn
Typology: Cheat Sheet
1 / 6
This page cannot be seen from the preview
Don't miss anything!
PASSWORD CRACKING
import hashlib
password = input('Input Password which is to be converted to Hash: ')
print('\n Secure Hash Algorithm 1:\n') pass1 = bytes(password, 'utf-8')
hash_obj = hashlib.sha1(pass1)
pass2 = hash_obj.hexdigest()
print(pass2)
print('\n Message Digest Algorithm 5:\n') pass1 = bytes(password, 'utf-8')
hash_obj = hashlib.md5(pass1)
pw_guess = hash_obj.hexdigest()
print(pw_guess)
Database https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10- million-password-list-top-10000.txt
import tkinter as tk from tkinter import *
import urllib.request
import hashlib
import os, ssl
root = tk.Tk()
root.title('Password Cracker')
if (not os.environ.get('PYTHONHTTPSVERIFY', '') and getattr(ssl, '_create_unverified_context', None)): ssl._create_default_https_context = ssl._create_unverified_context
str(urllib.request.urlopen('https://raw.githubusercontent.com/danielmiessler/SecLists/master/Pass words/Common-Credentials/10-million-password-list-top-10000.txt').read(), 'utf-8')
return
check=
if(check==1):
label4 = tk.Label(frame, bg=DARKGRAY, text='That Password is not in this database', fg='Yellow')
label4.pack(side='bottom')
canvas = tk.Canvas(root, height=HEIGHT, width=WIDTH, bg=GRAY)
canvas.pack()
frame = tk.Frame(root, bg=DARKGRAY) frame.place(relx=0.1, rely=0.1, relwidth=0.8, relheight=0.8)
label = tk.Label(frame, bg=DARKGRAY, text='--- Import a Hashed Password ---', fg='#E5E5E5')
label.pack(side='top')
option = ['SHA-1','MD5']
clicked = StringVar()
clicked.set(option[0])
drop = OptionMenu(frame, clicked, *option)
drop.pack(side='top')
label4 = tk.Label(frame, bg=GRAY)
label4.pack(side='top')
hash_entry = tk.Entry(frame, bg='white',)
hash_entry.bind('
hash_entry.pack(side='top')
label2 = tk.Label(frame, bg=GRAY)
label2.pack(side='top')
button = tk.Button(frame, text='Crack Password')
button.bind('<Button-1>', crackpass)
button.pack(side='top')
labelb = tk.Label(frame, bg=DARKGRAY)
labelb.pack(pady=10, side='bottom')
root.mainloop()