Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (24 sloc) 703 Bytes
import sys
import getpass
from Tkinter import *
import tkSimpleDialog
def get_password(verify=None):
if sys.stdin.isatty():
for i in xrange(3):
pw = getpass.getpass()
if not verify: break
if verify(pw): break
pw = get_tk_password(verify)
return pw
def get_tk_password(verify):
root = Tk()
while True:
pw = tkSimpleDialog.askstring(title='Selfspy encryption password', prompt='Password', show='*', parent=root)
if pw is None: return ""
if not verify: break
if verify(pw): break
return pw
if __name__ == '__main__':
print get_password()
Jump to Line
Something went wrong with that request. Please try again.