Exemplo n.º 1
0
    def get_command_handler(self, command):
        """ Parsing command and returning appropriate handler.

        :param command: command
        :return: command_handler
        """
        try:
            command_handler = getattr(self, "command_{}".format(command))
        except AttributeError:
            raise PocsuiteBaseException("Unknown command: '{}'".format(command))

        return command_handler
Exemplo n.º 2
0
    def get_command_handler(self, command):
        """ Parsing command and returning appropriate handler.

        :param command: command
        :return: command_handler
        """
        try:
            command_handler = getattr(self, "command_{}".format(command))
        except AttributeError:
            cmd = self.input_command + ' ' + self.input_args
            for line in exec_cmd(cmd=cmd):
                if result_encoding := chardet.detect(line)['encoding']:
                    print(line.decode(result_encoding))
            raise PocsuiteBaseException("Pocsuite3 Unknown this command, and run it on system: '{}'".format(command))