feat(cve/mitre): support go-cve-dictionary:mitre (#1978)

* feat(cve/mitre): support go-cve-dictionary:mitre

* chore: adopt reviewer comment

* refactor(models): refactor CveContents method
This commit is contained in:
MaineK00n
2024-06-29 16:35:06 +09:00
committed by GitHub
parent 9beb5fc9f0
commit d8173cdd42
15 changed files with 1005 additions and 212 deletions

View File

@@ -899,6 +899,7 @@ func setChangelogLayout(g *gocui.Gui) error {
type dataForTmpl struct {
CveID string
Cvsses string
SSVC []models.CveContentSSVC
Exploits []models.Exploit
Metasploits []models.Metasploit
Summary string
@@ -979,7 +980,7 @@ func detailLines() (string, error) {
table := uitable.New()
table.MaxColWidth = 100
table.Wrap = true
scores := append(vinfo.Cvss3Scores(), vinfo.Cvss2Scores()...)
scores := append(vinfo.Cvss40Scores(), append(vinfo.Cvss3Scores(), vinfo.Cvss2Scores()...)...)
var cols []interface{}
for _, score := range scores {
cols = []interface{}{
@@ -1002,6 +1003,7 @@ func detailLines() (string, error) {
data := dataForTmpl{
CveID: vinfo.CveID,
Cvsses: fmt.Sprintf("%s\n", table),
SSVC: vinfo.CveContents.SSVC(),
Summary: fmt.Sprintf("%s (%s)", summary.Value, summary.Type),
Mitigation: strings.Join(mitigations, "\n"),
PatchURLs: vinfo.CveContents.PatchURLs(),
@@ -1027,6 +1029,17 @@ CVSS Scores
-----------
{{.Cvsses }}
{{if .SSVC}}
SSVC
-----------
{{range $ssvc := .SSVC -}}
* {{$ssvc.Type}}
Exploitation : {{$ssvc.Value.Exploitation}}
Automatable : {{$ssvc.Value.Automatable}}
TechnicalImpact : {{$ssvc.Value.TechnicalImpact}}
{{end}}
{{end}}
Summary
-----------
{{.Summary }}