host

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHost

func AddHost(host sirius.Host) error

AddHost Chain: SDK Consumer (e.g. Sirius REST API) -> SDK go-api sirius/host (Here)

func AddHostWithSource added in v0.0.6

func AddHostWithSource(host sirius.Host, source models.ScanSource) error

AddHostWithSource adds or updates a host with source attribution

func AddHostWithSourceAndJSONB added in v0.0.6

func AddHostWithSourceAndJSONB(host sirius.Host, source models.ScanSource,
	softwareInventory, systemFingerprint, agentMetadata map[string]interface{}) error

AddHostWithSourceAndJSONB adds or updates a host with source attribution and JSONB data

func DeleteHost

func DeleteHost(ip string) error

DeleteHost handles the POST /host/delete route DeleteHost Chain: SDK Consumer (e.g. Sirius REST API) -> SDK go-api sirius/host (Here)

func DetermineSourceFromContext added in v0.0.6

func DetermineSourceFromContext(userAgent, referer, ipAddress string) models.ScanSource

DetermineSourceFromContext attempts to determine scan source from various context clues

func GetAllHosts

func GetAllHosts() ([]sirius.Host, error)

func GetHost

func GetHost(ip string) (sirius.Host, error)

func GetHostWithSources added in v0.0.6

func GetHostWithSources(ip string) (models.HostWithSources, error)

GetHostWithSources retrieves a host with all source-attributed data

func GetSourceCoverageStats added in v0.0.6

func GetSourceCoverageStats() ([]models.SourceCoverageStats, error)

GetSourceCoverageStats gets statistics about scan source coverage

func GetVulnerabilityHistory added in v0.0.6

func GetVulnerabilityHistory(hostID uint, vulnID uint) ([]models.SourceAttribution, error)

GetVulnerabilityHistory gets the source history for a specific vulnerability on a host

func GetVulnerabilitySources added in v0.0.6

func GetVulnerabilitySources(vulnID string) ([]models.VulnerabilitySourceInfo, error)

GetVulnerabilitySources gets all sources that have reported a specific vulnerability

func MapDBHostToSiriusHost

func MapDBHostToSiriusHost(dbHost models.Host) sirius.Host

Update to match ToDBHost

func MapSiriusHostToDBHost

func MapSiriusHostToDBHost(siriusHost sirius.Host) models.Host

func UpdatePortsWithSource added in v0.0.6

func UpdatePortsWithSource(hostID uint, ports []models.Port, source models.ScanSource) error

UpdatePortsWithSource updates port associations with source attribution

func UpdateVulnerabilitiesWithSource added in v0.0.6

func UpdateVulnerabilitiesWithSource(hostID uint, vulnerabilities []models.Vulnerability, source models.ScanSource) error

UpdateVulnerabilitiesWithSource updates vulnerability associations with source attribution

Types

type EnhancedHostData added in v0.0.6

type EnhancedHostData struct {
	Host              sirius.Host            `json:"host"`
	SoftwareInventory map[string]interface{} `json:"software_inventory,omitempty"`
	SystemFingerprint map[string]interface{} `json:"system_fingerprint,omitempty"`
	AgentMetadata     map[string]interface{} `json:"agent_metadata,omitempty"`
}

EnhancedHostData represents host data with JSONB fields

func GetHostWithEnhancedData added in v0.0.6

func GetHostWithEnhancedData(ip string, includeFields []string) (*EnhancedHostData, error)

GetHostWithEnhancedData retrieves host information including JSONB fields

type HostRiskStats

type HostRiskStats struct {
	VulnerabilityCount int                             `json:"vulnerabilityCount" gorm:"column:vulnerability_count"`
	TotalRiskScore     float64                         `json:"totalRiskScore" gorm:"column:total_risk_score"`
	AverageRiskScore   float64                         `json:"averageRiskScore" gorm:"column:average_risk_score"`
	HostSeverityCounts HostVulnerabilitySeverityCounts `json:"hostSeverityCounts" gorm:"-"`
	SoftwareStats      *SoftwareStatistics             `json:"softwareStats,omitempty" gorm:"-"`
	LastUpdated        string                          `json:"lastUpdated,omitempty" gorm:"-"`
}

HostRiskStats holds aggregated risk score statistics for vulnerabilities on a host.

func GetHostRiskStatistics

func GetHostRiskStatistics(ip string) (HostRiskStats, error)

GetHostRiskStatistics returns aggregated risk statistics for vulnerabilities on a given host identified by its IP.

type HostVulnerabilitySeverityCounts

type HostVulnerabilitySeverityCounts struct {
	Critical      int `json:"critical"`
	High          int `json:"high"`
	Medium        int `json:"medium"`
	Low           int `json:"low"`
	Informational int `json:"informational"`
}

HostVulnerabilitySeverityCounts holds the count of vulnerabilities by severity for a given host.

func GetHostVulnerabilitySeverityCounts

func GetHostVulnerabilitySeverityCounts(ip string) (HostVulnerabilitySeverityCounts, error)

GetHostVulnerabilitySeverityCounts retrieves vulnerability severity counts for a host identified by its IP.

type SoftwareInventoryData added in v0.0.6

type SoftwareInventoryData struct {
	Packages     []map[string]interface{} `json:"packages"`
	PackageCount int                      `json:"package_count"`
	CollectedAt  string                   `json:"collected_at"`
	Source       string                   `json:"source"`
	Statistics   map[string]interface{}   `json:"statistics,omitempty"`
}

SoftwareInventoryData represents structured software inventory information

func GetHostSoftwareInventory added in v0.0.6

func GetHostSoftwareInventory(ip string) (*SoftwareInventoryData, error)

GetHostSoftwareInventory retrieves only software inventory data for a host

type SoftwareStatistics added in v0.0.6

type SoftwareStatistics struct {
	TotalPackages    int            `json:"total_packages"`
	Architectures    map[string]int `json:"architectures"`
	Publishers       map[string]int `json:"publishers"`
	LastUpdated      string         `json:"last_updated"`
	PackagesBySource map[string]int `json:"packages_by_source,omitempty"`
}

SoftwareStatistics represents aggregated software inventory statistics

func GetHostSoftwareStatistics added in v0.0.6

func GetHostSoftwareStatistics(ip string) (*SoftwareStatistics, error)

GetHostSoftwareStatistics retrieves aggregated software statistics for a host

type SystemFingerprintData added in v0.0.6

type SystemFingerprintData struct {
	Fingerprint          map[string]interface{} `json:"fingerprint"`
	CollectedAt          string                 `json:"collected_at"`
	Source               string                 `json:"source"`
	Platform             string                 `json:"platform"`
	CollectionDurationMs int64                  `json:"collection_duration_ms"`
	Summary              map[string]interface{} `json:"summary,omitempty"`
}

SystemFingerprintData represents structured system fingerprint information

func GetHostSystemFingerprint added in v0.0.6

func GetHostSystemFingerprint(ip string) (*SystemFingerprintData, error)

GetHostSystemFingerprint retrieves only system fingerprint data for a host

type VulnerabilitySummary

type VulnerabilitySummary struct {
	VID         string  `json:"vid"`
	Title       string  `json:"title"`
	HostCount   int     `json:"hostCount"`
	Description string  `json:"description"`
	RiskScore   float64 `json:"riskScore"`
}

VulnerabilitySummary represents a vulnerability with its associated host count

func GetAllVulnerabilities

func GetAllVulnerabilities() ([]VulnerabilitySummary, error)

GetAllVulnerabilities host/vulnerabilities SDK

Jump to

Keyboard shortcuts

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