Skip to content

Instantly share code, notes, and snippets.

@david-fairbanks42
Created January 31, 2022 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save david-fairbanks42/4375ef0b9f299752ed7edc53744aabce to your computer and use it in GitHub Desktop.
Save david-fairbanks42/4375ef0b9f299752ed7edc53744aabce to your computer and use it in GitHub Desktop.
Clean up empty keyring entries
# Linux keyring file (login.keyring) contained a lot of dead entries with black passwords
# Update the application siganture (chrome-6391234) from an entry
# Additional/Alternative search items could be added
import keyring
keys = keyring.get_keyring()
for k in keys.backends:
if isinstance(k, keyring.backends.SecretService.Keyring):
collection = k.get_preferred_collection()
items = collection.search_items({"application": 'chrome-6391234'})
for i in items:
k.unlock(i)
# print('%s -- %s' % (i.get_attributes().get("origin_url"), i.get_secret().decode('utf-8')))
p = i.get_secret().decode('utf-8')
if p == '':
i.delete()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment