cvequeryops

package
v1.3.1-sp6 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-modified.json.gz
	LatestCveModifiedDataFeed = "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-modified.json.gz"
	// https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-recent.json.gz
	LatestCveRecentDataFeed = "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-recent.json.gz"
)

Variables

View Source
var CveDataFeed = map[string]string{
	"CVE-2002.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2002.json.gz",
	"CVE-2003.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2003.json.gz",
	"CVE-2004.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2004.json.gz",
	"CVE-2005.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2005.json.gz",
	"CVE-2006.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2006.json.gz",
	"CVE-2007.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2007.json.gz",
	"CVE-2008.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2008.json.gz",
	"CVE-2009.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2009.json.gz",
	"CVE-2010.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2010.json.gz",
	"CVE-2011.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2011.json.gz",
	"CVE-2012.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2012.json.gz",
	"CVE-2013.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2013.json.gz",
	"CVE-2014.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2014.json.gz",
	"CVE-2015.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2015.json.gz",
	"CVE-2016.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2016.json.gz",
	"CVE-2017.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2017.json.gz",
	"CVE-2018.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2018.json.gz",
	"CVE-2019.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2019.json.gz",
	"CVE-2020.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2020.json.gz",
	"CVE-2021.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2021.json.gz",
	"CVE-2022.json": "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2022.json.gz",
}

Functions

func DownLoad

func DownLoad(dir string) error

DownLoad 从NVD下载CVE json数据到本地

func DownloadCWE

func DownloadCWE() (string, error)

func LoadCVE

func LoadCVE(fileDir, DbPath string, years ...int)

LoadCVE 从本地的CVE json数据加载构造数据库

func LoadCVEByFileName

func LoadCVEByFileName(fileName string, manager *cveresources.SqliteManager) (shouldExit bool, err error)

func LoadCWE

func LoadCWE(cweXMLPath string) ([]*cveresources.CWE, error)

func MakeSqlSentence

func MakeSqlSentence(info *CVEQueryInfo) (string, []interface{})

func QueryCVEYields

func QueryCVEYields(db *gorm.DB, opts ...CVEOption) chan *cveresources.CVE

func SaveCWE

func SaveCWE(db *gorm.DB, cwes []*cveresources.CWE)

Types

type CVEOption

type CVEOption func(info *CVEQueryInfo)

func After

func After(year int, data ...int) CVEOption

func AfterByTimeStamp

func AfterByTimeStamp(timeStamp int64) CVEOption

func Before

func Before(year int, data ...int) CVEOption

func BeforeByTimeStamp

func BeforeByTimeStamp(timeStamp int64) CVEOption

func CPE

func CPE(c string) CVEOption

func CVE

func CVE(id string) CVEOption

func CWE

func CWE(cwe string) CVEOption

func Desc

func Desc(flag bool) CVEOption

func Limit

func Limit(quantity int) CVEOption

func Offset

func Offset(start int) CVEOption

func OrderBy

func OrderBy(name string) CVEOption

func Product

func Product(p string) CVEOption

func ProductWithVersion

func ProductWithVersion(p string, v ...string) CVEOption

func Score

func Score(score float64) CVEOption

func Severity

func Severity(level string) CVEOption

func Strict added in v1.2.3

func Strict(flag bool) CVEOption

func Vendor

func Vendor(v string) CVEOption

type CVEQueryInfo

type CVEQueryInfo struct {
	CVE          string
	CPE          []cveresources.CPE
	CWE          []string
	Vendors      []string
	Products     []string
	Severity     []string
	ExploitScore float64
	After        time.Time
	Before       time.Time
	Start        int
	Quantity     int
	OrderBy      string
	Desc         bool
	Strict       bool
}

func Filter

func Filter(db *gorm.DB, opts ...CVEOption) (*gorm.DB, *CVEQueryInfo)

func FixCVEProduct added in v1.2.3

func FixCVEProduct(cveQuery *CVEQueryInfo, db *gorm.DB) *CVEQueryInfo

Jump to

Keyboard shortcuts

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