-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalyze.py
More file actions
63 lines (49 loc) · 1.66 KB
/
analyze.py
File metadata and controls
63 lines (49 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Author: Uphar Jaiswal
import tkinter as tk
from tkinter import messagebox
import re
def check_password_strength(password):
strength = 0
feedback = []
# Check for minimum length
if len(password) >= 8:
strength += 1
else:
feedback.append("Password should be at least 8 characters long.")
# Check for uppercase letters
if re.search(r'[A-Z]', password):
strength += 1
else:
feedback.append("Password should include at least one uppercase letter.")
# Check for numbers
if re.search(r'[0-9]', password):
strength += 1
else:
feedback.append("Password should include at least one number.")
# Check for special characters
if re.search(r'[!@#$%^&*(),.?":{}|<>]', password):
strength += 1
else:
feedback.append("Password should include at least one special character.")
return strength, feedback
def analyze_password():
password = entry.get()
strength, feedback = check_password_strength(password)
if strength == 4:
messagebox.showinfo("Password Strength", "Your password is strong!")
else:
messagebox.showwarning("Password Strength", "\n".join(feedback))
# Set up the GUI window
root = tk.Tk()
root.title("Password Analyzer")
root.geometry("450x350")
root.resizable(True, True)
# Create GUI components
label = tk.Label(root, text="Enter your password:")
label.pack(pady=15)
entry = tk.Entry(root, show="*", width=40)
entry.pack(pady=10)
button = tk.Button(root, text="Analyze Password", command=analyze_password)
button.pack(pady=10)
# Run the GUI loop
root.mainloop()