Documentation
¶
Index ¶
- Constants
- Variables
- func CheckExpandedDb(path string, checkHash bool) (float64, string, bool, bool, error)
- func GetDbVersion(path string) (float64, string, error)
- func LoadAppVulsTb(path string) (map[string][]AppModuleVul, error)
- func LoadCveDb(path, desPath string) (string, string, bool, bool, error)
- func LoadFullVulnerabilities(path, osname string) (map[string]VulFull, error)
- func LoadRawFile(path, name string) ([]byte, error)
- func ReadCveDbMeta(path string, hasAlpine, hasAmazon bool, output bool) (map[string]*share.ScanVulnerability, error)
- type AppModuleVersion
- type AppModuleVul
- type DBFile
- type FeaFull
- type FeaShort
- type KeyVersion
- type NVDMetadata
- type NVDmetadataCVSS
- type NVDvulnerableVersion
- type Priority
- type Version
- type VulFull
- type VulShort
Constants ¶
const RHELCpeMapFile = "rhel-cpe.map"
Variables ¶
var ( // ErrFilesystem occurs when a filesystem interaction fails. ErrFilesystem = errors.New("something went wrong when interacting with the fs") // ErrCouldNotDownload occurs when a download fails. ErrCouldNotDownload = errors.New("could not download requested resource") // ErrNotFound occurs when a resource could not be found. ErrNotFound = errors.New("the resource cannot be found") // ErrCouldNotParse is returned when a fetcher fails to parse the update data. ErrCouldNotParse = errors.New("updater/fetchers: could not parse") )
var ( // MinVersion is a special package version which is always sorted first MinVersion = Version{/* contains filtered or unexported fields */} // MaxVersion is a special package version which is always sorted last MaxVersion = Version{/* contains filtered or unexported fields */} )
var DebianReleasesMapping = map[string]string{
"squeeze": "6",
"wheezy": "7",
"jessie": "8",
"stretch": "9",
"buster": "10",
"bullseye": "11",
"sid": "unstable",
"oldoldstable": "7",
"oldstable": "8",
"stable": "9",
"testing": "10",
"unstable": "unstable",
}
var Priorities = []Priority{Unknown, Negligible, Low, Medium, High, Critical, Defcon1}
var UbuntuReleasesMapping = map[string]string{
"upstream": "upstream",
"precise": "12.04",
"precise/esm": "12.04",
"quantal": "12.10",
"raring": "13.04",
"trusty": "14.04",
"trusty/esm": "14.04",
"utopic": "14.10",
"vivid": "15.04",
"wily": "15.10",
"xenial": "16.04",
"esm-infra/xenial": "16.04",
"yakkety": "16.10",
"zesty": "17.04",
"artful": "17.10",
"bionic": "18.04",
"cosmic": "18.10",
"disco": "19.04",
"eoan": "19.10",
"focal": "20.04",
"groovy": "20.10",
"hirsute": "21.04",
"impish": "21.10",
}
UbuntuReleasesMapping translates Ubuntu code names to version numbers
Functions ¶
func CheckExpandedDb ¶
func LoadAppVulsTb ¶
func LoadAppVulsTb(path string) (map[string][]AppModuleVul, error)
func LoadFullVulnerabilities ¶
func LoadRawFile ¶
func ReadCveDbMeta ¶
Types ¶
type AppModuleVersion ¶
type AppModuleVul ¶
type AppModuleVul struct { VulName string `json:"VN"` ModuleName string `json:"MN"` Description string `json:"D"` Link string `json:"L"` Score float64 `json:"SC"` Vectors string `json:"VV2"` ScoreV3 float64 `json:"SC3"` VectorsV3 string `json:"VV3"` Severity string `json:"SE"` AffectedVer []AppModuleVersion `json:"AV"` FixedVer []AppModuleVersion `json:"FV"` UnaffectedVer []AppModuleVersion `json:"UV",omitempty` IssuedDate time.Time `json:"Issue"` LastModDate time.Time `json:"LastMod"` CVEs []string `json:"-"` }
type DBFile ¶
type DBFile struct { Filename string Key KeyVersion Files []utils.TarFileInfo }
type KeyVersion ¶
type NVDMetadata ¶
type NVDMetadata struct { Description string `json:"description,omitempty"` CVSSv2 NVDmetadataCVSS CVSSv3 NVDmetadataCVSS VulnVersions []NVDvulnerableVersion PublishedDate time.Time LastModifiedDate time.Time }
type NVDmetadataCVSS ¶
type NVDvulnerableVersion ¶
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
Version represents a package version
func NewVersion ¶
NewVersion function parses a string into a Version struct which can be compared
The implementation is based on http://man.he.net/man5/deb-version on https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
It uses the dpkg-1.17.25's algorithm (lib/parsehelp.c)
func NewVersionUnsafe ¶
NewVersionUnsafe is just a wrapper around NewVersion that ignore potentiel parsing error. Useful for test purposes
func (Version) Compare ¶
Compare function compares two Debian-like package version
The implementation is based on http://man.he.net/man5/deb-version on https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
It uses the dpkg-1.17.25's algorithm (lib/version.c)
func (Version) MarshalJSON ¶
func (*Version) UnmarshalJSON ¶
type VulFull ¶
type VulFull struct { Name string `json:"N"` Namespace string `json:"NS"` Description string `json:"D"` Link string `json:"L"` Severity string `json:"S"` Metadata map[string]NVDMetadata `json:"M"` FixedBy string `json:"FB"` FixedIn []FeaFull `json:"FI"` CPEs []string `json:"CPE,omitempty"` CVEs []string `json:"CVE,omitempty"` FeedRating string `json:"RATE,omitempty"` }