Documentation
¶
Index ¶
- func CorpusFactory(t corpus.Type, corpusLocalPath string) (corpus.Corpus, error)
- func PayloadFactory(t corpus.Type) (corpus.Payload, error)
- func RunQuantitativeTests(params Params, out *output.Output) error
- type LocalEngine
- type Params
- type QuantitativeRunStats
- func (s *QuantitativeRunStats) Count() int
- func (s *QuantitativeRunStats) FalsePositives() int
- func (s *QuantitativeRunStats) MarshalJSON() ([]byte, error)
- func (s *QuantitativeRunStats) SetTotalTime(totalTime time.Duration)
- func (s *QuantitativeRunStats) Skipped() int
- func (s *QuantitativeRunStats) TotalTime() time.Duration
- type RuleMatch
- type RuleStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CorpusFactory ¶
CorpusFactory creates a new corpus
func PayloadFactory ¶
PayloadFactory creates a new Payload based on the corpus.Type
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]RuleMatch
}
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
// CorpusLocalPath is the path to store the local corpora
CorpusLocalPath 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
}
QuantitativeRunStats 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 ¶
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.