models

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2017 License: GPL-3.0 Imports: 6 Imported by: 74

Documentation

Index

Constants

View Source
const (
	// CpeNameMatchStr is a String representation of CpeNameMatch
	CpeNameMatchStr = "CpeNameMatch"

	// YumUpdateSecurityMatchStr is a String representation of YumUpdateSecurityMatch
	YumUpdateSecurityMatchStr = "YumUpdateSecurityMatch"

	// PkgAuditMatchStr is a String representation of PkgAuditMatch
	PkgAuditMatchStr = "PkgAuditMatch"

	// ChangelogExactMatchStr is a String representation of ChangelogExactMatch
	ChangelogExactMatchStr = "ChangelogExactMatch"

	// ChangelogLenientMatchStr is a String representation of ChangelogLenientMatch
	ChangelogLenientMatchStr = "ChangelogLenientMatch"

	// FailedToGetChangelog is a String representation of FailedToGetChangelog
	FailedToGetChangelog = "FailedToGetChangelog"

	// FailedToFindVersionInChangelog is a String representation of FailedToFindVersionInChangelog
	FailedToFindVersionInChangelog = "FailedToFindVersionInChangelog"
)

Variables

View Source
var ChangelogExactMatch = Confidence{95, ChangelogExactMatchStr}

ChangelogExactMatch is a ranking how confident the CVE-ID was deteted correctly

View Source
var ChangelogLenientMatch = Confidence{50, ChangelogLenientMatchStr}

ChangelogLenientMatch is a ranking how confident the CVE-ID was deteted correctly

View Source
var CpeNameMatch = Confidence{100, CpeNameMatchStr}

CpeNameMatch is a ranking how confident the CVE-ID was deteted correctly

View Source
var PkgAuditMatch = Confidence{100, PkgAuditMatchStr}

PkgAuditMatch is a ranking how confident the CVE-ID was deteted correctly

View Source
var YumUpdateSecurityMatch = Confidence{100, YumUpdateSecurityMatchStr}

YumUpdateSecurityMatch is a ranking how confident the CVE-ID was deteted correctly

Functions

This section is empty.

Types

type Changelog added in v0.3.0

type Changelog struct {
	Contents string
	Method   string
}

Changelog has contents of changelog and how to get it. Method: modesl.detectionMethodStr

type Confidence added in v0.3.0

type Confidence struct {
	Score           int
	DetectionMethod string
}

Confidence is a ranking how confident the CVE-ID was deteted correctly Score: 0 - 100

func (Confidence) String added in v0.3.0

func (c Confidence) String() string

type Container added in v0.1.4

type Container struct {
	ContainerID string
	Name        string
	Image       string
	Type        string
}

Container has Container information

type CveInfo

type CveInfo struct {
	CveDetail cve.CveDetail
	VulnInfo
}

CveInfo has Cve Information.

func (*CveInfo) NilSliceToEmpty added in v0.3.0

func (c *CveInfo) NilSliceToEmpty()

NilSliceToEmpty set nil slice fields to empty slice to avoid null in JSON

type CveInfos

type CveInfos []CveInfo

CveInfos is for sorting

func (CveInfos) Len

func (c CveInfos) Len() int

func (CveInfos) Less

func (c CveInfos) Less(i, j int) bool

func (CveInfos) Swap

func (c CveInfos) Swap(i, j int)

type DistroAdvisory

type DistroAdvisory struct {
	AdvisoryID string
	Severity   string
	Issued     time.Time
	Updated    time.Time
}

DistroAdvisory has Amazon Linux, RHEL, FreeBSD Security Advisory information.

type NWLink struct {
	IPAddress string
	Netmask   string
	DevName   string
	LinkState string
}

NWLink has network link information.

type PackageInfo

type PackageInfo struct {
	Name       string
	Version    string
	Release    string
	NewVersion string
	NewRelease string
	Repository string
	Changelog  Changelog
}

PackageInfo has installed packages.

func (PackageInfo) ToStringCurrentVersion

func (p PackageInfo) ToStringCurrentVersion() string

ToStringCurrentVersion returns package name-version-release

func (PackageInfo) ToStringNewVersion

func (p PackageInfo) ToStringNewVersion() string

ToStringNewVersion returns package name-version-release

type PackageInfoList

type PackageInfoList []PackageInfo

PackageInfoList is slice of PackageInfo

func (PackageInfoList) Exists

func (ps PackageInfoList) Exists(name string) bool

Exists returns true if exists the name

func (PackageInfoList) FindByName

func (ps PackageInfoList) FindByName(name string) (result PackageInfo, found bool)

FindByName search PackageInfo by name

func (PackageInfoList) FormatUpdatablePacksSummary added in v0.3.0

func (ps PackageInfoList) FormatUpdatablePacksSummary() string

FormatUpdatablePacksSummary returns a summary of updatable packages

func (PackageInfoList) MergeNewVersion added in v0.2.0

func (ps PackageInfoList) MergeNewVersion(as PackageInfoList)

MergeNewVersion merges candidate version information to the receiver struct

func (PackageInfoList) UniqByName

func (ps PackageInfoList) UniqByName() (distincted PackageInfoList)

UniqByName be uniq by name.

type PackageInfosByName added in v0.2.0

type PackageInfosByName []PackageInfo

PackageInfosByName implements sort.Interface for []PackageInfo based on the Name field.

func (PackageInfosByName) Len added in v0.2.0

func (a PackageInfosByName) Len() int

func (PackageInfosByName) Less added in v0.2.0

func (a PackageInfosByName) Less(i, j int) bool

func (PackageInfosByName) Swap added in v0.2.0

func (a PackageInfosByName) Swap(i, j int)

type Platform added in v0.1.5

type Platform struct {
	Name       string // aws or azure or gcp or other...
	InstanceID string
}

Platform has platform information

type ScanHistory

type ScanHistory struct {
	ScanResults ScanResults
}

ScanHistory is the history of Scanning.

type ScanResult

type ScanResult struct {
	ScannedAt time.Time

	Lang       string
	ServerName string // TOML Section key
	Family     string
	Release    string
	Container  Container
	Platform   Platform

	// Scanned Vulns via SSH + CPE Vulns
	ScannedCves []VulnInfo

	KnownCves   []CveInfo
	UnknownCves []CveInfo
	IgnoredCves []CveInfo

	Packages PackageInfoList

	Errors   []string
	Optional [][]interface{}
}

ScanResult has the result of scanned CVE information.

func (ScanResult) AllCves added in v0.1.7

func (r ScanResult) AllCves() []CveInfo

AllCves returns Known and Unknown CVEs

func (ScanResult) CveSummary

func (r ScanResult) CveSummary() string

CveSummary summarize the number of CVEs group by CVSSv2 Severity

func (ScanResult) FillCveDetail added in v0.2.0

func (r ScanResult) FillCveDetail() (*ScanResult, error)

FillCveDetail fetches CVE detailed information from CVE Database, and then set to fields.

func (ScanResult) FilterByCvssOver added in v0.2.0

func (r ScanResult) FilterByCvssOver() ScanResult

FilterByCvssOver is filter function.

func (ScanResult) FormatServerName added in v0.3.0

func (r ScanResult) FormatServerName() string

FormatServerName returns server and container name

func (ScanResult) ReportFileName added in v0.2.0

func (r ScanResult) ReportFileName() (name string)

ReportFileName returns the filename on localhost without extention

func (ScanResult) ReportKeyName added in v0.2.0

func (r ScanResult) ReportKeyName() (name string)

ReportKeyName returns the name of key on S3, Azure-Blob without extention

func (ScanResult) ServerInfo added in v0.1.4

func (r ScanResult) ServerInfo() string

ServerInfo returns server name one line

func (ScanResult) ServerInfoTui added in v0.1.4

func (r ScanResult) ServerInfoTui() string

ServerInfoTui returns server infromation for TUI sidebar

type ScanResults

type ScanResults []ScanResult

ScanResults is slice of ScanResult.

func (ScanResults) Len added in v0.1.4

func (s ScanResults) Len() int

Len implement Sort Interface

func (ScanResults) Less added in v0.1.4

func (s ScanResults) Less(i, j int) bool

Less implement Sort Interface

func (ScanResults) Swap added in v0.1.4

func (s ScanResults) Swap(i, j int)

Swap implement Sort Interface

type VulnInfo added in v0.2.0

type VulnInfo struct {
	CveID            string
	Confidence       Confidence
	Packages         PackageInfoList
	DistroAdvisories []DistroAdvisory // for Aamazon, RHEL, FreeBSD
	CpeNames         []string
}

VulnInfo holds a vulnerability information and unsecure packages

func (*VulnInfo) NilSliceToEmpty added in v0.3.0

func (v *VulnInfo) NilSliceToEmpty()

NilSliceToEmpty set nil slice fields to empty slice to avoid null in JSON

type VulnInfos added in v0.2.0

type VulnInfos []VulnInfo

VulnInfos is VulnInfo list, getter/setter, sortable methods.

func (VulnInfos) FindByCveID added in v0.2.0

func (s VulnInfos) FindByCveID(cveID string) (VulnInfo, bool)

FindByCveID find by CVEID

func (VulnInfos) Len added in v0.2.0

func (s VulnInfos) Len() int

Len implement Sort Interface

func (VulnInfos) Less added in v0.2.0

func (s VulnInfos) Less(i, j int) bool

Less implement Sort Interface

func (VulnInfos) Swap added in v0.2.0

func (s VulnInfos) Swap(i, j int)

Swap implement Sort Interface

Jump to

Keyboard shortcuts

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