models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cpe

type Cpe struct {
	gorm.Model
	JvnID uint
	NvdID uint

	// CPE Name (URL sytle)
	// JVN ... cpe:/a:oracle:mysql
	// NVD ... cpe:/a:cisco:unified_contact_center_express:11.0%281%29
	CpeName string

	// each items
	Part     string
	Vendor   string
	Product  string
	Version  string
	Update   string
	Edition  string
	Language string
}

Cpe is Child model of Jvn/Nvd. see https://www.ipa.go.jp/security/vuln/CPE.html

type CveDetail

type CveDetail struct {
	gorm.Model
	CveInfoID uint // Foreign key

	CveID string
	Nvd   Nvd
	Jvn   Jvn
}

CveDetail is a parent of Jnv/Nvd model

func (CveDetail) CvssScore

func (c CveDetail) CvssScore(lang string) float64

CvssScore returns CVSS Score of the CVE

func (c CveDetail) CvssV2CalculatorLink(lang string) string

CvssV2CalculatorLink returns cvss Caluculate site URL. https://nvd.nist.gov/cvss/v2-calculator?name=CVE-2015-5477&vector=(AV:N/AC:L/Au:N/C:N/I:N/A:C)

type CveDetails

type CveDetails []CveDetail

CveDetails is for sorting

func (CveDetails) Len

func (c CveDetails) Len() int

func (CveDetails) Less

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

func (CveDetails) Swap

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

type CveDictionary

type CveDictionary interface {
	GetID() uint
	GetCveDetailID() uint
	SetCveDetailID(id uint)
	CveTitle() string
	CveSummary() string
	CvssScore() float64
	CvssVector() string
	CvssSeverity() string
	Link() string
	VulnSiteReferences() []Reference
	SetVulnSiteReferences([]Reference)
	SetCpes([]Cpe)
	LastModified() time.Time
}

CveDictionary is interface of JVN, NVD

type Jvn

type Jvn struct {
	gorm.Model
	CveDetailID uint

	Title   string
	Summary string
	JvnLink string
	JvnID   string

	Score    float64 // 1 to 10
	Severity string  // Low|Medium|High
	Vector   string  // (AV:N/AC:M/Au:N/C:N/I:P/A:N)

	References []Reference
	Cpes       []Cpe

	PublishedDate    time.Time
	LastModifiedDate time.Time
}

Jvn is a model of JVN

func (Jvn) CveSummary

func (c Jvn) CveSummary() string

CveSummary return summary

func (Jvn) CveTitle

func (c Jvn) CveTitle() string

CveTitle return title

func (Jvn) CvssScore

func (c Jvn) CvssScore() float64

CvssScore return severity ranking

func (Jvn) CvssSeverity

func (c Jvn) CvssSeverity() string

CvssSeverity return severity ranking

func (Jvn) CvssVector

func (c Jvn) CvssVector() string

CvssVector return severity ranking

func (Jvn) GetCveDetailID

func (c Jvn) GetCveDetailID() uint

GetCveDetailID return title

func (Jvn) GetID

func (c Jvn) GetID() uint

GetID return title

func (Jvn) LastModified

func (c Jvn) LastModified() time.Time

LastModified set cpes

func (c Jvn) Link() string

Link return summary

func (*Jvn) SetCpes

func (c *Jvn) SetCpes(r []Cpe)

SetCpes set cpes

func (*Jvn) SetCveDetailID

func (c *Jvn) SetCveDetailID(id uint)

SetCveDetailID return title

func (*Jvn) SetVulnSiteReferences

func (c *Jvn) SetVulnSiteReferences(r []Reference)

SetVulnSiteReferences set References

func (Jvn) VulnSiteReferences

func (c Jvn) VulnSiteReferences() []Reference

VulnSiteReferences return summary

type Nvd

type Nvd struct {
	gorm.Model
	CveDetailID uint

	Summary string

	Score                 float64 // 1 to 10
	AccessVector          string
	AccessComplexity      string
	Authentication        string
	ConfidentialityImpact string
	IntegrityImpact       string
	AvailabilityImpact    string

	Cpes       []Cpe
	References []Reference

	PublishedDate    time.Time
	LastModifiedDate time.Time
}

Nvd is a model of NVD

func (Nvd) CveSummary

func (c Nvd) CveSummary() string

CveSummary return summary

func (Nvd) CveTitle

func (c Nvd) CveTitle() string

CveTitle return title

func (Nvd) CvssScore

func (c Nvd) CvssScore() float64

CvssScore return title

func (Nvd) CvssVector

func (c Nvd) CvssVector() string

CvssVector make CVSS Vector string https://nvd.nist.gov/cvss.cfm?vectorinfo&version=2

Example 1: (AV:L/AC:H/Au:N/C:N/I:P/A:C)
Example 2: (AV:A/AC:L/Au:M/C:C/I:N/A:P)

func (Nvd) GetCveDetailID

func (c Nvd) GetCveDetailID() uint

GetCveDetailID return title

func (Nvd) GetID

func (c Nvd) GetID() uint

GetID return title

func (Nvd) LastModified

func (c Nvd) LastModified() time.Time

LastModified get LastModifiedDate

func (c Nvd) Link() string

Link return summary

func (*Nvd) SetCpes

func (c *Nvd) SetCpes(r []Cpe)

SetCpes set cpes

func (*Nvd) SetCveDetailID

func (c *Nvd) SetCveDetailID(id uint)

SetCveDetailID return title

func (Nvd) SetVulnSiteReferences

func (c Nvd) SetVulnSiteReferences(r []Reference)

SetVulnSiteReferences set References

func (Nvd) Severity

func (c Nvd) Severity() string

Severity return severity ranking that NVD povided. https://nvd.nist.gov/cvss.cfm

func (Nvd) VulnSiteReferences

func (c Nvd) VulnSiteReferences() []Reference

VulnSiteReferences return References

type Reference

type Reference struct {
	gorm.Model
	JvnID uint
	NvdID uint

	Source string
	Link   string
}

Reference is Child model of Jvn/Nvd. It holds reference information about the CVE.

Jump to

Keyboard shortcuts

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