Example #1
0
    def menu_change_password(self):
        #ask the user for new password
        new_password = []

        inputbox = ui_password_change.Ui_Password_Change(new_password)
        inputbox.show()
        if inputbox.exec_() == 1:
            #run the PUT command
            if len(new_password[0]) != 0:
                #set the new user's provided password
                yc.execute_command("set_code", new_password[0])
                self.refresh()
            else:
                #user picked a blank password, so we unset the code and leave the neo unprotected
                yc.execute_command("unset_code", new_password[0])
                self.refresh()
Example #2
0
    def refresh(self):
        
        # compute codes and check if the NEO is inserted into the USB        
        cred_list = yc.execute_command("calculate_all")
        
        # if None there is no NEO
        if cred_list is None:
            # close the main window
            self.hide_interface()

        else:
            
            #clear the list at the end of the 30 seconds
            self.leftList.clear()
            self.rightList.clear()
            
            for credential in cred_list:
                if credential.algorithm == 'totp':
                    self.leftList.addItem(str(credential.name))
                    self.rightList.addItem(str(credential.code))

                else:
                    self.leftList.addItem(str(credential.name))
                    
                    self.rightList.addItem('HOTP')
                    #identify the row and set the tooltip
                    value = self.rightList.count()
                    item = self.rightList.item(value-1)
                    item.setToolTip("Click to generate HOTP")
Example #3
0
    def menu_change_password(self):
        #ask the user for new password
        new_password = []

        inputbox = ui_password_change.Ui_Password_Change(new_password)
        inputbox.show()
        if inputbox.exec_() == 1:
            #run the PUT command
            if len(new_password[0]) != 0:
                #set the new user's provided password
                yc.execute_command("set_code", new_password[0])
                self.refresh()
            else:
                #user picked a blank password, so we unset the code and leave the neo unprotected
                yc.execute_command("unset_code", new_password[0])
                self.refresh()
Example #4
0
    def refresh(self):

        # compute codes and check if the NEO is inserted into the USB
        cred_list = yc.execute_command("calculate_all")

        # if None there is no NEO
        if cred_list is None:
            # close the main window
            self.hide_interface()

        else:

            #clear the list at the end of the 30 seconds
            self.leftList.clear()
            self.rightList.clear()

            for credential in cred_list:
                if credential.algorithm == 'totp':
                    self.leftList.addItem(str(credential.name))
                    self.rightList.addItem(str(credential.code))

                else:
                    self.leftList.addItem(str(credential.name))

                    self.rightList.addItem('HOTP')
                    #identify the row and set the tooltip
                    value = self.rightList.count()
                    item = self.rightList.item(value - 1)
                    item.setToolTip("Click to generate HOTP")
Example #5
0
    def addCredential(self):

        #set data structure for the add command
        new_account = {
        'KEY_TYPE':None,
        'ACCOUNT_NAME':None,
        'SECRET_KEY':None
        }

        #ask the user for new account information
        inputbox = ui_addaccount.Ui_AddAccount(new_account)
        inputbox.show()
        if inputbox.exec_() == 1:
            #strip off white spaces
            new_account['ACCOUNT_NAME'].replace(" ", "")
            new_account['SECRET_KEY'].replace(" ", "")
            #run the PUT command
            yc.execute_command("put", new_account)
            self.refresh()
Example #6
0
    def addCredential(self):

        #set data structure for the add command
        new_account = {
            'KEY_TYPE': None,
            'ACCOUNT_NAME': None,
            'SECRET_KEY': None
        }

        #ask the user for new account information
        inputbox = ui_addaccount.Ui_AddAccount(new_account)
        inputbox.show()
        if inputbox.exec_() == 1:
            #strip off white spaces
            new_account['ACCOUNT_NAME'].replace(" ", "")
            new_account['SECRET_KEY'].replace(" ", "")
            #run the PUT command
            yc.execute_command("put", new_account)
            self.refresh()
Example #7
0
    def delCredential(self):

        #get selected item from the user
        item = self.leftList.currentItem()
        if not item:
            QtGui.QMessageBox.information(QtGui.QWidget(), "Information", "Select 1 credential name on the left panel to delete it")
            return

        #ask for confirmation before delete
        delete, ok = QtGui.QInputDialog.getText(None, "Warning!", "Type \"delete\" to confirm deletion", QtGui.QLineEdit.Normal)
        if delete == "delete":
            if yc.execute_command("delete", item.text()):
                self.refresh()
            else:
                print "Warning: Delete unsuccessfull"
Example #8
0
    def delCredential(self):

        #get selected item from the user
        item = self.leftList.currentItem()
        if not item:
            QtGui.QMessageBox.information(
                QtGui.QWidget(), "Information",
                "Select 1 credential name on the left panel to delete it")
            return

        #ask for confirmation before delete
        delete, ok = QtGui.QInputDialog.getText(
            None, "Warning!", "Type \"delete\" to confirm deletion",
            QtGui.QLineEdit.Normal)
        if delete == "delete":
            if yc.execute_command("delete", item.text()):
                self.refresh()
            else:
                print "Warning: Delete unsuccessfull"
Example #9
0
    def itemClicked(self, item):
        # 1 click copy the item value as text
        # Handle HOTP load and copy
        if str(item.text()) == "HOTP":
            #get current row
            row = self.rightList.currentRow()
            #get name from the right list widget
            item = self.leftList.item(row)
            hotp_name = item.text()
            hotp = str(yc.execute_command("calculate", hotp_name))
            if hotp is None:
                hotp = "Error"

            #update the item with the generated code
            item = self.rightList.item(row)
            item.setText(hotp)
        
        app = QtCore.QCoreApplication.instance()
        clipboard = app.clipboard()
        clipboard.clear(QtGui.QClipboard.Clipboard)
        clipboard.setText(str(item.text()), QtGui.QClipboard.Clipboard)
Example #10
0
    def itemClicked(self, item):
        # 1 click copy the item value as text
        # Handle HOTP load and copy
        if str(item.text()) == "HOTP":
            #get current row
            row = self.rightList.currentRow()
            #get name from the right list widget
            item = self.leftList.item(row)
            hotp_name = item.text()
            hotp = str(yc.execute_command("calculate", hotp_name))
            if hotp is None:
                hotp = "Error"

            #update the item with the generated code
            item = self.rightList.item(row)
            item.setText(hotp)

        app = QtCore.QCoreApplication.instance()
        clipboard = app.clipboard()
        clipboard.clear(QtGui.QClipboard.Clipboard)
        clipboard.setText(str(item.text()), QtGui.QClipboard.Clipboard)