command

package
v1.8.8 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserRoot             = "root"
	ContentTypeBase64    = "Base64"
	ContentTypePlainText = "PlainText"
	ScriptMd5            = "script_md5"
)

Variables

View Source
var ScriptTypeToSuffix = map[string]ScriptMeta{
	"bash": {
		// contains filtered or unexported fields
	},
	"shell": {
		// contains filtered or unexported fields
	},
	"python2": {
		// contains filtered or unexported fields
	},
	"python3": {
		// contains filtered or unexported fields
	},
}

ScriptTypeToSuffix Supported script types

View Source
var SupportContentType = map[string]bool{
	ContentTypePlainText: true,
	ContentTypeBase64:    true,
}

SupportContentType Supported content types

Functions

func RunCommandWithTimeOut

func RunCommandWithTimeOut(timeout int, user *user.User, command string, environments []string, args ...string) (stdout, stderr string, isKilled bool, err error)

func WaitTimeout

func WaitTimeout(cmd *exec.Cmd, timeout time.Duration) (isKilled bool, err error)

Types

type InputCommand

type InputCommand struct {
	ScriptType          string   `comment:"Type of script: bash, shell, python2, python3"`
	User                string   `comment:"User executing the script"`
	ScriptContent       string   `comment:"Content of the script"`
	ContentEncoding     string   `comment:"Encoding format of the script: PlainText|Base64"`
	LineSplitSep        string   `comment:"Separator used for splitting lines"`
	TimeoutMilliSeconds int      `` /* 137-byte string literal not displayed */
	CmdPath             string   `comment:"Path where the executable command needs to be executed"`
	IntervalMs          int      `comment:"Frequency at which the collection is triggered in milliseconds"`
	Environments        []string `comment:"Environment variables"`
	IgnoreError         bool     `comment:"Environment variables"`
	// contains filtered or unexported fields
}

func (*InputCommand) Collect

func (in *InputCommand) Collect(collector pipeline.Collector) error

func (*InputCommand) Description

func (in *InputCommand) Description() string

func (*InputCommand) Init

func (in *InputCommand) Init(context pipeline.Context) (int, error)

func (*InputCommand) Validate

func (in *InputCommand) Validate() (bool, error)

type ScriptMeta

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

Jump to

Keyboard shortcuts

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