public
Created

  • Download Gist
offlineimap.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13
#!/usr/bin/python2
import os, getpass
from keepass import kpdb
 
def get_keepass_pw(dbpath, title="", username=""):
if os.path.isfile(dbpath):
db = kpdb.Database(dbpath, getpass.getpass("Master password for '" + dbpath + "': "))
for entry in db.entries:
if (entry.title == title) and (entry.username == username):
return entry.password
else:
print "Error: '" + dbpath + "' does not exist."
return

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.