Example #1
0
def generate(args):
    # handles generation of passwords
    if len(args) >= 1:
        # If we have more arguments then we are dealing with the db here
        # request and verify the master password before proceeding
        master = hash_pass(
            getpass("Enter master password to generate password: "******"Incorrect master password")
            return
        password = None
        if len(args) >= 2:
            # A password was specified so use that
            password = args[1]
        else:
            # generate a new password because none was specified
            password = generate_password()
        account = args[0]
        success = add_password(master, account, password)
        if success:
            copy_text(password)
            print("Newly saved password copied to clipboard!")
        else:
            print("Cancelled Operation!")
    else:
        # Just generate a random password
        copy_text(generate_password())
        print("Newly generated password copied to clipboard!")
Example #2
0
def get_passwords(master, account):
    # Get passwords from the database
    path = detect_path()
    decryptDB(path, master)

    # Setup DB
    conn = sqlite3.connect(path)
    with conn:
        c = conn.cursor()
        if account:
            c.execute("SELECT * FROM passwords WHERE account=?", (account, ))
            password = c.fetchone()
            if password:
                copy_text(decrypt_pass(password[2], master))
                print("Password has been copied to your clipboard!")
            else:
                print("The specified account does not exist!")
        else:
            c.execute("SELECT * FROM passwords")
            passwords = c.fetchall()
            for password in passwords:
                print("{} = {}".format(password[1],
                                       decrypt_pass(password[2], master)))
    conn.close()
    encryptDB(path, master)
Example #3
0
 def CopyRowLabel(self, row):
     clipboard.copy_text('<%s>' % self.table.GetRowLabelValue(row))
Example #4
0
 def CopyCellValue(self, row, col):
     if self.table.GetNumberCols():
         clipboard.copy_text(unicode(self.table.GetValue(row, col)))
Example #5
0
 def CopyRowLabel(self, row):
     clipboard.copy_text('<%s>' % self.table.GetRowLabelValue(row))
Example #6
0
 def CopyCellValue(self, row, col):
     if self.table.GetNumberCols():
         clipboard.copy_text(unicode(self.table.GetValue(row, col)))