ebpf

package
v0.0.0-...-2ec37ed Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoError = iota
	NotAvailable
	EventsNotAvailable
)

list of returned errors

View Source
const (
	EV_TYPE_NONE = iota
	EV_TYPE_EXEC
	EV_TYPE_EXECVEAT
	EV_TYPE_FORK
	EV_TYPE_SCHED_EXIT
)

List of supported events

View Source
const MaxArgLen = 256

MaxArgLen defines the maximum length of each argument. NOTE: this value is 131072 (PAGE_SIZE * 32) https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/binfmts.h#L16

View Source
const MaxArgs = 20

MaxArgs defines the maximum number of arguments allowed

View Source
const MaxPathLen = 4096

MaxPathLen defines the maximum length of a path, as defined by the kernel: https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/limits.h#L13

View Source
const TaskCommLen = 16

TaskCommLen is the maximum num of characters of the comm field

Variables

This section is empty.

Functions

func Events

func Events() <-chan interface{}

func GetPid

func GetPid(proto string, srcPort uint, srcIP net.IP, dstIP net.IP, dstPort uint) (*procmon.Process, bool, error)

GetPid looks up process pid in a bpf map. If it's not found, it searches already-established TCP connections. Returns the process if found. Additionally, if the process has been found by swapping fields, it'll return a flag indicating it.

func NewEbpfCache

func NewEbpfCache() *ebpfCacheType

NewEbpfCache creates a new cache store.

func NewEbpfCacheItem

func NewEbpfCacheItem(key []byte, pid int) *ebpfCacheItem

NewEbpfCacheItem creates a new cache item.

func PrintEverything

func PrintEverything()

PrintEverything prints all the stats. used only for debugging

func Stop

func Stop()

Stop stops monitoring connections using kprobes

Types

type Error

type Error struct {
	What int // 1 global error, 2 events error, 3 ...
	Msg  error
}

Error returns the error type and a message with the explanation

func Start

func Start(modPath string) *Error

Start installs ebpf kprobes

Jump to

Keyboard shortcuts

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