def get_encryption_password(): password = keychain.get_password('EncryptedPDFs', 'password') if password: return password.encode('ascii') password = console.secure_input( 'Enter password to encrypt PDFs: ').rstrip() keychain.set_password('EncryptedPDFs', 'password', password) return password
def getGithubPassword(username): service = 'github' password = keychain.get_password(service, username) if password == None: print("Enter password for user", username) password = console.secure_input() keychain.set_password(service, username, password) return password
def getGithubPassword(username): service = 'github' password = keychain.get_password(service, username) if password == None: print "Enter password for user", username password = console.secure_input() keychain.set_password(service, username, password) return password
def getpass(prompt='Password: '******'Password: ' Returns: The seKr3t input. """ password = console.secure_input(prompt) return password
import console, keychain device = raw_input('Enter device hostname or IP: ') username = raw_input('Enter username: '******'Enter password: '******'Account saved to keychain.'
''' #Constants print 'Configuring parameters...' strComputer = 'YOUR COMPUTER IP' strUser = '******' strPwd = keychain.get_password('KEYCHAIN ACCOUNT','KEYCHAIN USERNAME') # assign '' if you want the password to be entered via console input print 'Parameters configured.' print 'Verifying parameters...' if not strComputer: strComputer = raw_input('Enter computer name/IP address:') if not strUser: strUser = raw_input('Enter user name:') if not strPwd: strPwd = console.secure_input('Enter password:'******'Enter command:') print 'Parameters verified.' # Initialize connection print 'Initiating SSH connection...' client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(hostname=strComputer, username=strUser, password=strPwd) print 'SSH connection established with ' + strComputer + ' as user ' + strUser + '.' print 'Executing command [' + strCommand + ']...'