-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassword-manager
More file actions
70 lines (60 loc) · 1.71 KB
/
password-manager
File metadata and controls
70 lines (60 loc) · 1.71 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
64
65
66
67
68
69
70
import random
import os
import platform
def clear_console():
os.system("cls")
passwords = {}
adding = False
master_password = "password"
def add():
global adding
adding = True
while adding:
password = input("enter a password to add [q for quit]: ")
if password.lower() == 'q':
adding = False
else:
name = input("enter a name for this password: ")
passwords[name] = password
print(f"password for '{name}' added successfully!")
def view():
if passwords:
print("\nyour saved passwords:")
for name, password in passwords.items():
print(f"{name}: {password}")
else:
print("\nno passwords saved yet")
def delete():
if passwords:
name = input("enter the name of the password to delete: ")
if name in passwords:
del passwords[name]
print(f"password for '{name}' deleted successfully!")
else:
print(f"no password found with the name '{name}'")
else:
print("\nno passwords to delete")
master = input("whats the master password?: ")
if master == master_password:
pass
else:
print("wrong!")
quit()
while True:
print("Password Manager:")
print("\nAdd a password (1)")
print("View saved passwords (2)")
print("Delete a password (3)")
print("quit (q)")
choice = input("\nWhat do you want to do? [q to quit]: ")
if choice == "1":
add()
elif choice == "2":
view()
elif choice == "3":
delete()
elif choice.lower() == 'q':
clear_console()
break
else:
print("invalid choice! please try again!")