process

package
v0.0.0-...-ce4a229 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsBinary

func ContainsBinary(mapsFile *ProcessFile, binaries []string) bool

ContainsBinary checks if maps file contains any of the specified binaries/libraries

func FindAllProcesses

func FindAllProcesses() ([]int, error)

FindAllProcesses scans /proc and returns all process PIDs

func GetContainerPIDs

func GetContainerPIDs(containerID string) ([]int, error)

GetContainerPIDs returns all PIDs belonging to a specific container

func GetProcDir

func GetProcDir() string

GetProcDir returns the current proc directory

func IsProcessEqualToAny

func IsProcessEqualToAny(ctx *ProcessContext, processNames []string) bool

IsProcessEqualToAny checks if process executable or cmdline matches any of the given names

func ReadBinaryContent

func ReadBinaryContent(filePath string, maxBytes int) ([]byte, error)

ReadBinaryContent reads a portion of binary file for signature checking

func SetProcDir

func SetProcDir(dir string)

SetProcDir sets the proc directory (e.g., /host/proc for DaemonSet mode)

Types

type ELFAnalyzer

type ELFAnalyzer struct{}

ELFAnalyzer provides utilities for analyzing ELF binaries

func NewELFAnalyzer

func NewELFAnalyzer() *ELFAnalyzer

NewELFAnalyzer creates a new ELF analyzer

func (*ELFAnalyzer) ExtractPHPVersion

func (ea *ELFAnalyzer) ExtractPHPVersion(executablePath string) (string, error)

ExtractPHPVersion extracts PHP version from ELF .rodata section

func (*ELFAnalyzer) GetDynamicLibraries

func (ea *ELFAnalyzer) GetDynamicLibraries(executablePath string) ([]string, error)

GetDynamicLibraries returns all dynamic libraries the binary depends on

func (*ELFAnalyzer) GetLibcType

func (ea *ELFAnalyzer) GetLibcType(executablePath string) (string, error)

GetLibcType determines if the binary uses musl or glibc

func (*ELFAnalyzer) HasCPlusPlusLibraries

func (ea *ELFAnalyzer) HasCPlusPlusLibraries(executablePath string) (bool, string, error)

HasCPlusPlusLibraries checks if binary is linked with C++ libraries

func (*ELFAnalyzer) HasPythonSymbols

func (ea *ELFAnalyzer) HasPythonSymbols(executablePath string) (bool, string, error)

HasPythonSymbols checks if binary has Python-related symbols

func (*ELFAnalyzer) HasRustSymbols

func (ea *ELFAnalyzer) HasRustSymbols(executablePath string) (bool, error)

HasRustSymbols checks if binary has Rust symbols

func (*ELFAnalyzer) IsGoBinary

func (ea *ELFAnalyzer) IsGoBinary(executablePath string) (bool, string, error)

IsGoBinary checks if a binary is a Go executable using buildinfo

type ProcessContext

type ProcessContext struct {
	PID         int
	PPID        int
	Executable  string
	Cmdline     string
	Environ     map[string]string
	CgroupPath  string
	ContainerID string
}

ProcessContext contains detailed information about a running process

func GetProcessContext

func GetProcessContext(pid int) (*ProcessContext, error)

GetProcessContext retrieves detailed information about a process

type ProcessFile

type ProcessFile struct {
	Path    string
	Content string
}

ProcessFile represents a file in /proc/[pid]/

func ReadMapsFile

func ReadMapsFile(pid int) (*ProcessFile, error)

ReadMapsFile reads /proc/[pid]/maps file

Jump to

Keyboard shortcuts

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