-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·32 lines (28 loc) · 981 Bytes
/
configure
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
#!/usr/bin/env python
import secretstorage
# init bus
bus = secretstorage.dbus_init()
collection = secretstorage.get_default_collection(bus)
attributes = {'application': 'gnoti'}
# make sure we can access secret storage
if collection.is_locked():
print("Keyring is locked.")
sys.exit(1)
try:
# Get username and pass from input
username = raw_input("E-mail: ").strip()
password = getpass.getpass("Password: ")
proceed = raw_input("This will replace all entries associated with this application. Proceed [y/N]: ")
if proceed.strip().lower() == "y":
# clean all data associated with this application
for secret in collection.search_items(attributes):
secret.delete()
# put in keyring
collection.create_item('password', attributes, password)
collection.create_item('email', attributes, username)
except KeyboardInterrupt:
pass
except:
print("Some error occurred.")
sys.exit(1)
sys.exit(0)