Skip to content

Commit 346b000

Browse files
authored
Merge pull request #1 from DarkAssassin007/main
Psc
2 parents 44f10cd + 526d7dd commit 346b000

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# 🔐 Password Strength Checker
2+
3+
A simple command-line Python tool to evaluate the strength of a given password.
4+
It checks for key security features like length, character variety, and special symbols, and provides visual feedback using color-coded strength indicators.
5+
6+
---
7+
8+
## 📌 Features
9+
10+
- Checks for:
11+
- Minimum length (8 characters)
12+
- Uppercase letters
13+
- Lowercase letters
14+
- Numbers
15+
- Special characters
16+
- Returns one of the following:
17+
- 🔴 Weak
18+
- 🟠 Medium
19+
- 🟢 Strong
20+
- Terminal color-coded output using `colorama`
21+
22+
---
23+
24+
## 💻 How It Works
25+
26+
The tool evaluates the password based on 5 key rules. For each rule satisfied, 1 point is awarded:
27+
- Score 0-2 → Weak
28+
- Score 3-4 → Medium
29+
- Score 5 → Strong
30+
31+
Example:
32+
```bash
33+
Enter your password: Rahul123
34+
Password Strength: 🟠 Medium
35+
```
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import re
2+
from colorama import Fore, Style, init
3+
4+
init(autoreset=True) # Automatically reset to default after each print
5+
6+
def check_password_strength(password):
7+
score = 0
8+
if len(password) >= 8:
9+
score += 1
10+
if re.search(r"[A-Z]", password):
11+
score += 1
12+
if re.search(r"[a-z]", password):
13+
score += 1
14+
if re.search(r"\d", password):
15+
score += 1
16+
if re.search(r"[!@#$%^&*(),.?\":{}|<>]", password):
17+
score += 1
18+
19+
if score <= 2:
20+
return "Weak", Fore.RED + "🔴 Weak"
21+
elif score == 3 or score == 4:
22+
return "Medium", Fore.YELLOW + "🟠 Medium"
23+
else:
24+
return "Strong", Fore.GREEN + "🟢 Strong"
25+
26+
def main():
27+
print(Fore.CYAN + "🔐 Password Strength Checker\n")
28+
pwd = input("Enter your password: ")
29+
level, colored_output = check_password_strength(pwd)
30+
print(f"\nPassword Strength: {colored_output}")
31+
32+
if __name__ == "__main__":
33+
main()

0 commit comments

Comments
 (0)