forked from AlessandroZ/LaZagne
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request AlessandroZ#73 from alxchk/master
Add generic freedesktop protocol
- Loading branch information
Showing
2 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os, sys | ||
|
||
from lazagne.config.write_output import print_debug | ||
from lazagne.config.moduleInfo import ModuleInfo | ||
|
||
class libsecret(ModuleInfo): | ||
def __init__(self): | ||
options = {'command': '-k', 'action': 'store_true', 'dest': 'kwallet', 'help': 'KWallet'} | ||
ModuleInfo.__init__(self, 'libsecret', 'wallet', options) | ||
|
||
def run(self, software_name = None): | ||
items = [] | ||
try: | ||
import secretstorage | ||
import dbus | ||
import datetime | ||
for item in secretstorage.Collection(dbus.SessionBus()).get_all_items(): | ||
values = { | ||
'created': datetime.datetime.fromtimestamp(item.get_created()), | ||
'modified': datetime.datetime.fromtimestamp(item.get_modified()), | ||
'content-type': item.get_secret_content_type(), | ||
'label': item.get_label(), | ||
'Password': item.get_secret(), | ||
} | ||
for k, v in item.get_attributes().iteritems(): | ||
values[str(k)] = str(v) | ||
items.append(values) | ||
return items | ||
except Exception as e: | ||
print_debug('ERROR', 'libsecret: {0}'.format(e)) |