summaryrefslogtreecommitdiffstats
path: root/mutt2022/offlineimap.py-bak
diff options
context:
space:
mode:
Diffstat (limited to 'mutt2022/offlineimap.py-bak')
-rw-r--r--mutt2022/offlineimap.py-bak17
1 files changed, 17 insertions, 0 deletions
diff --git a/mutt2022/offlineimap.py-bak b/mutt2022/offlineimap.py-bak
new file mode 100644
index 0000000..41fe18b
--- /dev/null
+++ b/mutt2022/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)