Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeWindowsOS ¶ added in v1.5.2
NormalizeWindowsOS converts the raw Win32_OperatingSystem Caption (and the numeric BuildNumber) into the OS identifier expected by the Vulners audit API (e.g. "Windows 10", "Windows 11", "Windows Server 2022").
Returns "Windows" when the caption cannot be confidently mapped so that the caller surfaces the API's rejection rather than silently miscategorizing.
func ParseWindowsSoftware ¶ added in v1.5.2
func ParseWindowsSoftware(lines []string) []vulners.WinAuditItem
ParseWindowsSoftware converts "name\tversion" lines (tab-separated by the PowerShell collector) into WinAuditItem values. Lines without a tab are treated as name-only with an empty version.
Types ¶
type Executor ¶
type Executor interface {
// Execute runs a command and returns its standard output as a string.
// It should return an error if the command fails to execute or exits with a non-zero status.
Execute(ctx context.Context, cmd string) (string, error)
// Close cleans up any resources associated with the executor.
Close() error
}
Executor defines an interface for running commands on a target host.
func NewExecutorFromURI ¶
NewExecutorFromURI creates a new Executor based on the provided target URI and options.
type ExecutorOptions ¶
type ExecutorOptions struct {
IdentityFile string
PasswordEnv string
AskPass bool
Insecure bool
Timeout time.Duration
}
ExecutorOptions holds configuration for creating an Executor.
type LocalExecutor ¶
type LocalExecutor struct{}
LocalExecutor executes commands on the local machine.
func NewLocalExecutor ¶
func NewLocalExecutor() *LocalExecutor
NewLocalExecutor returns a new LocalExecutor.
func (*LocalExecutor) Close ¶
func (e *LocalExecutor) Close() error
Close is a no-op for LocalExecutor.
type OSInfo ¶
type OSInfo struct {
Family OSFamily
Distro string // For Linux: ID from os-release
Version string // Linux: VERSION_ID from os-release; Windows: full version (e.g. "10.0.19045")
OSName string // For Windows: Caption (raw, e.g. "Microsoft Windows 10 Pro")
// BuildNumber is the Windows build segment used to disambiguate Windows 10
// vs Windows 11 (captions report "Windows 10" for both).
BuildNumber string
}
OSInfo holds the fingerprinted operating system data.
type SSHExecutor ¶
type SSHExecutor struct {
// contains filtered or unexported fields
}
SSHExecutor executes commands on a remote host via SSH.
func NewSSHExecutor ¶
func NewSSHExecutor(opts SSHOptions) (*SSHExecutor, error)
NewSSHExecutor connects to an SSH server and returns an SSHExecutor.
func (*SSHExecutor) Close ¶
func (e *SSHExecutor) Close() error
Close closes the underlying SSH connection.
type SSHOptions ¶
type SSHOptions struct {
Host string
Port string
User string
IdentityFile string
Password string //nolint:gosec // false positive for struct field name
Insecure bool
Timeout time.Duration
}
SSHOptions holds the configuration for an SSH connection.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner performs host inventory scanning.
func NewScanner ¶
NewScanner creates a new Scanner using the provided Executor. A nil logger discards diagnostic output.
func (*Scanner) DetectOS ¶
DetectOS attempts to determine the target's operating system using the executor.
func (*Scanner) GatherPackages ¶
GatherPackages retrieves the list of installed Linux packages for the detected OS family. Use GatherWindows for Windows hosts.
func (*Scanner) GatherWindows ¶ added in v1.5.2
func (s *Scanner) GatherWindows(ctx context.Context, _ *OSInfo) ([]string, []vulners.WinAuditItem, error)
GatherWindows retrieves installed KBs and software inventory from a Windows host. Software is collected via Get-Package first, falling back to the Uninstall registry keys when Get-Package returns nothing or fails.
type WinRMExecutor ¶
type WinRMExecutor struct {
// contains filtered or unexported fields
}
WinRMExecutor executes commands on a remote Windows host via WinRM.
func NewWinRMExecutor ¶
func NewWinRMExecutor(opts WinRMOptions) (*WinRMExecutor, error)
NewWinRMExecutor connects to a WinRM endpoint and returns a WinRMExecutor.
func (*WinRMExecutor) Close ¶
func (e *WinRMExecutor) Close() error
Close is a no-op for WinRMExecutor as the client does not maintain an active TCP connection pool.