mirror of
https://github.com/captn3m0/Scripts.git
synced 2024-09-27 22:22:53 +00:00
27 lines
867 B
Python
27 lines
867 B
Python
|
#! /usr/bin/env python
|
||
|
|
||
|
# this is inspired by https://bitbucket.org/kang/python-keyring-lib/issue/151/how-is-it-possible-to-list-keyrings-keys
|
||
|
|
||
|
import secretstorage
|
||
|
|
||
|
def hackng():
|
||
|
bus = secretstorage.dbus_init()
|
||
|
for keyring in secretstorage.get_all_collections(bus):
|
||
|
for item in keyring.get_all_items():
|
||
|
attr = item.get_attributes()
|
||
|
if attr and 'username_value' in attr:
|
||
|
print('[%s] %s: %s = %s' % (
|
||
|
keyring.get_label(),
|
||
|
item.get_label(),
|
||
|
attr['username_value'],
|
||
|
item.get_secret()
|
||
|
))
|
||
|
else:
|
||
|
print('[%s] %s = %s' % (
|
||
|
keyring.get_label(),
|
||
|
item.get_label(),
|
||
|
item.get_secret()
|
||
|
))
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
hackng()
|