mirror of
https://github.com/projectdiscovery/nuclei
synced 2026-06-08 16:50:47 +00:00
1ec64a3f95
Bumps clistats, fastdialer, retryablehttp-go, dsl, networkpolicy, ratelimit, sarif, utils, wappalyzergo, cdncheck. dsl v0.8.18 moves to the projectdiscovery/govaluate fork, and utils v0.11.0 pulls aurora v4, so the corresponding imports and type references are migrated. Refs #7380.
40 lines
918 B
Go
40 lines
918 B
Go
package colorizer
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/logrusorgru/aurora/v4"
|
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/model/types/severity"
|
|
)
|
|
|
|
const (
|
|
fgOrange aurora.ColorIndex = 208
|
|
)
|
|
|
|
func GetColor(colorizer *aurora.Aurora, templateSeverity fmt.Stringer) string {
|
|
var method func(arg interface{}) aurora.Value
|
|
switch templateSeverity {
|
|
case severity.Info:
|
|
method = colorizer.Blue
|
|
case severity.Low:
|
|
method = colorizer.Green
|
|
case severity.Medium:
|
|
method = colorizer.Yellow
|
|
case severity.High:
|
|
method = func(stringValue interface{}) aurora.Value { return colorizer.Index(fgOrange, stringValue) }
|
|
case severity.Critical:
|
|
method = colorizer.Red
|
|
default:
|
|
method = colorizer.White
|
|
}
|
|
|
|
return method(templateSeverity.String()).String()
|
|
}
|
|
|
|
func New(colorizer *aurora.Aurora) func(severity.Severity) string {
|
|
return func(severity severity.Severity) string {
|
|
return GetColor(colorizer, severity)
|
|
}
|
|
}
|