Merge 5101f20d3c
into 1425086670
This commit is contained in:
commit
6746ea4176
@ -57,6 +57,7 @@ type NVDMetadata struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type NVDmetadataCVSSv2 struct {
|
type NVDmetadataCVSSv2 struct {
|
||||||
|
PublishedDateTime string
|
||||||
Vectors string
|
Vectors string
|
||||||
Score float64
|
Score float64
|
||||||
}
|
}
|
||||||
@ -160,8 +161,17 @@ func getDataFeeds(dataFeedHashes map[string]string, localPath string) (map[strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//A custom HTTP client limiting the amound of Idle connections is helpful when retrieving the feeds from nvd.nist.gov due to the number of timeouts.
|
||||||
|
var netClient = &http.Client{}
|
||||||
|
tr := &http.Transport{
|
||||||
|
MaxIdleConns: 20,
|
||||||
|
MaxIdleConnsPerHost: 20,
|
||||||
|
}
|
||||||
|
|
||||||
|
netClient = &http.Client{Transport: tr}
|
||||||
|
|
||||||
// Download data feed.
|
// Download data feed.
|
||||||
r, err := http.Get(fmt.Sprintf(dataFeedURL, dataFeedName))
|
r, err := netClient.Get(fmt.Sprintf(dataFeedURL, dataFeedName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithError(err).WithField(logDataFeedName, dataFeedName).Error("could not download NVD data feed")
|
log.WithError(err).WithField(logDataFeedName, dataFeedName).Error("could not download NVD data feed")
|
||||||
return dataFeedReaders, dataFeedHashes, commonerr.ErrCouldNotDownload
|
return dataFeedReaders, dataFeedHashes, commonerr.ErrCouldNotDownload
|
||||||
|
@ -28,6 +28,7 @@ type nvd struct {
|
|||||||
type nvdEntry struct {
|
type nvdEntry struct {
|
||||||
Name string `xml:"http://scap.nist.gov/schema/vulnerability/0.4 cve-id"`
|
Name string `xml:"http://scap.nist.gov/schema/vulnerability/0.4 cve-id"`
|
||||||
CVSS nvdCVSS `xml:"http://scap.nist.gov/schema/vulnerability/0.4 cvss"`
|
CVSS nvdCVSS `xml:"http://scap.nist.gov/schema/vulnerability/0.4 cvss"`
|
||||||
|
PublishedDateTime string `xml:"http://scap.nist.gov/schema/vulnerability/0.4 published-datetime"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type nvdCVSS struct {
|
type nvdCVSS struct {
|
||||||
@ -64,6 +65,7 @@ func init() {
|
|||||||
func (n nvdEntry) Metadata() *NVDMetadata {
|
func (n nvdEntry) Metadata() *NVDMetadata {
|
||||||
metadata := &NVDMetadata{
|
metadata := &NVDMetadata{
|
||||||
CVSSv2: NVDmetadataCVSSv2{
|
CVSSv2: NVDmetadataCVSSv2{
|
||||||
|
PublishedDateTime: n.PublishedDateTime,
|
||||||
Vectors: n.CVSS.BaseMetrics.String(),
|
Vectors: n.CVSS.BaseMetrics.String(),
|
||||||
Score: n.CVSS.BaseMetrics.Score,
|
Score: n.CVSS.BaseMetrics.Score,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user