eval

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ShellToUse = "sh"

ShellToUse bash shell

Variables

This section is empty.

Functions

func CommandParams

func CommandParams(commands []string) map[int][]string

CommandParams calculate command params map params inorder to inject prev. command result into next command accept list of commands return location and result

Types

type CmdEvalResult

type CmdEvalResult struct {
	Match        bool
	CmdEvalExpr  string
	PolicyResult []utils.PolicyResult
	ReturnKeys   []string
	Error        error
}

CmdEvalResult command result object

type CmdEvaluator

type CmdEvaluator interface {
	EvalCommand(commands []string, evalExpr string) CmdEvalResult
	EvalCommandPolicy(commands []string, evalExpr string, policy string) CmdEvalResult
}

CmdEvaluator interface expose one method to evaluate command with evalExpr

func NewEvalCmd added in v0.0.2

func NewEvalCmd() CmdEvaluator

NewEvalCmd instantiate new command evaluator

type CommandExec

type CommandExec struct {
}

CommandExec object

func (CommandExec) Exec

func (ce CommandExec) Exec(command string) (*CommandResult, error)

Exec execute shell command #nosec

type CommandResult

type CommandResult struct {
	Stdout string
	Stderr string
}

CommandResult return data

type Executor

type Executor interface {
	Exec(command string) (*CommandResult, error)
}

Executor defines the interface for shell command executor exec.go

func NewShellExec

func NewShellExec() Executor

NewShellExec return new instance of shell executor

type FinalResult added in v0.0.6

type FinalResult struct {
	EvalExpResult int
	PolicyResult  []utils.PolicyResult
}

FinalResult eval result object

type IndexValue

type IndexValue struct {
	// contains filtered or unexported fields
}

IndexValue hold command index and result

Jump to

Keyboard shortcuts

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