models

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2017 License: Apache-2.0 Imports: 3 Imported by: 83

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 `json:"-" xml:"-"`
	JvnID      uint `json:"-" xml:"-"`
	NvdID      uint `json:"-" xml:"-"`

	// CPE Name (URL style)
	// 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
	VendorUpdate 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 `json:"-" xml:"-"`
	CveInfoID  uint `json:"-" xml:"-"`

	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 (CveDetail) CweID added in v0.1.1

func (c CveDetail) CweID() string

CweID returns CWE ID of NVD struct

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  `json:"-" xml:"-"`
	CveDetailID uint `json:"-" xml:"-"`

	CveID   string
	Title   string
	Summary string `gorm:"size:8192"`
	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 CvssScore

func (Jvn) CvssSeverity

func (c Jvn) CvssSeverity() string

CvssSeverity return severity ranking

func (Jvn) CvssVector

func (c Jvn) CvssVector() string

CvssVector return severity

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  `json:"-" xml:"-"`
	CveDetailID uint `json:"-" xml:"-"`

	// Increased size of summary to ensure we can fit arbitrary CVE content.
	CveID                 string
	Summary               string  `gorm:"size:4096"`
	Score                 float64 // 1 to 10
	AccessVector          string
	AccessComplexity      string
	Authentication        string
	ConfidentialityImpact string
	IntegrityImpact       string
	AvailabilityImpact    string

	Cpes       []Cpe
	CweID      string
	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) CvssSeverity added in v0.1.1

func (c Nvd) CvssSeverity() string

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

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 empty string

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

func (c Nvd) VulnSiteReferences() []Reference

VulnSiteReferences return References

type Reference

type Reference struct {
	gorm.Model `json:"-" xml:"-"`
	JvnID      uint `json:"-" xml:"-"`
	NvdID      uint `json:"-" xml:"-"`

	Source string
	Link   string `gorm:"size:512"`
}

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