mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 15:55:26 +00:00
* use parsed options while signing * update project layout to v3 * fix .gitignore * remove example template * misc updates * bump tlsx version * hide template sig warning with env * js: retain value while using log * fix nil pointer derefernce * misc doc update --------- Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>
40 lines
901 B
Go
40 lines
901 B
Go
package colorizer
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/logrusorgru/aurora"
|
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/model/types/severity"
|
|
)
|
|
|
|
const (
|
|
fgOrange uint8 = 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)
|
|
}
|
|
}
|