system

package
v0.0.0-...-f12bd69 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OSShellAshExePath    = "/bin/ash"
	OSShellBourneExePath = "/bin/sh"
	OSShellKornExePath   = "/bin/ksh93"
	//usually a link to /bin/ksh93
	OSShellRestrictedKornExePath = "/bin/rksh93"
	//usually a link to /etc/alternatives/ksh
	//which links to /bin/ksh93
	OSShellKorn2ExePath = "/bin/ksh"
	OSShellBashExePath  = "/bin/bash"
	//usually a link to /bin/bash
	OSShellRestrictedBashExePath = "/bin/rbash"
	OSShellDashExePath           = "/bin/dash"
	OSShellZExePath              = "/bin/zsh"
	//usually a link to /bin/zsh
	OSShellZ2ExePath       = "/usr/bin/zsh"
	OSShellCExePath        = "/bin/csh"
	OSShellTCExePath       = "/bin/tcsh"
	OSShellFishExePath     = "/usr/bin/fish"
	OSShellElvishExePath   = "/usr/bin/elvish"
	OSShellXonshExePath    = "/usr/bin/xonsh"
	OSShellYashExePath     = "/usr/bin/yash"
	OSShellGitShellExePath = "/usr/bin/git-shell"
	OSShellScreenExePath   = "/usr/bin/screen"
	OSShellTmuxExePath     = "/usr/bin/tmux"
)

Common linux shell exe paths

View Source
const (
	SyscallX86MinNum      = 0
	SyscallX86UnknownNum  = -1
	SyscallX86UnknownName = "unknown_syscall"
)
View Source
const (
	SyscallArmUnknownNum  = -1
	SyscallArmUnknownName = "unknown_syscall"
	SyscallArmMinNum32    = 0
	SyscallArmMaxNum32    = 462
	SyscallArmLastName32  = "mseal"
)
View Source
const (
	SyscallArmUnknownNum64  = -1
	SyscallArmUnknownName64 = "unknown_syscall"
	SyscallArmMinNum64      = 0
	SyscallArmMaxNum64      = 462
	SyscallArmLastName64    = "mseal"
)
View Source
const (
	SyscallX86MaxNum32   = 462
	SyscallX86LastName32 = "mseal"
)
View Source
const (
	SyscallX86MaxNum64   = 462
	SyscallX86LastName64 = "mseal"
)
View Source
const (
	OSShellsFile = "/etc/shells"
)

Variables

View Source
var (
	ErrNotConfigured    = errors.New("feature is not configured")
	ErrNoConfigs        = errors.New("no kernel configs")
	ErrArchNotSupported = errors.New("unsupported architecture")
)
View Source
var ArmFamily32Arch = ArchInfo{
	Name:   ArchNameArm32,
	Family: ArchFamilyArm,
	Bits:   ArchBits32,
}
View Source
var ArmFamily64Arch = ArchInfo{
	Name:   ArchNameArm64,
	Family: ArchFamilyArm,
	Bits:   ArchBits64,
}
View Source
var DefaultKernelFeatures, _ = NewKernelFeatures()
View Source
var OSShells = map[string]OSShell{
	OSShellBourneExePath: {
		FullName:  "Bourne shell",
		ShortName: "sh",
		ExePath:   OSShellBourneExePath,
	},
	OSShellKornExePath: {
		FullName:  "Korn shell",
		ShortName: "ksh",
		ExePath:   OSShellKornExePath,
	},
	OSShellBashExePath: {
		FullName:  "Bash shell",
		ShortName: "bash",
		ExePath:   OSShellBashExePath,
	},
	OSShellDashExePath: {
		FullName:  "Dash shell",
		ShortName: "dash",
		ExePath:   OSShellDashExePath,
	},
	OSShellZExePath: {
		FullName:  "Z shell",
		ShortName: "zsh",
		ExePath:   OSShellZExePath,
	},
	OSShellCExePath: {
		FullName:  "C shell",
		ShortName: "csh",
		ExePath:   OSShellCExePath,
	},
	OSShellTCExePath: {
		FullName:  "TC shell",
		ShortName: "tcsh",
		ExePath:   OSShellTCExePath,
	},
	OSShellFishExePath: {
		FullName:  "Fish shell",
		ShortName: "fish",
		ExePath:   OSShellFishExePath,
	},
	OSShellElvishExePath: {
		FullName:  "Elvish shell",
		ShortName: "elvish",
		ExePath:   OSShellElvishExePath,
	},
	OSShellXonshExePath: {
		FullName:  "Xonsh shell",
		ShortName: "xonsh",
		ExePath:   OSShellXonshExePath,
	},
	OSShellYashExePath: {
		FullName:  "Yash shell",
		ShortName: "yash",
		ExePath:   OSShellYashExePath,
	},
	OSShellAshExePath: {
		FullName:  "Ash shell",
		ShortName: "ash",
		ExePath:   OSShellAshExePath,
	},

	OSShellGitShellExePath: {
		FullName:  "Git shell",
		ShortName: "git-shell",
		ExePath:   OSShellGitShellExePath,
	},
	OSShellScreenExePath: {
		FullName:  "Screen",
		ShortName: "screen",
		ExePath:   OSShellScreenExePath,
	},
	OSShellTmuxExePath: {
		FullName:  "Tmux",
		ShortName: "tmux",
		ExePath:   OSShellTmuxExePath,
	},
}

Functions

func CallFirstParam

func CallFirstParam(regs syscall.PtraceRegs) uint64

func CallFourthParam

func CallFourthParam(regs syscall.PtraceRegs) uint64

func CallNumber

func CallNumber(regs syscall.PtraceRegs) uint64

func CallReturnValue

func CallReturnValue(regs syscall.PtraceRegs) uint64

func CallSecondParam

func CallSecondParam(regs syscall.PtraceRegs) uint64

func CallThirdParam

func CallThirdParam(regs syscall.PtraceRegs) uint64

func IsOSShellsFile

func IsOSShellsFile(name string) bool

func IsShellExePath

func IsShellExePath(name string) bool

func LookupCallName

func LookupCallName(num uint32) string

func LookupCallNumber

func LookupCallNumber(name string) (uint32, bool)

func ResolveGroup

func ResolveGroup(identity string) (uint32, error)

func ResolveUser

func ResolveUser(identity string) (uid uint32, gid uint32, home string, err error)

Types

type ArchBits

type ArchBits uint8
const (
	ArchBits32 ArchBits = 32
	ArchBits64 ArchBits = 64
)

type ArchFamily

type ArchFamily string
const (
	ArchFamilyX86   ArchFamily = "x86"
	ArchFamilyArm   ArchFamily = "arm"
	ArchFamilyArm64 ArchFamily = "arm64"
)

type ArchInfo

type ArchInfo struct {
	Name   ArchName
	Family ArchFamily
	Bits   ArchBits
}

func MachineToArch

func MachineToArch(mtype string) *ArchInfo

type ArchName

type ArchName string
const (
	ArchNameUnknown     ArchName = "unknown"
	ArchNameUnsupported ArchName = "unsupported"
	ArchName386         ArchName = "386"
	ArchNameAmd64       ArchName = "amd64"
	ArchNameArm32       ArchName = "armhf"
	ArchNameArm64       ArchName = "aarch64"
)

func MachineToArchName

func MachineToArchName(mtype string) ArchName

type DistroInfo

type DistroInfo struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	DisplayName string `json:"display_name"`
}

type KernelFeatures

type KernelFeatures struct {
	Raw   map[string]string
	Error string
}

func NewKernelFeatures

func NewKernelFeatures() (KernelFeatures, error)

func NewKernelFeaturesWithProps

func NewKernelFeaturesWithProps(location string) (KernelFeatures, error)

func (*KernelFeatures) IsCompiled

func (p *KernelFeatures) IsCompiled(name string) (bool, error)

func (*KernelFeatures) IsConfigured

func (p *KernelFeatures) IsConfigured(name string) bool

func (*KernelFeatures) IsFlag

func (p *KernelFeatures) IsFlag(name string) (bool, error)

func (*KernelFeatures) IsLoadable

func (p *KernelFeatures) IsLoadable(name string) (bool, error)

func (*KernelFeatures) RawValue

func (p *KernelFeatures) RawValue(name string) (string, error)

type MachineName

type MachineName string
const (
	MachineNameNamei386   MachineName = "i386"
	MachineNameNamei586   MachineName = "i586"
	MachineNameNamei686   MachineName = "i686"
	MachineNameNamex86_64 MachineName = "x86_64"
	MachineNameNameArm    MachineName = "armv7l"
	MachineNameNameArm64  MachineName = "aarch64"
)

type NameResolverFunc

type NameResolverFunc func(string) (uint32, bool)

func CallNameResolver

func CallNameResolver(arch ArchName) NameResolverFunc

type NumberResolverFunc

type NumberResolverFunc func(uint32) string

func CallNumberResolver

func CallNumberResolver(arch ArchName) NumberResolverFunc

type OSShell

type OSShell struct {
	FullName  string `json:"full_name"`
	ShortName string `json:"short_name,omitempty"`
	ExePath   string `json:"exe_path"`
	LinkPath  string `json:"link_path,omitempty"`
	Reference string `json:"reference,omitempty"`
	Verified  bool   `json:"verified,omitempty"`
}

func LookupShellByExePath

func LookupShellByExePath(name string) *OSShell

func NewOSShells

func NewOSShells(verify bool) ([]*OSShell, error)

func NewOSShellsFromData

func NewOSShellsFromData(raw []byte) ([]*OSShell, error)

func ParseOSShells

func ParseOSShells(raw []byte) []*OSShell

type SystemInfo

type SystemInfo struct {
	Sysname    string
	Nodename   string
	Release    string
	Version    string
	Machine    string
	Domainname string
	OsBuild    string
	Distro     DistroInfo
}

func GetSystemInfo

func GetSystemInfo() SystemInfo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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