Documentation ¶
Overview ¶
Package shell is a common library that implements session manager shell.
Package shell implements session shell plugin.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartCommandExecutor ¶
func StartCommandExecutor( log log.T, shellProps mgsContracts.ShellProperties, isSessionLogger bool, config agentContracts.Configuration, plugin *ShellPlugin) (err error)
StartCommandExecutor starts command execution in different behaviors based on plugin type. For Standard_Stream and InteractiveCommands plugins, StartCommandExecutor starts pty and provides handles to stdin and stdout. For NonInteractiveCommands plugin, StartCommandExecutor defines a command executor with native os.Exec, without assigning stdin. isSessionLogger determines whether its a customer shell or shell used for logging.
Types ¶
type IShellPlugin ¶
type IShellPlugin interface { Execute(config agentContracts.Configuration, cancelFlag task.CancelFlag, output iohandler.IOHandler, dataChannel datachannel.IDataChannel, shellProps mgsContracts.ShellProperties) InputStreamMessageHandler(log log.T, streamDataMessage mgsContracts.AgentMessage) error }
type ShellPlugin ¶
type ShellPlugin struct {
// contains filtered or unexported fields
}
Plugin is the type for the plugin.
func NewPlugin ¶
func NewPlugin(context context.T, name string) (*ShellPlugin, error)
NewPlugin returns a new instance of the Shell Plugin
func (*ShellPlugin) Execute ¶
func (p *ShellPlugin) Execute( config agentContracts.Configuration, cancelFlag task.CancelFlag, output iohandler.IOHandler, dataChannel datachannel.IDataChannel, shellProps mgsContracts.ShellProperties)
Execute starts pseudo terminal. It reads incoming message from data channel and writes to pty.stdin. It reads message from pty.stdout and writes to data channel
func (*ShellPlugin) InputStreamMessageHandler ¶
func (p *ShellPlugin) InputStreamMessageHandler(log log.T, streamDataMessage mgsContracts.AgentMessage) error
InputStreamMessageHandler passes payload byte stream to shell stdin