models

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2016 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container added in v0.1.4

type Container struct {
	gorm.Model   `json:"-"`
	ScanResultID uint `json:"-"`

	ContainerID string
	Name        string
}

Container has Container information

type CpeName

type CpeName struct {
	gorm.Model `json:"-"`
	CveInfoID  uint `json:"-"`

	Name string
}

CpeName has CPE name

type CveInfo

type CveInfo struct {
	gorm.Model   `json:"-"`
	ScanResultID uint `json:"-"`

	CveDetail        cve.CveDetail
	Packages         []PackageInfo
	DistroAdvisories []DistroAdvisory
	CpeNames         []CpeName
}

CveInfo has Cve Information.

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 {
	gorm.Model `json:"-"`
	CveInfoID  uint `json:"-"`

	AdvisoryID string
	Severity   string
	Issued     time.Time
	Updated    time.Time
}

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

type NWLink struct {
	gorm.Model   `json:"-"`
	ScanResultID uint `json:"-"`

	IPAddress string
	Netmask   string
	DevName   string
	LinkState string
}

NWLink has network link information.

type PackageInfo

type PackageInfo struct {
	gorm.Model `json:"-"`
	CveInfoID  uint `json:"-"`

	Name    string
	Version string
	Release string

	NewVersion string
	NewRelease string
}

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) UniqByName

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

UniqByName be uniq by name.

type Platform added in v0.1.5

type Platform struct {
	gorm.Model   `json:"-"`
	ScanResultID uint `json:"-"`

	Name       string // aws or azure or gcp or other...
	InstanceID string
}

Platform has platform information

type ScanHistory

type ScanHistory struct {
	gorm.Model
	ScanResults ScanResults
	ScannedAt   time.Time
}

ScanHistory is the history of Scanning.

type ScanResult

type ScanResult struct {
	gorm.Model    `json:"-"`
	ScanHistoryID uint `json:"-"`
	ScannedAt     time.Time

	ServerName string // TOML Section key
	//  Hostname    string
	Family  string
	Release string

	Container Container

	Platform Platform

	//  Fqdn        string
	//  NWLinks     []NWLink
	KnownCves   []CveInfo
	UnknownCves []CveInfo

	Optional [][]interface{} `gorm:"-"`
}

ScanResult has the result of scanned CVE information.

func (ScanResult) CveSummary

func (r ScanResult) CveSummary() string

CveSummary summarize the number of CVEs group by CVSSv2 Severity

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) FilterByCvssOver

func (s ScanResults) FilterByCvssOver() (filtered ScanResults)

FilterByCvssOver is filter function.

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

Jump to

Keyboard shortcuts

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