コード例 #1
0
ファイル: application.py プロジェクト: mgian/Mausoleum
    def create_defined_tomb(self):
        """Create the defined tomb when Create Tomb is clicked.

        The key's password and sudo password are not stored as strings so that the only
        place passwords are stored is in QLineEdit. QLineEdit will clear the passwords,
        however we must make sure that the application is not stored in swap.
        """
        if self.key_password.text() == self.confirm_password.text():
            dig_command = wrapper.dig_tomb(self.tomb_name.text(),
                                           self.size_box.value())
            if self.random_checkbox.isChecked():
                forge_command = wrapper.forge_tomb(self.key_name.text(),
                                                   self.key_password.text(),
                                                   self.path,
                                                   self.sudo_password.text(),
                                                   debug=True)
            else:
                forge_command = wrapper.forge_tomb(self.key_name.text(),
                                                   self.key_password.text(),
                                                   self.path,
                                                   self.sudo_password.text())
            lock_command = wrapper.lock_tomb(self.tomb_name.text(),
                                             self.key_name.text(),
                                             self.key_password.text(),
                                             self.path,
                                             self.sudo_password.text())
            if (dig_command == 0 and forge_command[0] is not None
                    and lock_command[0] is not None):
                self.message.setText('Tomb Created Successfully')
                if self.open_checkbox.isChecked():
                    open_command = wrapper.open_tomb(self.tomb_name.text(),
                                                     self.key_name.text(),
                                                     self.key_password.text(),
                                                     self.path,
                                                     self.sudo_password.text())
                    if open_command[0] is not None:
                        self.message.setText('Tomb Opened Successfully')
        else:
            self.message.setText('Key Passwords Do Not Match')
            self.key_password.clear()
            self.confirm_password.clear()
コード例 #2
0
def test_forge_tomb(key, password):
    """Test creation of a new tomb key for the created tomb container."""
    wrapper.forge_tomb(key, password, debug=True)