feat(report): Display CERT information to reports (#741)
* fix(tui): show JPCERT Alert URL in TUI * feat(tui): show `!` when the CVE-ID corresponds to USCERT or JPCERT alert * feat(report): display cert alert info to stdout report * fix(report): Display CVEs detected by CPEs with -ignore-unfixed flag
This commit is contained in:
@@ -20,13 +20,14 @@ package report
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/future-architect/vuls/alert"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/future-architect/vuls/alert"
|
||||
|
||||
"github.com/future-architect/vuls/config"
|
||||
"github.com/future-architect/vuls/models"
|
||||
"github.com/future-architect/vuls/util"
|
||||
@@ -636,10 +637,15 @@ func summaryLines(r models.ScanResult) string {
|
||||
packname := vinfo.AffectedPackages.FormatTuiSummary()
|
||||
packname += strings.Join(vinfo.CpeURIs, ", ")
|
||||
|
||||
alert := " "
|
||||
if vinfo.AlertDict.HasAlert() {
|
||||
alert = "! "
|
||||
}
|
||||
|
||||
var cols []string
|
||||
cols = []string{
|
||||
fmt.Sprintf(indexFormat, i+1),
|
||||
vinfo.CveID,
|
||||
alert + vinfo.CveID,
|
||||
cvssScore + " |",
|
||||
fmt.Sprintf("%8s |", vinfo.AttackVector()),
|
||||
fmt.Sprintf("%7s |", vinfo.PatchStatus(r.Packages)),
|
||||
@@ -764,13 +770,17 @@ func setChangelogLayout(g *gocui.Gui) error {
|
||||
}
|
||||
}
|
||||
|
||||
if config.Conf.Lang == "ja" && len(vinfo.AlertDict.Ja) > 0 {
|
||||
if len(vinfo.AlertDict.Ja) > 0 {
|
||||
lines = append(lines, "\n",
|
||||
"JPCERT Alert",
|
||||
"=============",
|
||||
)
|
||||
for _, alert := range vinfo.AlertDict.Ja {
|
||||
lines = append(lines, fmt.Sprintf("* [%s](%s)", alert.Title, alert.URL))
|
||||
if config.Conf.Lang == "ja" {
|
||||
lines = append(lines, fmt.Sprintf("* [%s](%s)", alert.Title, alert.URL))
|
||||
} else {
|
||||
lines = append(lines, fmt.Sprintf("* [JPCERT](%s)", alert.URL))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -884,17 +894,6 @@ func detailLines() (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
alerts := []alert.Alert{}
|
||||
for _, alert := range vinfo.AlertDict.En {
|
||||
alerts = append(alerts, alert)
|
||||
}
|
||||
// Only show JPCERT alert to Japanese users
|
||||
if config.Conf.Lang == "ja" {
|
||||
for _, alert := range vinfo.AlertDict.Ja {
|
||||
alerts = append(alerts, alert)
|
||||
}
|
||||
}
|
||||
|
||||
data := dataForTmpl{
|
||||
CveID: vinfo.CveID,
|
||||
Cvsses: fmt.Sprintf("%s\n", table),
|
||||
@@ -902,7 +901,6 @@ func detailLines() (string, error) {
|
||||
Mitigation: fmt.Sprintf("%s (%s)", mitigation.Value, mitigation.Type),
|
||||
Confidences: vinfo.Confidences,
|
||||
Cwes: cwes,
|
||||
Alerts: alerts,
|
||||
Links: util.Distinct(links),
|
||||
References: refs,
|
||||
}
|
||||
@@ -949,11 +947,6 @@ Confidence
|
||||
{{range $confidence := .Confidences -}}
|
||||
* {{$confidence.DetectionMethod}}
|
||||
{{end}}
|
||||
Alerts
|
||||
-----------
|
||||
{{range .Alerts -}}
|
||||
* [{{.Title}}]({{.URL}})
|
||||
{{end}}
|
||||
References
|
||||
-----------
|
||||
{{range .References -}}
|
||||
|
||||
Reference in New Issue
Block a user