fix: 结果文件中 POC 漏洞只显示 vulnerable 不显示漏洞名称 (Closes #591)

POC 扫描结果存入 details["vulnerability_name"],
但 TXT/CSV/NDJSON 三种输出格式只读 details["vulnerability"],
key 不匹配导致漏洞名丢失,退化为显示 status 字段 "vulnerable"。
三种 writer 统一兼容两种 key。
This commit is contained in:
ZacharyZcR
2026-06-27 16:23:52 +08:00
parent 4922122530
commit ed45d0ead5
2 changed files with 13 additions and 1 deletions
+3
View File
@@ -98,6 +98,9 @@ func (w *StdoutNDJSONWriter) flatten(r *ScanResult) *ndjsonRecord {
rec.Title = strVal(d, "title") rec.Title = strVal(d, "title")
rec.URL = strVal(d, "url") rec.URL = strVal(d, "url")
rec.Vulnerability = strVal(d, "vulnerability") rec.Vulnerability = strVal(d, "vulnerability")
if rec.Vulnerability == "" {
rec.Vulnerability = strVal(d, "vulnerability_name")
}
rec.Username = strVal(d, "username") rec.Username = strVal(d, "username")
rec.Password = strVal(d, "password") rec.Password = strVal(d, "password")
rec.Plugin = strVal(d, "plugin") rec.Plugin = strVal(d, "plugin")
+10 -1
View File
@@ -283,6 +283,9 @@ func (w *TXTWriter) formatVulnLine(result *ScanResult) string {
} }
vuln := w.getDetailStr(result, "vulnerability") vuln := w.getDetailStr(result, "vulnerability")
if vuln == "" {
vuln = w.getDetailStr(result, "vulnerability_name")
}
if vuln != "" { if vuln != "" {
return fmt.Sprintf("%s %s", result.Target, vuln) return fmt.Sprintf("%s %s", result.Target, vuln)
} }
@@ -789,12 +792,18 @@ func formatFingerprints(value interface{}) string {
func (w *CSVWriter) formatVulnRecord(result *ScanResult) []string { func (w *CSVWriter) formatVulnRecord(result *ScanResult) []string {
vulnType := "" vulnType := ""
vulnName := result.Status
if result.Details != nil { if result.Details != nil {
if t, ok := result.Details["type"].(string); ok { if t, ok := result.Details["type"].(string); ok {
vulnType = t vulnType = t
} }
if v, ok := result.Details["vulnerability"].(string); ok && v != "" {
vulnName = v
} else if v, ok := result.Details["vulnerability_name"].(string); ok && v != "" {
vulnName = v
}
} }
return []string{result.Target, vulnType, result.Status} return []string{result.Target, vulnType, vulnName}
} }
// GetFormat 获取格式类型 // GetFormat 获取格式类型