helpers

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomConsoleWriter

func CustomConsoleWriter(fileLogger *zerolog.ConsoleWriter) zerolog.ConsoleWriter

CustomConsoleWriter creates an output to print log in a files

func FileAnalyzer added in v1.1.4

func FileAnalyzer(path string) (string, error)

FileAnalyzer determines the type of extension in the passed config file by its content

func GenerateReport added in v1.2.0

func GenerateReport(path, filename string, body interface{}, formats []string, proBarBuilder progress.PbBuilder) error

GenerateReport execute each report function to generate report

func GetDefaultQueryPath added in v1.2.4

func GetDefaultQueryPath(queriesPath string) (string, error)

GetDefaultQueryPath - returns the default query path

func GetExecutableDirectory added in v1.2.4

func GetExecutableDirectory() string

GetExecutableDirectory - returns the path to the directory containing KICS executable

func InitShouldFailArg added in v1.3.0

func InitShouldFailArg(args []string) error

InitShouldFailArg initializes which kind of vulnerability severity should changes exit code

func InitShouldIgnoreArg added in v1.3.0

func InitShouldIgnoreArg(arg string) error

InitShouldIgnoreArg initializes what kind of errors should be used on exit codes

func ListReportFormats added in v1.3.0

func ListReportFormats() []string

ListReportFormats return a slice with all supported report formats

func PrintResult

func PrintResult(summary *model.Summary, failedQueries map[string]error, printer *Printer) error

PrintResult prints on output the summary results

func ResultsExitCode added in v1.3.0

func ResultsExitCode(summary *model.Summary) int

ResultsExitCode calculate exit code base on severity of results, returns 0 if no results was reported

func ShowError added in v1.3.0

func ShowError(kind string) bool

ShowError returns true if should show error, otherwise returns false

func ValidateReportFormats added in v1.2.0

func ValidateReportFormats(formats []string) error

ValidateReportFormats returns an error if output format is not supported

func WordWrap

func WordWrap(s, identation string, limit int) string

WordWrap Wraps text at the specified number of words

Types

type Printer added in v1.2.0

type Printer struct {
	Medium  color.RGBColor
	High    color.RGBColor
	Low     color.RGBColor
	Info    color.RGBColor
	Success color.RGBColor
	Line    color.RGBColor
	// contains filtered or unexported fields
}

Printer wil print console output with colors Medium is for medium sevevity results High is for high sevevity results Low is for low sevevity results Info is for info sevevity results Success is for successful prints Line is the color to print the line with the vulnerability minVersion is a bool that if true will print the results output in a minimum version

func NewPrinter added in v1.2.0

func NewPrinter(minimal bool) *Printer

NewPrinter initializes a new Printer

func (*Printer) Bold added in v1.4.0

func (p *Printer) Bold(content string) string

Bold returns the output in a bold format

func (*Printer) PrintBySev added in v1.2.0

func (p *Printer) PrintBySev(content, sev string) string

PrintBySev will print the output with the specific severity color given the severity of the result

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL