quantitative

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CorpusFactory

func CorpusFactory(t corpus.Type) (corpus.Corpus, error)

CorpusFactory creates a new corpus

func PayloadFactory

func PayloadFactory(t corpus.Type) (corpus.Payload, error)

PayloadFactory creates a new Payload based on the corpus.Type

func RunQuantitativeTests

func RunQuantitativeTests(params Params, out *output.Output) error

RunQuantitativeTests runs all quantitative tests

Types

type LocalEngine

type LocalEngine interface {
	// Create creates a new engine to test payloads
	Create(prefix string, paranoia int) LocalEngine
	// CrsCall benchmarks the CRS WAF using a GET request with the payload
	CrsCall(payload string) map[int]string
}

LocalEngine is the interface for the local engine

type Params

type Params struct {
	// Lines is the number of lines of input to process before stopping
	Lines int
	// Fast is the process 1 in every X lines of input ('fast run' mode)
	// TODO: to be implemented
	Fast int
	// Rule is the rule ID of interest: only show false positives for specified rule ID
	Rule int
	// Payload is just a string to use instead of reading from the corpus
	Payload string
	// Number is the payload number (the line in the corpus) to exclusively send
	Number int
	// Directory is the directory where the CRS rules are stored
	Directory string
	// ParanoiaLevel is the paranoia level in where to run the quantitative tests
	ParanoiaLevel int
	// CorpusSize is the corpus size to use for the quantitative tests
	CorpusSize string
	// Corpus is the corpus to use for the quantitative tests
	Corpus corpus.Type
	// CorpusLang is the language of the corpus
	CorpusLang string
	// CorpusYear is the year of the corpus
	CorpusYear string
	// CorpusSource is the source of the corpus: e.g. most corpus will have a source like "news", "web", "wikipedia", etc.
	CorpusSource string
	// MaxConcurrency is the maximum number of goroutines spawned
	MaxConcurrency int
}

Params holds the parameters for the quantitative tests

type QuantitativeRunStats

type QuantitativeRunStats struct {
	// contains filtered or unexported fields
}

RunStats accumulates test statistics.

func NewQuantitativeStats

func NewQuantitativeStats() *QuantitativeRunStats

NewQuantitativeStats returns a new empty stats

func (*QuantitativeRunStats) Count

func (s *QuantitativeRunStats) Count() int

Count returns the amount of tests executed in this run.

func (*QuantitativeRunStats) FalsePositives

func (s *QuantitativeRunStats) FalsePositives() int

FalsePositives returns the total false positives detected

func (*QuantitativeRunStats) MarshalJSON

func (s *QuantitativeRunStats) MarshalJSON() ([]byte, error)

MarshalJSON marshals the stats to JSON.

func (*QuantitativeRunStats) SetTotalTime

func (s *QuantitativeRunStats) SetTotalTime(totalTime time.Duration)

SetTotalTime sets the duration over all runs, the sum of all individual run times.

func (*QuantitativeRunStats) Skipped added in v1.1.2

func (s *QuantitativeRunStats) Skipped() int

Skipped returns the amount of tests skipped in this run.

func (*QuantitativeRunStats) TotalTime

func (s *QuantitativeRunStats) TotalTime() time.Duration

TotalTime returns the duration over all runs, the sum of all individual run times.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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