import random
from tkinter import *
from tkinter import messagebox
def random_dict():
dictionary = open("C:\Users\admin\Downloads\passwords.txt").readlines()
for i in range(len(dictionary)):
dictionary[i] = dictionary[i].replace("\n", "")
return dictionary
count = 0
def check():
global count
mera_pass = "123456"
if count > 3:
messagebox.showinfo("Error", "Attempt nahi bache tere paas")
root.destroy()
if e1.get() != None:
count += 1
passwd = e2.get()
if passwd in dictionary:
if mera_pass == passwd:
messagebox.showinfo("Successful", "You have been hacked")
else:
messagebox.showinfo("Error", "Nice! You seem to have a strong password")
else:
messagebox.showinfo("Error", "Password not present in dictionary")
def sortList():
passwd = e2.get()
for i in range(1, len(passwd)):
print("Password having initials: ", passwd[0:i])
for j in dictionary:
if i < len(j):
if j.startswith(passwd[0:i]):
print(j)
dictionary = random_dict()
root = Tk()
root.configure(bg="white")
root.geometry("750x550")
l1 = Label(root, text="Enter Username: ", font=('', 15))
l1.grid(row=0, column=0)
l2 = Label(root, text="Enter Password: ", font=('', 15))
l2.grid(row=1, column=0)
e1 = Entry(root, font=('', 15))
e1.grid(row=0, column=1)
e2 = Entry(root, font=('', 15))
e2.grid(row=1, column=1)
b1 = Button(root, text="verify", command = check, font=('', 15))
b1.grid(row=2, column=0)
b2 = Button(root, text="sort", command = sortList, font=('', 15))
b2.grid(row=2, column=1)
text = Text(root)
text.grid(row=3, columnspan=2)
root.mainloop()