dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit eb51bd1ea18c732ac56004d87fc44d804cf9fd2d
parent 36987b4efe49a4fc4b98a8174b6781a14ae95a3b
Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date:   Wed, 24 Feb 2016 15:09:50 -0800

add script to extract info from osx keychain

Diffstat:
M.mutt/offlineimap.py | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.mutt/offlineimap.py b/.mutt/offlineimap.py @@ -3,15 +3,17 @@ import re import subprocess +user='adamsgaard' + def get_keychain_pass(account=None, server=None): params = { 'security': '/usr/bin/security', 'command': 'find-internet-password', 'account': account, 'server': server, - 'keychain': '/Users/adamsgaard/Library/Keychains/login.keychain', + 'keychain': '/Users/' + user + '/Library/Keychains/login.keychain', } - command = "sudo -u sjl %(security)s -v %(command)s -g -a %(account)s -s %(server)s %(keychain)s" % params + command = "sudo -u " + user + " %(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]