fix exploit db (#733)

This commit is contained in:
sadayuki-matsuno
2018-11-12 17:36:53 +09:00
committed by Kota Kanbe
parent e63fc7e3f5
commit 98c5421edc
3 changed files with 191 additions and 80 deletions

View File

@@ -55,24 +55,24 @@ func FillWithExploit(driver db.DB, r *models.ScanResult) (nExploitCve int, err e
func ConvertToModel(es []*exploitmodels.Exploit) (exploits []models.Exploit) {
for _, e := range es {
var documentURL, paperURL, shellURL *string
var description string
if e.Document != nil {
documentURL = &e.Document.DocumentURL
description = e.Document.Description
}
if e.ShellCode != nil {
shellURL = &e.ShellCode.ShellCodeURL
description = e.ShellCode.Description
}
if e.Paper != nil {
paperURL = &e.Paper.PaperURL
description = e.Paper.Description
if e.OffensiveSecurity != nil {
os := e.OffensiveSecurity
if os.Document != nil {
documentURL = &os.Document.DocumentURL
}
if os.ShellCode != nil {
shellURL = &os.ShellCode.ShellCodeURL
}
if os.Paper != nil {
paperURL = &os.Paper.PaperURL
}
}
exploit := models.Exploit{
ExploitType: models.ExploitDB,
ID: e.ExploitDBID,
URL: e.ExploitDBURL,
Description: description,
ExploitType: e.ExploitType,
ID: e.ExploitUniqueID,
URL: e.URL,
Description: e.Description,
DocumentURL: documentURL,
ShellCodeURL: shellURL,
PaperURL: paperURL,