Documentation
¶
Overview ¶
Package targetos identifies the operating system of the image being collected from, so that artifacts declaring supported_os can be filtered.
UAC answers this with `uname -s`, which reports the *examiner's* system. That is correct on a live collection and wrong on a mounted image, which is why UAC makes you pass -s offline. Here the image is inspected for marker files instead, and the host is used only when collecting from / itself. An explicit flag still overrides everything.
Index ¶
Constants ¶
This section is empty.
Variables ¶
All lists every value an artifact may name, for flag validation and help.
Functions ¶
Types ¶
type InvalidOSError ¶
type InvalidOSError struct{ Name string }
InvalidOSError reports an unusable -s value.
func (*InvalidOSError) Error ¶
func (e *InvalidOSError) Error() string
type OS ¶
type OS string
OS is one of the operating system names UAC's artifacts use in supported_os.
func Detect ¶
Detect identifies the operating system of the tree at root, returning the marker that decided it. An empty OS means nothing matched, which is common for a partial image or an arbitrary directory.
Markers are checked with containment: a symlink pointing out of the image must not count as evidence that the image is anything, or a hostile image could steer the whole artifact selection by planting one.
func DetectFS ¶
DetectFS is Detect over any filesystem, which is what makes it testable without building a fake image on disk.
func Host ¶
func Host() OS
Host reports the operating system uacscan is running on, named the way UAC's artifacts do.
func Resolve ¶
Resolve decides which operating system to filter artifacts against and explains how it got there, because that decision changes what is collected and belongs in the run log.
An explicit override always wins. Collecting from / means the host is the image. Otherwise the image is inspected, and if that is inconclusive the result is Unknown -- never the examiner's own operating system.
Assuming the host would be actively harmful: a partial macOS image examined on a Linux workstation would have every macOS artifact filtered out, and the collection would look complete. Unknown disables the filter instead, so an unidentified image is over-collected rather than silently under-collected.