Documentation ¶
Index ¶
Constants ¶
const ( // Windows represents the Windows family of Operating Systems. Windows deviceOS = 0x0 // Linux represents the Linux family of Operating Systems Linux deviceOS = 0x1 // Unix represents the Unix family of Operating Systems Unix deviceOS = 0x2 // Mac represents the MacOS/BSD family of Operating Systems Mac deviceOS = 0x3 // Arch64 represents the 64-bit chipset family. Arch64 deviceArch = 0x0 // Arch86 represents the 32-bit chipset family. Arch86 deviceArch = 0x1 // ArchARM represents the ARM chipset family. ArchARM deviceArch = 0x2 // ArchPowerPC represents the PowerPC chipset family. ArchPowerPC deviceArch = 0x3 // ArchMips represents the MIPS chipset family. ArchMips deviceArch = 0x4 // ArchUnknown represents an unknown chipset family. ArchUnknown deviceArch = 0x5 // IDSize is the amount of bytes used to store the Host ID and // SessionID values. The ID is the (HostID + SessionID). IDSize = 32 // SmallIDSize is the amount of bytes used for printing the Host ID // value using the ID function. SmallIDSize = MachineIDSize // MachineIDSize is the amount of bytes that is used as the Host // specific ID value that does not change when on the same host. MachineIDSize = 28 )
Variables ¶
var ( // Shell is the default machine specific command shell. Shell = compat.Shell() // Local is the pointer to the local // machine instance. This instance is loaded at // runtime and is used for local data gathering. Local = &localMachine{ &Machine{ ID: getID(), OS: deviceOS(compat.Os()), PID: uint64(os.Getpid()), Arch: getArch(), User: "Unknown", Version: compat.Version(), Network: Network{}, Hostname: "Unknown", Elevated: compat.Elevated(), }, } // Newline is the machine specific newline character. Newline = compat.Newline() // ShellArgs is the default machine specific command shell // arguments to run commands. ShellArgs = compat.ShellArgs() )
var ( // Environment is a mapping of environment string names // to their string values. Environment = make(map[string]string) // ErrInvalidID is returned by the 'IDFromString' function when // the returned ID value is invalid or nil. ErrInvalidID = errors.New("id format is invalid or empty") )
var ( // IPv6 is a compile flag that enables or disables support for IPv6 networks // and addresses. IPv6 = true )
Functions ¶
Types ¶
type ID ¶
type ID []byte
ID is an alias for a byte array that represents a 48 byte client identification number. This is used for tracking and detection purposes.
func IDFromString ¶
IDFromString attempts to convert the hex string supplied into an ID value.
func (ID) FullString ¶
FullString returns the full string representation of this ID instance.
func (ID) Hash ¶
Hash returns the 32bit hash sum of this ID value. The hash mechanism used is similar to the hash/fnv mechanism.
func (ID) MarshalStream ¶
MarshalStream writes the data of this ID to the supplied Writer.
type Interface ¶
type Interface struct { Name string `json:"name"` Address []net.IP `json:"address"` Hardware net.HardwareAddr `json:"mac"` }
Interface is a struct that represents a Network interface that is active on the host system.
func (Interface) MarshalStream ¶
MarshalStream writes the data of this Interface to the supplied Writer.
type Machine ¶
type Machine struct { ID ID `json:"id"` OS deviceOS `json:"os"` PID uint64 `json:"pid"` PPID uint64 `json:"ppid"` Arch deviceArch `json:"arch"` User string `json:"user"` Version string `json:"version"` Network Network `json:"network"` Hostname string `json:"hostname"` Elevated bool `json:"elevated"` }
Machine is a struct that contains information about a specific device. This struct contains generic Operating System Information such as Version, Arch and network information.
func (Machine) MarshalStream ¶
MarshalStream writes the data of this Machine from the supplied Writer.
type Network ¶
type Network []*Interface
Network is a basic listing of network interfaces. Used to store and refresh interface lists.
func (Network) MarshalStream ¶
MarshalStream writes the data of this Network to the supplied Writer.