import random
from tkinter import * from functools import partial

dictionary={'cat', 'dog', 'add', 'age', 'bed', 'egg', 'sad', 'god', 'hut', 'man',
'tree', 'race', 'rice', 'keep', 'lace', 'beam', 'game', 'mars', 'tide', 'ride',
'brain', 'carry', 'claim', 'cream', 'bread', 'cause', 'clean', 'cross', 'globe', 'human',
'combat','become', 'demand', 'animal', 'coming', 'costly', 'bestie', 'detail', 'appear','castle'
}

def validateLogin(password):
global count
count += 1
passed="bestie"
passwd= password.get()
if count > 3:
print("Attempts Over")
tkWindow.destroy()
return
if passwd in dictionary:
if passwd == passed:
print("Cracked!")
return
else:
print("Incorect Password")
return
else:
print("Password is not part of a dictionary")

global count
count = 0
tkWindow=Tk()
tkWindow.geometry("300x200")
tkWindow.title('Dictionary Attack')

userLabel=Label(tkWindow, text="User Name").place(x = 50, y = 20)
username= StringVar()
usernameEntry=Entry(tkWindow, textvariable=username).place(x = 150, y = 20, width = 100)

passwordLabel=Label(tkWindow, text="Password").place(x = 50, y = 50)
password= StringVar()
passEntry=Entry(tkWindow, textvariable=password, show="*").place(x = 150, y = 50, width = 100)

validateLogin = partial(validateLogin, password)
loginButton = Button(tkWindow, text="Login", command=validateLogin).place(x = 150, y = 135, width = 55)
tkWindow.mainloop()

Edit
Pub: 19 Mar 2023 17:57 UTC
Views: 13