diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-02-04 00:35:31 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-02-04 00:35:31 -0500 |
commit | 9c17b97cd0f83be3fff9fa4e87fd1d29052ea616 (patch) | |
tree | 0d97030a0d0c3ad983be281ce89f80571338887f /cpedict/cpedict.go | |
parent | 92400d731546557d110c9c3cc3906d700f83dda8 (diff) | |
download | cvez-9c17b97cd0f83be3fff9fa4e87fd1d29052ea616.tar.bz2 cvez-9c17b97cd0f83be3fff9fa4e87fd1d29052ea616.zip |
rename to github.com/pablotron/cvez, remove internal libs
Diffstat (limited to 'cpedict/cpedict.go')
-rw-r--r-- | cpedict/cpedict.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/cpedict/cpedict.go b/cpedict/cpedict.go new file mode 100644 index 0000000..0b5f77b --- /dev/null +++ b/cpedict/cpedict.go @@ -0,0 +1,46 @@ +// CPE 2.3 dictionary parser. +// +// The official NVD CPE dictionary is available here: +// https://nvd.nist.gov/products/cpe +package cpedict + +import "time" + +// Dictionary generator information. +type Generator struct { + ProductName string `xml:"product_name"` // Product name. + ProductVersion string `xml:"product_version"` // Product version. + SchemaVersion string `xml:"schema_version"` // Schema version. + Timestamp time.Time `xml:"timestamp"` // Generation timestamp. +} + +// Dictionary item title. +type Title struct { + Lang string `xml:"lang,attr"` // language code + Text string `xml:",chardata"` // value +} + +// Dictionary item reference. +type Reference struct { + Href string `xml:"href,attr"` // Link + Text string `xml:",chardata"` // Text +} + +// CPE 2.3 item attributes. +type Cpe23Item struct { + Name string `xml:"name,attr"` // CPE 2.3 formatting string. +} + +// Dictionary item. +type Item struct { + CpeUri string `xml:"name,attr"` // CPE URI. + Cpe23Item Cpe23Item `xml:"cpe23-item"` // CPE 2.3 formatting string. + Titles []Title `xml:"title"` // Item titles. + References []Reference `xml:"references>reference"` // References. +} + +// CPE dictionary. +type Dictionary struct { + Generator Generator `xml:"generator"` // Dictionary generator. + Items []Item `xml:"cpe-item"` // Dictionary items. +} |