Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Password Cracking Script with SHA-1 and MD5 Hashes, Cheat Sheet of Operating Systems

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

  • How does the script check if a guessed password matches the given hash?
  • How does the script generate SHA-1 and MD5 hashes for a given password?
  • What is the purpose of the 'Common-Credentials/10-million-password-list-top-10000.txt' file in the script?

Typology: Cheat Sheet

2020/2021

Uploaded on 10/31/2021

k-kumar
k-kumar 🇮🇳

2 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Name: - Atul Koirala Reg. No.: -19BCE2666
LAB ACTIVITY -3
PASSWORD CRACKING
CODE: -
For Hash.py
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)
pf3
pf4
pf5

Partial preview of the text

Download Password Cracking Script with SHA-1 and MD5 Hashes and more Cheat Sheet Operating Systems in PDF only on Docsity!

Name: - Atul Koirala Reg. No.: -19BCE

LAB ACTIVITY -

PASSWORD CRACKING

CODE: -

For Hash.py

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)

For Cracker.py

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

HEIGHT = 500

WIDTH = 500

GRAY = '#294585'

DARKGRAY = '#855529'

COMMON_PASS =

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('', crackpass)

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()

  • For Secure Hash Algorithm
  • For Message Digest Algorithm