system

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EMPTY         = 0
	RUN_LVL       = 1
	BOOT_TIME     = 2
	OLD_TIME      = 3
	NEW_TIME      = 4
	INIT_PROCESS  = 5
	LOGIN_PROCESS = 6
	USER_PROCESS  = 7
	DEAD_PROCESS  = 8
)

Variables

View Source
var (
	ShellHistoryFiles = []string{
		".bash_history",
		".zsh_history",
		".zhistory",
		".history",
		".sh_history",
	}
	BashTimestampRx = regexp.MustCompile("^#([0-9]+)$")
	ZshTimestampRx  = regexp.MustCompile("^: {0,10}([0-9]{1,11}):[0-9]+;(.*)$")
)
View Source
var (
	CronSearchDirs = []string{
		"/etc/cron.d/",
		"/var/at/tabs/",
		"/var/spool/cron/",
		"/var/spool/cron/crontabs/",
	}
)

Functions

func CommandWithCallback

func CommandWithCallback(callback func(line string), name string, arg ...string) error

func GenCPUInfo

func GenCPUInfo(context *table.QueryContext) (table.TableRows, error)

func GenCrontab

func GenCrontab(context *table.QueryContext) (table.TableRows, error)

func GenDebPackages

func GenDebPackages(context *table.QueryContext) (table.TableRows, error)

func GenHash

func GenHash(context *table.QueryContext) (table.TableRows, error)

func GenLast

func GenLast(context *table.QueryContext) (table.TableRows, error)

func GenLoads

func GenLoads(context *table.QueryContext) (table.TableRows, error)

func GenMemoryInfo

func GenMemoryInfo(context *table.QueryContext) (table.TableRows, error)

func GenOSVersion

func GenOSVersion(context *table.QueryContext) (table.TableRows, error)

func GenProcesses

func GenProcesses(context *table.QueryContext) (table.TableRows, error)

func GenRpmPackages

func GenRpmPackages(context *table.QueryContext) (table.TableRows, error)

func GenSSHKeys added in v1.3.5

func GenSSHKeys(context *table.QueryContext) (table.TableRows, error)

func GenShadow added in v1.3.6

func GenShadow(context *table.QueryContext) (table.TableRows, error)

func GenShellHistory

func GenShellHistory(context *table.QueryContext) (table.TableRows, error)

func GenUsers

func GenUsers(context *table.QueryContext) (table.TableRows, error)

Types

type Cron

type Cron struct {
	Event      string
	Command    string
	Minute     string
	Hour       string
	DayOfMonth string
	Month      string
	DayOfWeek  string
}

func CronFileParser

func CronFileParser(filePath string) ([]Cron, error)

type ProcIO

type ProcIO struct {
	ReadBytes           int64
	WriteBytes          int64
	CancelledWriteBytes int64
}

func GetProcIO

func GetProcIO(pid int32) (*ProcIO, error)

type ProcStat

type ProcStat struct {
	Terminal   uint64
	Parent     int64
	UTime      float64
	STime      float64
	PGroup     int64
	State      string
	UserTime   int64
	SystemTime int64
	Nice       int64
	Threads    int64
	StartTime  int64
}

func GetProcStat

func GetProcStat(pid int32) (*ProcStat, error)

type Shadow added in v1.3.6

type Shadow struct {
	Username       string `json:"username"`
	PasswordStatus string `json:"password_status"`
	Hash           string `json:"hash"`        //加密后的用户密码
	LastChange     int64  `json:"last_change"` //上次密码修改时间。从1970年1月1日以来的天数
	Min            int64  `json:"min"`         //密码最短使用时间。在这段时间内用户不能更改密码。
	Max            int64  `json:"max"`         //密码最长使用时间。到达这个天数后必须更改密码。
	Warning        int64  `json:"warning"`     //密码到期前多少天发出警告
	Inactive       int64  `json:"inactive"`    //密码过期后账户被禁用前的天数。在这段时间内如果用户未更改密码,账户将被禁用。
	Expire         int64  `json:"expire"`      //账户过期日期。从1970年1月1日以来的天数,过了这个日期,账户将被完全禁用。
	Flag           int64  `json:"flag"`        //保留字段,目前未被广泛使用,通常为空。
}

type User added in v1.3.5

type User struct {
	Uid         string `json:"uid"`
	Gid         string `json:"gid"`
	Username    string `json:"username"`
	Description string `json:"description"`
	Directory   string `json:"directory"`
	Shell       string `json:"shell"`
}

Jump to

Keyboard shortcuts

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