bash

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ElfTypeBin = 1
	ElfTypeSo  = 2
)
View Source
const (
	// BashEventTypeReadline indicates a readline event
	BashEventTypeReadline = 0
	// BashEventTypeRetval indicates a return value event
	BashEventTypeRetval = 1
	// BashEventTypeExitOrExec indicates an exit or exec event
	BashEventTypeExitOrExec = 2

	// MaxDataSizeBash is the maximum line size from eBPF
	MaxDataSizeBash = 256
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	*config.BaseConfig
	Bashpath         string `json:"bashpath"` // Path to bash binary
	Readline         string `json:"readline"` // Path to libreadline.so
	ErrNo            int    `json:"errno"`
	ElfType          uint8  `json:"elf_type"`
	ReadlineFuncName string `json:"readline_func_name"`
}

Config extends BaseConfig with Bash-specific configuration.

func NewConfig

func NewConfig() *Config

NewConfig creates a new Bash probe configuration.

func (*Config) Bytes

func (c *Config) Bytes() []byte

Bytes serializes the configuration to JSON.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the configuration is valid.

type Event

type Event struct {
	BashType    uint32
	Pid         uint32
	Uid         uint32
	Line        [MaxDataSizeBash]uint8
	ReturnValue uint32
	Comm        [16]byte
	AllLines    string // Accumulated lines for multi-line commands
}

Event represents a bash command event from eBPF.

func (*Event) Clone

func (e *Event) Clone() domain.Event

Clone creates a new instance of the event.

func (*Event) DecodeFromBytes

func (e *Event) DecodeFromBytes(data []byte) error

DecodeFromBytes deserializes the event from raw eBPF data.

func (*Event) String

func (e *Event) String() string

String returns a human-readable representation of the event.

func (*Event) StringHex

func (e *Event) StringHex() string

StringHex returns a hexadecimal representation of the event.

func (*Event) Type

func (e *Event) Type() domain.EventType

Type returns the event type (always Output for bash commands).

func (*Event) UUID

func (e *Event) UUID() string

UUID returns a unique identifier for this event.

func (*Event) Validate

func (e *Event) Validate() error

Validate checks if the event data is valid.

type Probe

type Probe struct {
	*base.BaseProbe
	// contains filtered or unexported fields
}

Probe implements the bash command tracing probe.

func NewProbe

func NewProbe() (*Probe, error)

NewProbe creates a new Bash probe instance.

func (*Probe) Close

func (p *Probe) Close() error

Close releases all probe resources.

func (*Probe) DecodeFun

func (p *Probe) DecodeFun(em *ebpf.Map) (domain.EventDecoder, bool)

func (*Probe) Events

func (p *Probe) Events() []*ebpf.Map

Events returns the eBPF maps for event collection.

func (*Probe) Initialize

func (p *Probe) Initialize(ctx context.Context, cfg domain.Configuration) error

Initialize sets up the probe with configuration and dispatcher.

func (*Probe) Start

func (p *Probe) Start(ctx context.Context) error

Start begins the bash probe operation.

Jump to

Keyboard shortcuts

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