mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-22 03:10:42 +08:00
fix: 结果文件中 POC 漏洞只显示 vulnerable 不显示漏洞名称 (Closes #591)
POC 扫描结果存入 details["vulnerability_name"], 但 TXT/CSV/NDJSON 三种输出格式只读 details["vulnerability"], key 不匹配导致漏洞名丢失,退化为显示 status 字段 "vulnerable"。 三种 writer 统一兼容两种 key。
This commit is contained in:
@@ -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")
|
||||||
|
|||||||
@@ -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 获取格式类型
|
||||||
|
|||||||
Reference in New Issue
Block a user