Created
January 4, 2012 08:22
Revisions
-
kotas created this gist
Jan 4, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ #!/usr/bin/python # -*- encoding: utf-8 -*- """ Password Generator for Mac OSX Compatible with http://www.hashapass.com/ """ import sys import os import hmac import hashlib import base64 os.system("stty -echo >/dev/null 2>&1") try: sys.stdout.write("Type master: ") master = sys.stdin.readline().rstrip() sys.stdout.write("\r" + " " * 80 + "\r") sys.stdout.write("Type parameter: ") parameter = sys.stdin.readline().rstrip() sys.stdout.write("\r" + " " * 80 + "\r") gen = hmac.new(master, parameter, hashlib.sha1) password = base64.b64encode(gen.digest()) password = password[0:8] clipboard = os.popen("pbcopy", "w") clipboard.write(password) clipboard.close() sys.stdout.write("Password is set to clipboard.\n") finally: os.system("stty echo >/dev/null 2>&1")