ConsoleUser

Copyright (c) 2010-2023 Skaion Corporarion, www.skaion.com

This project was developed in part by numerous sponsorships from the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints of Governmental purposes notwithstanding any copyright notation thereon.

All content reflects those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government or Skaion Corporation.

class CommandShellImpl.CommandShellImpl(system, config)

This calss is the public interface by which a <no title> can access the command shell. This class abstracts away the actual command shell being used as with many of the commands it is capable of running.

Parameters:

  • system: a <no title> object to communicate with the target system

  • config: a <no title> object hold all our configuration

execute(cmd, block=False)

Execute the given command in the shell we’re using.

Parameters:

  • cmd: the string command to type into the shell

  • block: whether or not to wait for the command to finish before returning

has_prompt()

Returns True if a prompt is visible and ready for use, False otherwise.

CommandShellImpl.get_command_shell(system, config, shell_type=None, unique=False)

This is the Factory method wich creates concrete instance of CommandShellImpl to control an actual command shell.

Parameters:

  • system: a <no title> object to interact with the remote system

  • config: a <no title> object containing our configuration

  • shellType: a type of CommandShell to load regardless of the config object

  • unique: if True, do not use a shared shell

Return: an instance of a concrete CommandShellImpl or None if the type is not known