diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2022-10-05 16:33:10 +0100 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2022-10-05 16:33:10 +0100 |
commit | 9fff448654308b1e1b3d1129c0255544f56c25cc (patch) | |
tree | eda78717611d7a6b2204ba8e9f73af90e69ae90b /mutt/offlineimap.py-bak |
initial
Diffstat (limited to 'mutt/offlineimap.py-bak')
-rw-r--r-- | mutt/offlineimap.py-bak | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mutt/offlineimap.py-bak b/mutt/offlineimap.py-bak new file mode 100644 index 0000000..41fe18b --- /dev/null +++ b/mutt/offlineimap.py-bak @@ -0,0 +1,17 @@ +#/usr/bin/python + +import re, subprocess +def get_keychain_pass(account=None, server=None): + params = { + 'security': '/usr/bin/security', + 'command': 'find-internet-password', + 'account': account, + 'server': server, + 'keychain': '/Users/lemon/Library/Keychains/login.keychain', + } + command = "sudo -u lemon %(security)s -v %(command)s -g -a %(account)s -s %(server)s %(keychain)s" % params + output = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT) + outtext = [l for l in output.splitlines() + if l.startswith('password: ')][0] + + return re.match(r'password: "(.*)"', outtext).group(1) |