Repository navigation
Expand file tree
/
Copy pathlib.py
More file actions
59 lines (47 loc) · 1.52 KB
/
Copy pathlib.py
File metadata and controls
59 lines (47 loc) · 1.52 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
from hashlib import pbkdf2_hmac
import keyring, platform, sys, json, os
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.backends import default_backend
from os.path import expanduser
import base64
from typing import Tuple
CONF = str()
MASTER = str()
if "macos" or "linux" in platform.platform().lower():
CONF = expanduser("~")+"/.sb/"
else:
sys.stderr.write("No preset config path for windows yet! Please enter Config path to use: ")
sys.stderr.flush()
CONF = input()
def printheader():
print("-------------------------------------")
print(" MassPass ")
print("-------------------------------------")
def auth() -> Tuple[bool, str]:
global MASTER
import getpass
user_input = getpass.getpass()
MASTER = keyring.get_password('sbTokenService', 'sb')
if user_input == MASTER:
return (True, MASTER)
else: return (False, str())
# Interact w/ user event loop
def maineventloop():
while True:
cmd = input("Choose one of the following commands: [l]ist, [a]dd, [g]et, [r]emove, [c]onfig, e[x]it:\t").strip().lower()
if cmd == 'l':
list_pws(MASTER)
elif cmd == 'w':
write_pw()
elif cmd == 'x':
print("Goodbye!")
quit(0)
# list all passwords
def list_pws(master: str):
#TODO
pass
# write a password
def write_pw():
print('list password')