Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save technomancy/0cb4ba11bc4dc60b8b300fcbff8614b7 to your computer and use it in GitHub Desktop.

Select an option

Save technomancy/0cb4ba11bc4dc60b8b300fcbff8614b7 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import re, os
def get_authinfo_password(machine, login):
s = "machine %s login %s password ([^ ]*)\n" % (machine, login)
p = re.compile(s)
authinfo = os.popen("gpg -q --no-tty -d ~/.authinfo.gpg").read()
return p.search(authinfo).group(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment