Documentation ¶
Index ¶
- Constants
- func IsActive(n OsqueryNode, inactive int64) bool
- type ArchiveOsqueryNode
- type NodeHistoryHostname
- type NodeHistoryIPAddress
- type NodeHistoryLocalname
- type NodeHistoryUsername
- type NodeManager
- func (n *NodeManager) Archive(uuid, trigger string) error
- func (n *NodeManager) ArchiveDeleteByUUID(uuid string) error
- func (n *NodeManager) CarveRefresh(node OsqueryNode, lastIp string, incBytes int) error
- func (n *NodeManager) CarveRefreshByUUID(uuid, lastIp string, incBytes int) error
- func (n *NodeManager) CheckByHost(host string) bool
- func (n *NodeManager) CheckByKey(nodeKey string) bool
- func (n *NodeManager) CheckByUUID(uuid string) bool
- func (n *NodeManager) CheckByUUIDEnv(uuid, environment string) bool
- func (n *NodeManager) CheckByUUIDEnvID(uuid string, envID int) bool
- func (n *NodeManager) ConfigRefresh(node OsqueryNode, lastIp string, incBytes int) error
- func (n *NodeManager) Create(node *OsqueryNode) error
- func (n *NodeManager) GetAllPlatforms() ([]string, error)
- func (n *NodeManager) GetByEnv(environment, target string, hours int64) ([]OsqueryNode, error)
- func (n *NodeManager) GetByIdentifier(identifier string) (OsqueryNode, error)
- func (n *NodeManager) GetByKey(nodekey string) (OsqueryNode, error)
- func (n *NodeManager) GetByPlatform(platform, target string, hours int64) ([]OsqueryNode, error)
- func (n *NodeManager) GetBySelector(stype, selector, target string, hours int64) ([]OsqueryNode, error)
- func (n *NodeManager) GetByUUID(uuid string) (OsqueryNode, error)
- func (n *NodeManager) GetByUUIDEnv(uuid string, envid uint) (OsqueryNode, error)
- func (n *NodeManager) GetEnvPlatforms(environment string) ([]string, error)
- func (n *NodeManager) GetHistoryHostname(uuid, hostname string) (NodeHistoryHostname, error)
- func (n *NodeManager) GetHistoryIPAddress(uuid, ipaddress string) (NodeHistoryIPAddress, error)
- func (n *NodeManager) GetHistoryLocalname(uuid, localname string) (NodeHistoryLocalname, error)
- func (n *NodeManager) GetHistoryUsername(uuid, username string) (NodeHistoryUsername, error)
- func (n *NodeManager) GetMetadata(node OsqueryNode) NodeMetadata
- func (n *NodeManager) GetStatsByEnv(environment string, hours int64) (StatsData, error)
- func (n *NodeManager) GetStatsByPlatform(platform string, hours int64) (StatsData, error)
- func (n *NodeManager) Gets(target string, hours int64) ([]OsqueryNode, error)
- func (n *NodeManager) IncHistoryHostname(uuid, localname string) error
- func (n *NodeManager) IncHistoryIPAddress(uuid, ipaddress string) error
- func (n *NodeManager) IncHistoryLocalname(uuid, localname string) error
- func (n *NodeManager) IncHistoryUsername(uuid, username string) error
- func (n *NodeManager) IncreaseBytes(node OsqueryNode, incBytes int) error
- func (n *NodeManager) IncreaseBytesByKey(nodekey string, incBytes int) error
- func (n *NodeManager) IncreaseBytesByUUID(uuid string, incBytes int) error
- func (n *NodeManager) MetadataRefresh(node OsqueryNode, updates map[string]interface{}) error
- func (n *NodeManager) NewHistoryEntry(entry interface{}) error
- func (n *NodeManager) NewHistoryHostname(entry NodeHistoryHostname) error
- func (n *NodeManager) NewHistoryIPAddress(entry NodeHistoryIPAddress) error
- func (n *NodeManager) NewHistoryLocalname(entry NodeHistoryLocalname) error
- func (n *NodeManager) NewHistoryUsername(entry NodeHistoryUsername) error
- func (n *NodeManager) QueryReadRefresh(node OsqueryNode, lastIp string, incBytes int) error
- func (n *NodeManager) QueryWriteRefresh(node OsqueryNode, lastIp string, incBytes int) error
- func (n *NodeManager) RecordHostname(hostname string, node OsqueryNode) error
- func (n *NodeManager) RecordIPAddress(ipaddress string, node OsqueryNode) error
- func (n *NodeManager) RecordLocalname(localname string, node OsqueryNode) error
- func (n *NodeManager) RecordUsername(username string, node OsqueryNode) error
- func (n *NodeManager) RefreshLastConfig(nodeKey string) error
- func (n *NodeManager) RefreshLastEvent(node OsqueryNode, event string) error
- func (n *NodeManager) RefreshLastEventByKey(nodeKey, event string) error
- func (n *NodeManager) RefreshLastEventByUUID(uuid, event string) error
- func (n *NodeManager) RefreshLastQueryRead(nodeKey string) error
- func (n *NodeManager) RefreshLastQueryWrite(uuid string) error
- func (n *NodeManager) RefreshLastResult(uuid string) error
- func (n *NodeManager) RefreshLastStatus(uuid string) error
- func (n *NodeManager) SeenHostname(uuid, hostname string) bool
- func (n *NodeManager) SeenIPAddress(uuid, ipaddress string) bool
- func (n *NodeManager) SeenLocalname(uuid, localname string) bool
- func (n *NodeManager) SeenUsername(uuid, username string) bool
- func (n *NodeManager) UpdateByUUID(data OsqueryNode, uuid string) error
- func (n *NodeManager) UpdateIPAddress(ipaddress string, node OsqueryNode) error
- func (n *NodeManager) UpdateIPAddressByKey(ipaddress, nodekey string) error
- func (n *NodeManager) UpdateIPAddressByUUID(ipaddress, uuid string) error
- func (n *NodeManager) UpdateMetadataByUUID(uuid string, metadata NodeMetadata) error
- type NodeMetadata
- type OsqueryNode
- type StatsData
Constants ¶
const ( // ActiveNodes to represent active nodes ActiveNodes = "active" // InactiveNodes to represent inactive nodes InactiveNodes = "inactive" // AllNodes to represent all nodes AllNodes = "all" )
Variables ¶
This section is empty.
Functions ¶
func IsActive ¶
func IsActive(n OsqueryNode, inactive int64) bool
Helper to get what is the last seen time for a node
Types ¶
type ArchiveOsqueryNode ¶
type ArchiveOsqueryNode struct { gorm.Model NodeKey string `gorm:"index"` UUID string `gorm:"index"` Trigger string Platform string PlatformVersion string OsqueryVersion string Hostname string Localname string IPAddress string Username string OsqueryUser string Environment string CPU string Memory string HardwareSerial string ConfigHash string DaemonHash string BytesReceived int RawEnrollment string LastStatus time.Time LastResult time.Time LastConfig time.Time LastQueryRead time.Time LastQueryWrite time.Time UserID uint EnvironmentID uint ExtraData string }
ArchiveOsqueryNode as abstraction of an archived node
type NodeHistoryHostname ¶
NodeHistoryHostname to keep track of all IP Addresses for nodes
type NodeHistoryIPAddress ¶
type NodeHistoryIPAddress struct { gorm.Model UUID string `gorm:"index"` IPAddress string Count int }
NodeHistoryIPAddress to keep track of all IP Addresses for nodes
type NodeHistoryLocalname ¶
type NodeHistoryLocalname struct { gorm.Model UUID string `gorm:"index"` Localname string Count int }
NodeHistoryLocalname to keep track of all IP Addresses for nodes
type NodeHistoryUsername ¶
NodeHistoryUsername to keep track of all usernames for nodes
type NodeManager ¶
NodeManager to handle all nodes of the system
func CreateNodes ¶
func CreateNodes(backend *gorm.DB) *NodeManager
CreateNodes to initialize the nodes struct and its tables
func (*NodeManager) Archive ¶
func (n *NodeManager) Archive(uuid, trigger string) error
Archive to archive osquery node by UUID
func (*NodeManager) ArchiveDeleteByUUID ¶
func (n *NodeManager) ArchiveDeleteByUUID(uuid string) error
ArchiveDeleteByUUID to archive and delete an existing node record by UUID
func (*NodeManager) CarveRefresh ¶
func (n *NodeManager) CarveRefresh(node OsqueryNode, lastIp string, incBytes int) error
CarveRefresh to perform all needed update operations per node in a carve request
func (*NodeManager) CarveRefreshByUUID ¶
func (n *NodeManager) CarveRefreshByUUID(uuid, lastIp string, incBytes int) error
CarveRefreshByUUID to perform all needed update operations per node in a carve request
func (*NodeManager) CheckByHost ¶
func (n *NodeManager) CheckByHost(host string) bool
CheckByHost to check if node exists by Hostname
func (*NodeManager) CheckByKey ¶
func (n *NodeManager) CheckByKey(nodeKey string) bool
CheckByKey to check if node exists by node_key node_key is expected lowercase
func (*NodeManager) CheckByUUID ¶
func (n *NodeManager) CheckByUUID(uuid string) bool
CheckByUUID to check if node exists by UUID UUID is expected uppercase
func (*NodeManager) CheckByUUIDEnv ¶
func (n *NodeManager) CheckByUUIDEnv(uuid, environment string) bool
CheckByUUIDEnv to check if node exists by UUID in a specific environment UUID is expected uppercase
func (*NodeManager) CheckByUUIDEnvID ¶
func (n *NodeManager) CheckByUUIDEnvID(uuid string, envID int) bool
CheckByUUIDEnvID to check if node exists by UUID in a specific environment UUID is expected uppercase
func (*NodeManager) ConfigRefresh ¶
func (n *NodeManager) ConfigRefresh(node OsqueryNode, lastIp string, incBytes int) error
ConfigRefresh to perform all needed update operations per node in a config request
func (*NodeManager) Create ¶
func (n *NodeManager) Create(node *OsqueryNode) error
Create to insert new osquery node generating new node_key
func (*NodeManager) GetAllPlatforms ¶
func (n *NodeManager) GetAllPlatforms() ([]string, error)
GetAllPlatforms to get all different platform with nodes in them
func (*NodeManager) GetByEnv ¶
func (n *NodeManager) GetByEnv(environment, target string, hours int64) ([]OsqueryNode, error)
GetByEnv to retrieve target nodes by environment
func (*NodeManager) GetByIdentifier ¶
func (n *NodeManager) GetByIdentifier(identifier string) (OsqueryNode, error)
GetByIdentifier to retrieve full node object from DB, by uuid or hostname or localname UUID is expected uppercase
func (*NodeManager) GetByKey ¶
func (n *NodeManager) GetByKey(nodekey string) (OsqueryNode, error)
GetByKey to retrieve full node object from DB, by node_key node_key is expected lowercase
func (*NodeManager) GetByPlatform ¶
func (n *NodeManager) GetByPlatform(platform, target string, hours int64) ([]OsqueryNode, error)
GetByPlatform to retrieve target nodes by platform
func (*NodeManager) GetBySelector ¶
func (n *NodeManager) GetBySelector(stype, selector, target string, hours int64) ([]OsqueryNode, error)
GetBySelector to retrieve target nodes by selector
func (*NodeManager) GetByUUID ¶
func (n *NodeManager) GetByUUID(uuid string) (OsqueryNode, error)
GetByUUID to retrieve full node object from DB, by uuid UUID is expected uppercase
func (*NodeManager) GetByUUIDEnv ¶
func (n *NodeManager) GetByUUIDEnv(uuid string, envid uint) (OsqueryNode, error)
GetByUUIDEnv to retrieve full node object from DB, by uuid and environment ID UUID is expected uppercase
func (*NodeManager) GetEnvPlatforms ¶
func (n *NodeManager) GetEnvPlatforms(environment string) ([]string, error)
GetEnvPlatforms to get the platforms with nodes in them by environment
func (*NodeManager) GetHistoryHostname ¶
func (n *NodeManager) GetHistoryHostname(uuid, hostname string) (NodeHistoryHostname, error)
GetHistoryHostname to retrieve the History hostname record by UUID and the hostname
func (*NodeManager) GetHistoryIPAddress ¶
func (n *NodeManager) GetHistoryIPAddress(uuid, ipaddress string) (NodeHistoryIPAddress, error)
GetHistoryIPAddress to retrieve the History IP Address record by UUID and the IP Address
func (*NodeManager) GetHistoryLocalname ¶
func (n *NodeManager) GetHistoryLocalname(uuid, localname string) (NodeHistoryLocalname, error)
GetHistoryLocalname to retrieve the History localname record by UUID and the localname
func (*NodeManager) GetHistoryUsername ¶
func (n *NodeManager) GetHistoryUsername(uuid, username string) (NodeHistoryUsername, error)
GetHistoryUsername to retrieve the History username record by UUID and the username
func (*NodeManager) GetMetadata ¶
func (n *NodeManager) GetMetadata(node OsqueryNode) NodeMetadata
GetMetadata to extract the metadata struct from a node
func (*NodeManager) GetStatsByEnv ¶
func (n *NodeManager) GetStatsByEnv(environment string, hours int64) (StatsData, error)
GetStatsByEnv to populate table stats about nodes by environment. Active machine is < 3 days
func (*NodeManager) GetStatsByPlatform ¶
func (n *NodeManager) GetStatsByPlatform(platform string, hours int64) (StatsData, error)
GetStatsByPlatform to populate table stats about nodes by platform. Active machine is < 3 days
func (*NodeManager) Gets ¶
func (n *NodeManager) Gets(target string, hours int64) ([]OsqueryNode, error)
Gets to retrieve all/active/inactive nodes
func (*NodeManager) IncHistoryHostname ¶
func (n *NodeManager) IncHistoryHostname(uuid, localname string) error
IncHistoryHostname to increase the count for this hostname
func (*NodeManager) IncHistoryIPAddress ¶
func (n *NodeManager) IncHistoryIPAddress(uuid, ipaddress string) error
IncHistoryIPAddress to increase the count for this IP Address
func (*NodeManager) IncHistoryLocalname ¶
func (n *NodeManager) IncHistoryLocalname(uuid, localname string) error
IncHistoryLocalname to increase the count for this localname
func (*NodeManager) IncHistoryUsername ¶
func (n *NodeManager) IncHistoryUsername(uuid, username string) error
IncHistoryUsername to increase the count for this username
func (*NodeManager) IncreaseBytes ¶
func (n *NodeManager) IncreaseBytes(node OsqueryNode, incBytes int) error
IncreaseBytes to update received bytes per node
func (*NodeManager) IncreaseBytesByKey ¶
func (n *NodeManager) IncreaseBytesByKey(nodekey string, incBytes int) error
IncreaseBytesByKey to update received bytes by node_key
func (*NodeManager) IncreaseBytesByUUID ¶
func (n *NodeManager) IncreaseBytesByUUID(uuid string, incBytes int) error
IncreaseBytesByUUID to update received bytes by UUID
func (*NodeManager) MetadataRefresh ¶
func (n *NodeManager) MetadataRefresh(node OsqueryNode, updates map[string]interface{}) error
MetadataRefresh to perform all needed update operations per node to keep metadata refreshed
func (*NodeManager) NewHistoryEntry ¶
func (n *NodeManager) NewHistoryEntry(entry interface{}) error
NewHistoryEntry to insert new entry for the history of Hostnames
func (*NodeManager) NewHistoryHostname ¶
func (n *NodeManager) NewHistoryHostname(entry NodeHistoryHostname) error
NewHistoryHostname to insert new entry for the history of Hostnames
func (*NodeManager) NewHistoryIPAddress ¶
func (n *NodeManager) NewHistoryIPAddress(entry NodeHistoryIPAddress) error
NewHistoryIPAddress to insert new entry for the history of IP Addresses
func (*NodeManager) NewHistoryLocalname ¶
func (n *NodeManager) NewHistoryLocalname(entry NodeHistoryLocalname) error
NewHistoryLocalname to insert new entry for the history of Localnames
func (*NodeManager) NewHistoryUsername ¶
func (n *NodeManager) NewHistoryUsername(entry NodeHistoryUsername) error
NewHistoryUsername to insert new entry for the history of Usernames
func (*NodeManager) QueryReadRefresh ¶
func (n *NodeManager) QueryReadRefresh(node OsqueryNode, lastIp string, incBytes int) error
QueryReadRefresh to perform all needed update operations per node in a query read request
func (*NodeManager) QueryWriteRefresh ¶
func (n *NodeManager) QueryWriteRefresh(node OsqueryNode, lastIp string, incBytes int) error
QueryWriteRefresh to perform all needed update operations per node in a query write request
func (*NodeManager) RecordHostname ¶
func (n *NodeManager) RecordHostname(hostname string, node OsqueryNode) error
RecordHostname to update and archive the node hostname
func (*NodeManager) RecordIPAddress ¶
func (n *NodeManager) RecordIPAddress(ipaddress string, node OsqueryNode) error
RecordIPAddress to update and archive the node IP Address
func (*NodeManager) RecordLocalname ¶
func (n *NodeManager) RecordLocalname(localname string, node OsqueryNode) error
RecordLocalname to update and archive the node localname
func (*NodeManager) RecordUsername ¶
func (n *NodeManager) RecordUsername(username string, node OsqueryNode) error
RecordUsername to update and archive the node username
func (*NodeManager) RefreshLastConfig ¶
func (n *NodeManager) RefreshLastConfig(nodeKey string) error
RefreshLastConfig to refresh the last configuration for this node
func (*NodeManager) RefreshLastEvent ¶
func (n *NodeManager) RefreshLastEvent(node OsqueryNode, event string) error
RefreshLastEvent to refresh the last status log for this node
func (*NodeManager) RefreshLastEventByKey ¶
func (n *NodeManager) RefreshLastEventByKey(nodeKey, event string) error
RefreshLastEventByKey to refresh the last status log for this node
func (*NodeManager) RefreshLastEventByUUID ¶
func (n *NodeManager) RefreshLastEventByUUID(uuid, event string) error
RefreshLastEventByUUID to refresh the last status log for this node
func (*NodeManager) RefreshLastQueryRead ¶
func (n *NodeManager) RefreshLastQueryRead(nodeKey string) error
RefreshLastQueryRead to refresh the last on-demand query read for this node
func (*NodeManager) RefreshLastQueryWrite ¶
func (n *NodeManager) RefreshLastQueryWrite(uuid string) error
RefreshLastQueryWrite to refresh the last on-demand query write for this node
func (*NodeManager) RefreshLastResult ¶
func (n *NodeManager) RefreshLastResult(uuid string) error
RefreshLastResult to refresh the last result log for this node
func (*NodeManager) RefreshLastStatus ¶
func (n *NodeManager) RefreshLastStatus(uuid string) error
RefreshLastStatus to refresh the last status log for this node
func (*NodeManager) SeenHostname ¶
func (n *NodeManager) SeenHostname(uuid, hostname string) bool
SeenHostname to check if an hostname has been seen per node by UUID
func (*NodeManager) SeenIPAddress ¶
func (n *NodeManager) SeenIPAddress(uuid, ipaddress string) bool
SeenIPAddress to check if an IP Address has been seen per node by UUID
func (*NodeManager) SeenLocalname ¶
func (n *NodeManager) SeenLocalname(uuid, localname string) bool
SeenLocalname to check if an localname has been seen per node by UUID
func (*NodeManager) SeenUsername ¶
func (n *NodeManager) SeenUsername(uuid, username string) bool
SeenUsername to check if an username has been seen per node by UUID
func (*NodeManager) UpdateByUUID ¶
func (n *NodeManager) UpdateByUUID(data OsqueryNode, uuid string) error
UpdateByUUID to update an existing node record by UUID
func (*NodeManager) UpdateIPAddress ¶
func (n *NodeManager) UpdateIPAddress(ipaddress string, node OsqueryNode) error
UpdateIPAddress to update the node IP Address
func (*NodeManager) UpdateIPAddressByKey ¶
func (n *NodeManager) UpdateIPAddressByKey(ipaddress, nodekey string) error
UpdateIPAddressByKey to update node IP Address by node_key
func (*NodeManager) UpdateIPAddressByUUID ¶
func (n *NodeManager) UpdateIPAddressByUUID(ipaddress, uuid string) error
UpdateIPAddressByUUID to update node IP Address by UUID
func (*NodeManager) UpdateMetadataByUUID ¶
func (n *NodeManager) UpdateMetadataByUUID(uuid string, metadata NodeMetadata) error
UpdateMetadataByUUID to update node metadata by UUID
type NodeMetadata ¶
type NodeMetadata struct { IPAddress string Username string OsqueryUser string Hostname string Localname string ConfigHash string DaemonHash string OsqueryVersion string Platform string PlatformVersion string BytesReceived int }
NodeMetadata to hold metadata for a node
type OsqueryNode ¶
type OsqueryNode struct { gorm.Model NodeKey string `gorm:"index"` UUID string `gorm:"index"` Platform string PlatformVersion string OsqueryVersion string Hostname string Localname string IPAddress string Username string OsqueryUser string Environment string CPU string Memory string HardwareSerial string DaemonHash string ConfigHash string BytesReceived int RawEnrollment string LastStatus time.Time LastResult time.Time LastConfig time.Time LastQueryRead time.Time LastQueryWrite time.Time UserID uint EnvironmentID uint ExtraData string }
OsqueryNode as abstraction of a node