Skip to content

Commit

Permalink
Merge pull request AlessandroZ#73 from alxchk/master
Browse files Browse the repository at this point in the history
Add generic freedesktop protocol
  • Loading branch information
AlessandroZ authored Oct 25, 2016
2 parents df89ed4 + fbb2479 commit 4a04a0a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Linux/lazagne/config/manageModules.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# keyring
from lazagne.softwares.wallet.gnome import Gnome
from lazagne.softwares.wallet.kde import kde
from lazagne.softwares.wallet.libsecret import libsecret
# browsers
from lazagne.softwares.browsers.mozilla import Mozilla
from lazagne.softwares.browsers.opera import Opera
Expand Down Expand Up @@ -32,7 +33,7 @@ def get_categories():
'wallet': {'help': 'Windows credentials (credential manager, etc.)'}
}
return category

def get_modules():
moduleNames = [
ClawsMail(),
Expand All @@ -49,6 +50,7 @@ def get_modules():
Squirrel(),
Wifi(),
Wpa_supplicant(),
kde()
kde(),
libsecret()
]
return moduleNames
30 changes: 30 additions & 0 deletions Linux/lazagne/softwares/wallet/libsecret.py
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))

0 comments on commit 4a04a0a

Please sign in to comment.