From ed45d0ead5db1391cce45a577e64666d8eb0c87e Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Sat, 27 Jun 2026 16:22:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=93=E6=9E=9C=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=20POC=20=E6=BC=8F=E6=B4=9E=E5=8F=AA=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=20vulnerable=20=E4=B8=8D=E6=98=BE=E7=A4=BA=E6=BC=8F=E6=B4=9E?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=20(Closes=20#591)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit POC 扫描结果存入 details["vulnerability_name"], 但 TXT/CSV/NDJSON 三种输出格式只读 details["vulnerability"], key 不匹配导致漏洞名丢失,退化为显示 status 字段 "vulnerable"。 三种 writer 统一兼容两种 key。 --- common/output/stdout_writer.go | 3 +++ common/output/writers.go | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/common/output/stdout_writer.go b/common/output/stdout_writer.go index 56d6d54..5cc7d36 100644 --- a/common/output/stdout_writer.go +++ b/common/output/stdout_writer.go @@ -98,6 +98,9 @@ func (w *StdoutNDJSONWriter) flatten(r *ScanResult) *ndjsonRecord { rec.Title = strVal(d, "title") rec.URL = strVal(d, "url") rec.Vulnerability = strVal(d, "vulnerability") + if rec.Vulnerability == "" { + rec.Vulnerability = strVal(d, "vulnerability_name") + } rec.Username = strVal(d, "username") rec.Password = strVal(d, "password") rec.Plugin = strVal(d, "plugin") diff --git a/common/output/writers.go b/common/output/writers.go index 825226b..c0013eb 100644 --- a/common/output/writers.go +++ b/common/output/writers.go @@ -283,6 +283,9 @@ func (w *TXTWriter) formatVulnLine(result *ScanResult) string { } vuln := w.getDetailStr(result, "vulnerability") + if vuln == "" { + vuln = w.getDetailStr(result, "vulnerability_name") + } if 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 { vulnType := "" + vulnName := result.Status if result.Details != nil { if t, ok := result.Details["type"].(string); ok { 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 获取格式类型