shell

package
v0.0.0-...-0117b6e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 38 Imported by: 2

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 SetSize

func SetSize(log log.T, ws_col, ws_row uint32) (err error)

SetSize sets size of console terminal window.

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

Directories

Path Synopsis
Package constants manages the configuration of the session shell.
Package constants manages the configuration of the session shell.
Package execcmd wraps up the os.Process interface.
Package execcmd wraps up the os.Process interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL