-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
24 lines (21 loc) · 868 Bytes
/
main.py
File metadata and controls
24 lines (21 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import argparse
from password_guard.checker import check_password
from password_guard.generator import generate_password
def main():
parser = argparse.ArgumentParser(description="Password Guard CLI")
parser.add_argument("--check", type=str, help="Check password strength")
parser.add_argument("--generate", action="store_true", help="Generate password")
parser.add_argument("--length", type=int, default=16, help="Generated password length")
args = parser.parse_args()
if args.check:
result = check_password(args.check)
print("Password Analysis:")
for key, value in result.items():
print(f"{key}: {value}")
elif args.generate:
password = generate_password(args.length)
print(f"Generated password: {password}")
else:
parser.print_help()
if __name__ == "__main__":
main()