Documentation ¶
Index ¶
- func IsUserExist(user string) (pass string, exists bool)
- func LoadGroups(groupFile string) error
- func LoadUsers(userFile string) error
- func RegisterCommand(name string, cmd Command)
- func RegisterCommandOutput(cmd, pathToOutput string)
- func RegisterFakeCommand(cmdList []string)
- type Command
- type Group
- type Shell
- type Sys
- type System
- func (sys *System) Chdir(path string) error
- func (sys *System) CurrentGroup() int
- func (sys *System) CurrentUser() int
- func (sys *System) Environ() (env []string)
- func (sys *System) Err() io.Writer
- func (sys *System) Exec(path string, args []string) (int, error)
- func (sys *System) FSys() afero.Fs
- func (sys *System) Getcwd() string
- func (sys *System) Height() int
- func (sys *System) Hostname() string
- func (sys *System) IOStream() io.ReadWriter
- func (sys *System) In() io.Reader
- func (sys *System) Out() io.Writer
- func (sys *System) SetEnv(key, value string) error
- func (sys *System) Width() int
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsUserExist ¶
func LoadGroups ¶
func RegisterCommand ¶
RegisterCommand puts the command implementation into map so it can be invoked from command line
func RegisterCommandOutput ¶ added in v0.6.0
func RegisterCommandOutput(cmd, pathToOutput string)
RegisterCommandOutput gets the file content and associate it with the command provided. So that once triggered in console the content will be displayed
func RegisterFakeCommand ¶
func RegisterFakeCommand(cmdList []string)
RegisterFakeCommand put commands into register so that when typed in terminal they will print out SegFault
Types ¶
type Command ¶
Command interface allow classes to simulate real executable that have access to standard I/O, filesystem, arguments, EnvVars, and cwd
type Group ¶
func GetGroupByID ¶
type Shell ¶
type Shell struct { DelayFunc func() // contains filtered or unexported fields }
func (*Shell) ExecCmd ¶ added in v0.5.0
func (sh *Shell) ExecCmd(cmd string, tLog termlogger.StdIOErr)
func (*Shell) HandleRequest ¶
func (sh *Shell) HandleRequest(hook termlogger.LogHook)
type System ¶
type System struct {
// contains filtered or unexported fields
}
System provides what most of os/sys does in the honeyport
func NewSystem ¶
func NewSystem(user, host string, fs afero.Fs, channel ssh.Channel, width, height int, log *log.Entry) *System
NewSystem initializer a system object containing current user context: ID, home directory, terminal dimensions, etc.
func (*System) CurrentGroup ¶
func (*System) CurrentUser ¶
func (*System) IOStream ¶
func (sys *System) IOStream() io.ReadWriter