-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
51 lines (49 loc) · 2.25 KB
/
main.py
File metadata and controls
51 lines (49 loc) · 2.25 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
from utils import sql_operations,crypto
if __name__ == "__main__":
cycle_condition = True
sql_operations.initialization()
print("\nIf you are already in possess of a cipher keys (Fernet key) just insert the value in between b'...'")
cipher = crypto.Cipher(input("Insert email_key: "),input("insert psw_key: "))
while cycle_condition:
print("\n--------------------------------------------------------------------------")
print("\nHere is the list of doable operations:\
\n0. Exit\
\n1. Upload URL/email/password to the Password Manager\
\n2. Uplaod a .csv file (must be of the form name,email,psw) into the database\
\n3. Generate random password\
\n4. Email + Password retrieval from URL\
\n5. Database retrieval\
\n6. Get URLs and related passwords from email\
\n7. Update password given a URL and email\
\n8. Delete (URL,email,password) given URL + email")
option = input("\nChoose an option: ")
match int(option):
#Exit
case 0: cycle_condition = False
#Upload entry
case 1:
sql_operations.upload(cipher,str(input("\nURL: ")),str(input("Email: ")),str(input("Password: ")))
#Upload .csv file
case 2:
yn = input("Is the .csv file you want to upload ciphered ? [y/n]: ").lower()
if yn in [""," ","y","yes"]: sql_operations.upload_ciphered_csv(cipher)
else: sql_operations.upload_unciphered_csv(cipher)
#psw generation
case 3:
password = cipher.random_psw()
print(password)
#email+psw retrieval from site
case 4:
sql_operations.get_email_psw_from_url(cipher,str(input("\nURL: ")))
#database retrieval
case 5:
sql_operations.db_retrieval(cipher,str(input("Do you want to save the database as a .csv [y/n]: ")))
#Get sites and related passwords from email
case 6:
sql_operations.get_site_psw_from_email(cipher,str(input("Email: ")))
#update password given URL + email
case 7:
sql_operations.update_psw(cipher,str(input("\nURL: ")),str(input("Email: ")),str(input("New password: ")))
#Delete a row in the database from URL + email
case 8:
sql_operations.delete(cipher,str(input("\nURL: ")),str(input("Email: ")))