collect

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectHostBackup

func CollectHostBackup() *payload.HostBackup

CollectHostBackup detects known backup systems and periodic backup cron hints. backup_status is "on" when tools/cron indicate backups likely exist, otherwise "unknown".

func CollectHostDisk

func CollectHostDisk() (*payload.HostDisk, string)

CollectHostDisk reports mount usage via gopsutil disk.Partitions(false) + disk.Usage. The second return is non-empty when host disk usage could not be collected (error message for ingest).

func CollectHostNetwork

func CollectHostNetwork() (*payload.HostNetwork, string)

CollectHostNetwork summarizes interfaces and public-IP hints via gopsutil net.Interfaces.

func CollectHostPath

func CollectHostPath() *payload.HostPath

CollectHostPath enumerates PATH directories with exists and world-writable flags (skips dirs under /home).

func CollectHostProcess

func CollectHostProcess() *payload.HostProcess

CollectHostProcess builds top CPU/RSS merge and interpreter / heuristic signals (M1).

func CollectHostRuntimes

func CollectHostRuntimes() *payload.HostRuntimes

CollectHostRuntimes probes common interpreters on PATH (capped, M1).

func CollectHostSSH

func CollectHostSSH() (*payload.HostSSH, string)

CollectHostSSH reads effective sshd settings from `sshd -T`.

func CollectHostSuid

func CollectHostSuid() *payload.HostSuid

CollectHostSuid lists setuid binaries under common roots (bounded). Implemented with filepath.WalkDir (no external find): gopsutil does not expose filesystem setuid enumeration.

func CollectHostTime

func CollectHostTime() *payload.HostTime

CollectHostTime sets utc_now, tries an SNTP query for offset_ms, and detects a running timesync daemon.

func CollectHostUsersSummary

func CollectHostUsersSummary() (*payload.HostUsersSummary, string)

CollectHostUsersSummary parses /etc/passwd for counts and a capped sample (no password material).

func CollectListeners

func CollectListeners(hn *payload.HostNetwork) []payload.Listener

CollectListeners lists TCP listeners via gopsutil net.Connections (same idea as psutil net_connections).

func CollectOSInfo

func CollectOSInfo() (payload.OSInfo, string)

CollectOSInfo sends pretty/kernel, raw /etc/os-release fields, and gopsutil host.Info. The API derives distro_id / distro_version_id / distro_name for EOL (see backend src/ingest/os_normalize). The second return is the host name from host.Info (for dashboard titles), or "" if unavailable.

func CollectPackagesUpdates

func CollectPackagesUpdates() (*payload.PackagesUpdates, string)

CollectPackagesUpdates fills pending/security counts and a capped list of security-only package names. Prefers apt (Debian/Ubuntu), then dnf, then yum (RHEL family). The second return is a non-empty message when no package manager is available.

func CollectServices

func CollectServices() ([]payload.ServiceEntry, string)

CollectServices lists running services: systemd (D-Bus) when pid 1 is systemd, otherwise sysvinit (Debian/Ubuntu-style `service --status-all` parsing). The second return is non-empty when service inventory could not be collected.

func RedactCmdline

func RedactCmdline(s string) string

RedactCmdline removes home-directory path segments from a command line for ingest.

func Stub

func Stub(machineUUID string, scanSeq int) payload.V1

Stub builds a v1 payload (listeners include firewall_rule; other blocks optional).

func StubWithObserver

func StubWithObserver(machineUUID string, scanSeq int, observe ActionEventObserver) payload.V1

StubWithObserver builds a v1 payload and calls observe before each data collection action.

Types

type ActionEvent

type ActionEvent struct {
	Action string
	Phase  string
	Items  int
	Error  string
}

type ActionEventObserver

type ActionEventObserver func(event ActionEvent)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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