aboutsummaryrefslogtreecommitdiff
path: root/cpedict/cpedict.go
blob: 29f9d9191c7bc66ef92a46f280b9d9bab8ccafb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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" json:"lang"` // language code
  Text string `xml:",chardata" json:"text"` // value
}

// Dictionary item reference.
type Reference struct {
  Href string `xml:"href,attr" json:"href"` // Link
  Text string `xml:",chardata" json:"text"` // 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.
}