def get_password_from_dbus(self): try: import dbus except ImportError: self.debug('Dbus not installed: sudo apt-get install python-dbus') return [] pwd_found = [] for _, session in homes.sessions(): try: bus = dbus.bus.BusConnection(session) purple = bus.get_object( "im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject", "im.pidgin.purple.PurpleInterface" ) acc = purple.PurpleAccountsGetAllActive() for x in range(len(acc)): _acc = purple.PurpleAccountsGetAllActive()[x] pwd_found.append({ 'Login': purple.PurpleAccountGetUsername(_acc), 'Password': purple.PurpleAccountGetPassword(_acc), 'Protocol': purple.PurpleAccountGetProtocolName(_acc), }) bus.flush() bus.close() except Exception as e: self.debug(e) return pwd_found
def get_password_from_dbus(self): try: import dbus except ImportError: self.debug('Dbus not installed: sudo apt-get install python-dbus') return [] pwd_found = [] for _, session in homes.sessions(): try: bus = dbus.bus.BusConnection(session) purple = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject", "im.pidgin.purple.PurpleInterface") acc = purple.PurpleAccountsGetAllActive() for x in range(len(acc)): _acc = purple.PurpleAccountsGetAllActive()[x] pwd_found.append({ 'Login': purple.PurpleAccountGetUsername(_acc), 'Password': purple.PurpleAccountGetPassword(_acc), 'Protocol': purple.PurpleAccountGetProtocolName(_acc), }) bus.flush() bus.close() except Exception as e: self.debug(e) return pwd_found
def run(self, software_name=None): items = [] visited = set() try: import dbus import secretstorage import datetime except Exception as e: print_debug('ERROR', 'libsecret: {0}'.format(e)) return [] for _, session in homes.sessions(): try: bus = dbus.bus.BusConnection(session) if not 'org.freedesktop.secrets' in [ str(x) for x in bus.list_names() ]: continue collections = list(secretstorage.collection.get_all_collections(bus)) except Exception as e: print_debug('ERROR', e) continue for collection in collections: if collection.is_locked(): continue label = collection.get_label() if label in visited: continue visited.add(label) try: storage = collection.get_all_items() except Exception as e: print_debug('ERROR', e) continue for item in storage: values = { 'created' : str(datetime.datetime.fromtimestamp(item.get_created())), 'modified' : str(datetime.datetime.fromtimestamp(item.get_modified())), 'content-type' : item.get_secret_content_type(), 'label' : item.get_label(), 'Password' : item.get_secret(), 'collection' : label, } # for k, v in item.get_attributes().iteritems(): # values[unicode(k)] = unicode(v) items.append(values) bus.flush() bus.close() return items
def run(self, software_name = None): items = [] visited = set() try: import dbus import secretstorage import datetime except Exception as e: print_debug('ERROR', 'libsecret: {0}'.format(e)) return [] for _, session in homes.sessions(): try: bus = dbus.bus.BusConnection(session) if not 'org.freedesktop.secrets' in [ str(x) for x in bus.list_names() ]: continue collections = list(secretstorage.collection.get_all_collections(bus)) except Exception, e: print e continue for collection in collections: if collection.is_locked(): continue label = collection.get_label() if label in visited: continue visited.add(label) try: storage = collection.get_all_items() except Exception, e: print e continue for item in storage: values = { 'created': str(datetime.datetime.fromtimestamp(item.get_created())), 'modified': str(datetime.datetime.fromtimestamp(item.get_modified())), 'content-type': item.get_secret_content_type(), 'label': item.get_label(), 'Password': item.get_secret(), 'collection': label, } for k, v in item.get_attributes().iteritems(): values[unicode(k)] = unicode(v) items.append(values)
def run(self): try: import dbus except Exception as e: self.error('kwallet: {error}'.format(error=e)) return [] pwd_found = [] for _, session in homes.sessions(): try: bus = dbus.bus.BusConnection(session) if 'org.kde.kwalletd' not in [ str(x) for x in bus.list_names() ]: continue for info in self.bus_info: kwallet_object = bus.get_object(info[0], info[1]) wallet = dbus.Interface(kwallet_object, 'org.kde.KWallet') handle = wallet.open(wallet.networkWallet(), 0, self.appid) if handle: for folder in wallet.folderList(handle, self.appid): for entry in wallet.entryList( handle, folder, self.appid): password_list = wallet.readPasswordList( handle, folder, entry, self.appid) for plist in password_list.items(): pwd_found.append({ 'Folder': str(folder), 'Login': str(plist[0]), 'Password': str(plist[1]), }) except Exception as e: self.error(e) continue bus.flush() bus.close() return pwd_found
def run(self): try: import dbus except Exception as e: self.error('kwallet: {error}'.format(error=e)) return [] pwd_found = [] for _, session in homes.sessions(): try: bus = dbus.bus.BusConnection(session) if 'org.kde.kwalletd' not in [str(x) for x in bus.list_names()]: continue for info in self.bus_info: kwallet_object = bus.get_object(info[0], info[1]) wallet = dbus.Interface(kwallet_object, 'org.kde.KWallet') handle = wallet.open(wallet.networkWallet(), 0, self.appid) if handle: for folder in wallet.folderList(handle, self.appid): for entry in wallet.entryList(handle, folder, self.appid): password_list = wallet.readPasswordList(handle, folder, entry, self.appid) for plist in password_list.items(): pwd_found.append({ 'Folder': str(folder), 'Login': str(plist[0]), 'Password': str(plist[1]), }) except Exception as e: self.error(e) continue bus.flush() bus.close() return pwd_found
def run(self): items = [] visited = set() try: import dbus import secretstorage import datetime except ImportError as e: self.error('libsecret: {0}'.format(e)) return [] for uid, session in homes.sessions(): try: # List bus connection names bus = dbus.bus.BusConnection(session) if 'org.freedesktop.secrets' not in [ str(x) for x in bus.list_names() ]: continue except Exception: self.error(traceback.format_exc()) continue collections = None try: # Python 2.7 collections = list( secretstorage.collection.get_all_collections(bus)) except Exception: pass if not collections: try: # Python 3 from jeepney.integrate.blocking import connect_and_authenticate make_auth_external.uid = uid bus = connect_and_authenticate(session) collections = secretstorage.get_all_collections(bus) except Exception: self.error(traceback.format_exc()) continue for collection in collections: if collection.is_locked(): continue label = collection.get_label() if label in visited: continue visited.add(label) try: storage = collection.get_all_items() except Exception: self.error(traceback.format_exc()) continue for item in storage: values = { 'created': str(datetime.datetime.fromtimestamp( item.get_created())), 'modified': str( datetime.datetime.fromtimestamp( item.get_modified())), 'content-type': item.get_secret_content_type(), 'label': item.get_label(), 'Password': item.get_secret().decode('utf8'), 'collection': label, } # for k, v in item.get_attributes().iteritems(): # values[unicode(k)] = unicode(v) items.append(values) try: bus.flush() bus.close() except Exception: pass return items
def run(self): items = [] visited = set() try: import dbus import secretstorage import datetime except ImportError as e: self.error('libsecret: {0}'.format(e)) return [] for uid, session in homes.sessions(): try: # List bus connection names bus = dbus.bus.BusConnection(session) if 'org.freedesktop.secrets' not in [str(x) for x in bus.list_names()]: continue except Exception: self.error(traceback.format_exc()) continue collections = None try: # Python 2.7 collections = list(secretstorage.collection.get_all_collections(bus)) except Exception: pass if not collections: try: # Python 3 from jeepney.integrate.blocking import connect_and_authenticate make_auth_external.uid = uid bus = connect_and_authenticate(session) collections = secretstorage.get_all_collections(bus) except Exception: self.error(traceback.format_exc()) continue for collection in collections: if collection.is_locked(): continue label = collection.get_label() if label in visited: continue visited.add(label) try: storage = collection.get_all_items() except Exception: self.error(traceback.format_exc()) continue for item in storage: values = { 'created': str(datetime.datetime.fromtimestamp(item.get_created())), 'modified': str(datetime.datetime.fromtimestamp(item.get_modified())), 'content-type': item.get_secret_content_type(), 'label': item.get_label(), 'Password': item.get_secret().decode('utf8'), 'collection': label, } # for k, v in item.get_attributes().iteritems(): # values[unicode(k)] = unicode(v) items.append(values) try: bus.flush() bus.close() except Exception: pass return items