@@ -111,12 +111,6 @@ func printExploitResult(result interface{}, outputPath string) {
111111 date = v .Date .Format ("2006-01-02" )
112112 }
113113
114- // 标签信息
115- tags := "无"
116- if len (v .Tags ) > 0 {
117- tags = strings .Join (v .Tags , ", " )
118- }
119-
120114 // 计算内容区域宽度
121115 contentWidth := borderWidth - 2 // 左右各减1个字符的padding
122116
@@ -150,7 +144,34 @@ func printExploitResult(result interface{}, outputPath string) {
150144 printLine ("漏洞标题" , v .Title )
151145 printLine ("风险级别" , riskLevel ) // 已经着色
152146 printLine ("发布日期" , date )
153- printLine ("漏洞标签" , tags , text .FgHiGreen )
147+
148+ // 输出CVE编号(如果有)
149+ if v .CVE != "" {
150+ printLine ("CVE编号" , v .CVE , text .FgHiYellow )
151+ }
152+
153+ // 输出CWE编号(如果有)
154+ if v .CWE != "" {
155+ printLine ("CWE编号" , v .CWE , text .FgHiYellow )
156+ }
157+
158+ // 输出漏洞位置信息
159+ locationInfo := []string {}
160+ if v .IsRemote {
161+ locationInfo = append (locationInfo , "远程" )
162+ }
163+ if v .IsLocal {
164+ locationInfo = append (locationInfo , "本地" )
165+ }
166+ if len (locationInfo ) > 0 {
167+ printLine ("漏洞位置" , strings .Join (locationInfo , ", " ), text .FgHiGreen )
168+ }
169+
170+ // 输出其他标签(如果有)
171+ if len (v .Tags ) > 0 {
172+ printLine ("其他标签" , strings .Join (v .Tags , ", " ), text .FgHiGreen )
173+ }
174+
154175 printLine ("作者" , v .Author , text .FgHiMagenta )
155176
156177 // 添加原始URL链接行
@@ -178,32 +199,41 @@ func printExploitResult(result interface{}, outputPath string) {
178199
179200 // 动态计算各列宽度
180201 // 终端宽度减去表格边框和列分隔符所占用的空间(大约是每列2个字符和表边框4个字符)
181- availableWidth := width - (4 + 2 * 5 ) // 5列 : ID、日期、风险、标题、作者
202+ availableWidth := width - (4 + 2 * 7 ) // 7列 : ID、日期、风险、CVE、CWE、位置 、标题、作者
182203
183204 // 根据内容特点分配各列宽度占比
184- idRatio := 0.15 // ID列 - 约15%
185- dateRatio := 0.10 // 日期列 - 约10%
186- riskRatio := 0.08 // 风险列 - 约8%
187- titleRatio := 0.47 // 标题列 - 约47%
188- authorRatio := 0.20 // 作者列 - 约20%
189-
190- // 计算各列实际宽度(最小保证有10个字符)
205+ idRatio := 0.13 // ID列 - 约13%
206+ dateRatio := 0.08 // 日期列 - 约8%
207+ riskRatio := 0.07 // 风险列 - 约7%
208+ cveRatio := 0.12 // CVE列 - 约12%
209+ cweRatio := 0.07 // CWE列 - 约7%
210+ locRatio := 0.08 // 位置列 - 约8%
211+ titleRatio := 0.30 // 标题列 - 约30%
212+ authorRatio := 0.15 // 作者列 - 约15%
213+
214+ // 计算各列实际宽度(最小保证有合理的字符数)
191215 idWidth := max (15 , int (float64 (availableWidth )* idRatio ))
192- dateWidth := max (12 , int (float64 (availableWidth )* dateRatio ))
193- riskWidth := max (8 , int (float64 (availableWidth )* riskRatio ))
216+ dateWidth := max (10 , int (float64 (availableWidth )* dateRatio ))
217+ riskWidth := max (6 , int (float64 (availableWidth )* riskRatio ))
218+ cveWidth := max (14 , int (float64 (availableWidth )* cveRatio ))
219+ cweWidth := max (8 , int (float64 (availableWidth )* cweRatio ))
220+ locWidth := max (8 , int (float64 (availableWidth )* locRatio ))
194221 titleWidth := max (25 , int (float64 (availableWidth )* titleRatio ))
195- authorWidth := max (15 , int (float64 (availableWidth )* authorRatio ))
222+ authorWidth := max (12 , int (float64 (availableWidth )* authorRatio ))
196223
197224 // 设置表头
198- t .AppendHeader (table.Row {"ID" , "日期" , "风险" , "标题" , "作者" })
225+ t .AppendHeader (table.Row {"ID" , "日期" , "风险" , "CVE" , "CWE" , "位置" , " 标题" , "作者" })
199226
200227 // 设置表头样式 - 深色背景
201228 t .SetColumnConfigs ([]table.ColumnConfig {
202229 {Number : 1 , Align : text .AlignCenter , AlignHeader : text .AlignCenter , Colors : text.Colors {text .FgHiCyan }, ColorsHeader : text.Colors {text .BgBlack , text .FgHiWhite , text .Bold }, WidthMax : idWidth },
203230 {Number : 2 , Align : text .AlignCenter , AlignHeader : text .AlignCenter , ColorsHeader : text.Colors {text .BgBlack , text .FgHiWhite , text .Bold }, WidthMax : dateWidth },
204231 {Number : 3 , Align : text .AlignCenter , AlignHeader : text .AlignCenter , ColorsHeader : text.Colors {text .BgBlack , text .FgHiWhite , text .Bold }, WidthMax : riskWidth },
205- {Number : 4 , AlignHeader : text .AlignCenter , ColorsHeader : text.Colors {text .BgBlack , text .FgHiWhite , text .Bold }, WidthMax : titleWidth },
206- {Number : 5 , AlignHeader : text .AlignCenter , ColorsHeader : text.Colors {text .BgBlack , text .FgHiWhite , text .Bold }, WidthMax : authorWidth },
232+ {Number : 4 , Align : text .AlignCenter , AlignHeader : text .AlignCenter , Colors : text.Colors {text .FgHiYellow }, ColorsHeader : text.Colors {text .BgBlack , text .FgHiWhite , text .Bold }, WidthMax : cveWidth },
233+ {Number : 5 , Align : text .AlignCenter , AlignHeader : text .AlignCenter , Colors : text.Colors {text .FgHiYellow }, ColorsHeader : text.Colors {text .BgBlack , text .FgHiWhite , text .Bold }, WidthMax : cweWidth },
234+ {Number : 6 , Align : text .AlignCenter , AlignHeader : text .AlignCenter , Colors : text.Colors {text .FgHiGreen }, ColorsHeader : text.Colors {text .BgBlack , text .FgHiWhite , text .Bold }, WidthMax : locWidth },
235+ {Number : 7 , AlignHeader : text .AlignCenter , Colors : text.Colors {text .FgHiWhite }, ColorsHeader : text.Colors {text .BgBlack , text .FgHiWhite , text .Bold }, WidthMax : titleWidth },
236+ {Number : 8 , AlignHeader : text .AlignCenter , Colors : text.Colors {text .FgHiMagenta }, ColorsHeader : text.Colors {text .BgBlack , text .FgHiWhite , text .Bold }, WidthMax : authorWidth },
207237 })
208238
209239 // 添加数据行
@@ -219,7 +249,7 @@ func printExploitResult(result interface{}, outputPath string) {
219249 }
220250
221251 // 日期格式化
222- date := "未知 "
252+ date := ""
223253 if ! item .Date .IsZero () {
224254 date = item .Date .Format ("2006-01-02" )
225255 }
@@ -244,6 +274,28 @@ func printExploitResult(result interface{}, outputPath string) {
244274 }
245275 }
246276
277+ // CVE编号处理
278+ cve := item .CVE
279+ if len (cve ) > cveWidth - 3 && cveWidth > 6 {
280+ cve = cve [:cveWidth - 6 ] + "..."
281+ }
282+
283+ // CWE编号处理
284+ cwe := item .CWE
285+ if len (cwe ) > cweWidth - 3 && cweWidth > 6 {
286+ cwe = cwe [:cweWidth - 6 ] + "..."
287+ }
288+
289+ // 位置信息处理
290+ location := ""
291+ if item .IsRemote && item .IsLocal {
292+ location = "远程/本地"
293+ } else if item .IsRemote {
294+ location = "远程"
295+ } else if item .IsLocal {
296+ location = "本地"
297+ }
298+
247299 // 根据风险级别设置不同颜色
248300 riskLevel := item .RiskLevel
249301 var riskColor text.Colors
@@ -267,6 +319,9 @@ func printExploitResult(result interface{}, outputPath string) {
267319 text.Colors {text .FgHiCyan }.Sprint (vulnID ),
268320 date ,
269321 coloredRisk ,
322+ text.Colors {text .FgHiYellow }.Sprint (cve ),
323+ text.Colors {text .FgHiYellow }.Sprint (cwe ),
324+ text.Colors {text .FgHiGreen }.Sprint (location ),
270325 title ,
271326 text.Colors {text .FgHiMagenta }.Sprint (author ),
272327 })
@@ -277,6 +332,9 @@ func printExploitResult(result interface{}, outputPath string) {
277332 fmt .Sprintf ("总计: %d 条记录" , len (v .Items )),
278333 "" ,
279334 "" ,
335+ "" ,
336+ "" ,
337+ "" ,
280338 fmt .Sprintf ("页码: %d/%d" , v .CurrentPage , v .TotalPages ),
281339 "" })
282340
0 commit comments