Skip to content

Commit

Permalink
fix: support new JVN shcema
Browse files Browse the repository at this point in the history
  • Loading branch information
kotakanbe committed Feb 23, 2018
1 parent fde7146 commit a00c3ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
5 changes: 2 additions & 3 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,9 @@ func convertJvn(items []jvn.Item) (cves []models.CveDetail) {
refs = append(refs, ref)
}

// Cpes
cpes := []models.Cpe{}
for _, c := range item.CpeItem {
cpe, err := parseCpe(c.Name)
for _, cpe := range item.Cpes {
cpe, err := parseCpe(cpe.Value)
if err != nil {
panic(err)
}
Expand Down
15 changes: 7 additions & 8 deletions jvn/jvn.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,24 @@ type Item struct {
Publisher string `xml:"publisher"`
Identifier string `xml:"identifier"`
References []references `xml:"references"`
CpeItem []cpeItem `xml:"cpe-item"`
Cpes []cpe `xml:"cpe"`
Cvss Cvss `xml:"cvss"`
Date string `xml:"date"`
Issued string `xml:"issued"`
Modified string `xml:"modified"`
}

type cpeItem struct {
// cpe:/a:mysql:mysql
Name string `xml:"name,attr"`
// MySQL
Title string `xml:"title"`
// MySQL AB
Vname string `xml:"vname"`
type cpe struct {
Version string `xml:"version,attr"` // cpe:/a:mysql:mysql
Vendor string `xml:"vendor,attr"`
Product string `xml:"product,attr"`
Value string `xml:",chardata"`
}

type references struct {
ID string `xml:"id,attr"`
Source string `xml:"source,attr"`
Title string `xml:"title,attr"`
URL string `xml:",chardata"`
}

Expand Down

0 comments on commit a00c3ae

Please sign in to comment.