mirror of
https://github.com/lunchcat/sif.git
synced 2026-07-05 04:07:03 -07:00
96092dafab
Ran `gofmt -w .` accross the repo to fix formatting drift. Mechanical `gofmt -w .` only. No functional or behavioural changes. CONTRIBUTING.md requires gofmt-clean code; these files had slipped.
49 lines
1.9 KiB
Go
49 lines
1.9 KiB
Go
/*
|
|
·━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━·
|
|
: :
|
|
: █▀ █ █▀▀ · Blazing-fast pentesting suite :
|
|
: ▄█ █ █▀ · BSD 3-Clause License :
|
|
: :
|
|
: (c) 2022-2026 vmfunc, xyzeva, :
|
|
: lunchcat alumni & contributors :
|
|
: :
|
|
·━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━·
|
|
*/
|
|
|
|
package format
|
|
|
|
import (
|
|
nucleiout "github.com/projectdiscovery/nuclei/v3/pkg/output"
|
|
"github.com/vmfunc/sif/internal/styles"
|
|
)
|
|
|
|
func FormatLine(event *nucleiout.ResultEvent) string {
|
|
line := event.TemplateID
|
|
|
|
if event.MatcherName != "" {
|
|
line += ":" + styles.Highlight.Render(event.MatcherName)
|
|
} else if event.ExtractorName != "" {
|
|
line += ":" + styles.Highlight.Render(event.ExtractorName)
|
|
}
|
|
|
|
line += " [" + event.Type + "]"
|
|
line += " [" + formatSeverity(event.Info.SeverityHolder.Severity.String()) + "]"
|
|
|
|
return line
|
|
}
|
|
|
|
func formatSeverity(severity string) string {
|
|
switch severity {
|
|
case "low":
|
|
return styles.SeverityLow.Render(severity)
|
|
case "medium":
|
|
return styles.SeverityMedium.Render(severity)
|
|
case "high":
|
|
return styles.SeverityHigh.Render(severity)
|
|
case "critical":
|
|
return styles.SeverityCritical.Render(severity)
|
|
default:
|
|
return severity
|
|
}
|
|
}
|