-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
43 lines (35 loc) · 914 Bytes
/
Copy pathmain.py
File metadata and controls
43 lines (35 loc) · 914 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os
import pickle
import getpass
from manager import Manager
mgr = None
try:
storage = open('contents.bin', 'rb')
mgr = pickle.load(storage)
storage.close()
except:
print("Looks like you don't have a profile set up. Let's do that now")
print('Enter a master password: ')
newpass = input()
if(newpass == 'forgot'):
print('Cannot use \'forgot\'')
quit()
print('Enter new hint')
newhint = input()
mgr = Manager()
mgr.setConfig(newpass, newhint)
storage = open('contents.bin', 'wb')
storage.write(pickle.dumps(mgr))
storage.close()
print('Restart to use')
quit()
master = getpass.getpass('Enter master password or type \'forgot\'\n')
if(master == 'forgot'):
print('Hint', mgr.getHint())
elif(mgr.authenticate(master)):
mgr.navigateDirectories(master)
storage = open('contents.bin', 'wb')
storage.write(pickle.dumps(mgr))
storage.close()
else:
print('Incorrect master password')