Documentation
¶
Index ¶
- Constants
- Variables
- func Copy(src string, dst string) error
- func CopyDir(src string, dest string) error
- func Escape(val string) string
- func IsAlive(ctx context.Context, target string) (bool, error)
- type AssertFail
- type BucketResults
- type Coverage
- type HubTest
- func (h *HubTest) GetAppsecCoverage(hubDir string) ([]Coverage, error)
- func (h *HubTest) GetParsersCoverage(hubDir string) ([]Coverage, error)
- func (h *HubTest) GetScenariosCoverage(hubDir string) ([]Coverage, error)
- func (h *HubTest) LoadAllTests() error
- func (h *HubTest) LoadTestItem(name string) (*HubTestItem, error)
- type HubTestItem
- func (t *HubTestItem) Clean()
- func (*HubTestItem) ImprovedLogDisplay(crowdsecLogFile string) error
- func (t *HubTestItem) InstallHub(ctx context.Context) error
- func (t *HubTestItem) Run(ctx context.Context, patternDir string) error
- func (t *HubTestItem) RunWithLogFile(ctx context.Context) error
- func (t *HubTestItem) RunWithNucleiTemplate(ctx context.Context) error
- type HubTestItemConfig
- type NucleiConfig
- type ParserAssert
- func (p *ParserAssert) AssertFile(testFile string) error
- func (p *ParserAssert) AutoGenFromFile(filename string) (string, error)
- func (p *ParserAssert) AutoGenParserAssert() string
- func (p *ParserAssert) EvalExpression(expression string) (string, error)
- func (p *ParserAssert) LoadTest(filename string) error
- func (p *ParserAssert) Run(assert string) (bool, error)
- func (p *ParserAssert) RunExpression(expression string) (interface{}, error)
- type ScenarioAssert
- func (s *ScenarioAssert) AssertFile(testFile string) error
- func (s *ScenarioAssert) AutoGenFromFile(filename string) (string, error)
- func (s *ScenarioAssert) AutoGenScenarioAssert() string
- func (s *ScenarioAssert) EvalExpression(expression string) (string, error)
- func (s *ScenarioAssert) LoadTest(filename string, bucketpour string) error
- func (s *ScenarioAssert) Run(assert string) (bool, error)
- func (s *ScenarioAssert) RunExpression(expression string) (any, error)
Constants ¶
View Source
const ( ParserAssertFileName = "parser.assert" ParserResultFileName = "parser-dump.yaml" ScenarioAssertFileName = "scenario.assert" ScenarioResultFileName = "bucket-dump.yaml" BucketPourResultFileName = "bucketpour-dump.yaml" TestBouncerAPIKey = "this_is_a_bad_password" DefaultNucleiTarget = "http://127.0.0.1:7822/" DefaultAppsecHost = "127.0.0.1:4241" )
View Source
const (
TemplateNucleiFile = `` /* 429-byte string literal not displayed */
)
Variables ¶
View Source
var ( ErrNucleiTemplateFail = errors.New("nuclei template failed") ErrNucleiRunFail = errors.New("nuclei run failed") )
Functions ¶
Types ¶
type AssertFail ¶
type BucketResults ¶
func LoadScenarioDump ¶
func LoadScenarioDump(filepath string) (*BucketResults, error)
func (BucketResults) Len ¶
func (b BucketResults) Len() int
func (BucketResults) Less ¶
func (b BucketResults) Less(i, j int) bool
func (BucketResults) Swap ¶
func (b BucketResults) Swap(i, j int)
type HubTest ¶
type HubTest struct {
CrowdSecPath string
CscliPath string
HubPath string
HubTestPath string // generic parser/scenario tests .tests
HubAppsecTestPath string // dir specific to appsec tests .appsec-tests
HubIndexFile string
TemplateConfigPath string
TemplateProfilePath string
TemplateSimulationPath string
TemplateAcquisPath string
TemplateAppsecProfilePath string
NucleiTargetHost string
AppSecHost string
DataDir string // we share this one across tests, to avoid unnecessary downloads
HubIndex *cwhub.Hub
Tests []*HubTestItem
}
func NewHubTest ¶
func (*HubTest) GetAppsecCoverage ¶ added in v1.6.0
func (*HubTest) GetParsersCoverage ¶
func (*HubTest) GetScenariosCoverage ¶
func (*HubTest) LoadAllTests ¶
func (*HubTest) LoadTestItem ¶
func (h *HubTest) LoadTestItem(name string) (*HubTestItem, error)
type HubTestItem ¶
type HubTestItem struct {
Name string
Path string
CrowdSecPath string
CscliPath string
RuntimePath string
RuntimeDBDir string
RuntimeHubPath string
RuntimeDataPath string
RuntimePatternsPath string
RuntimeConfigFilePath string
RuntimeProfileFilePath string
RuntimeSimulationFilePath string
RuntimeAcquisFilePath string
RuntimeHubConfig *csconfig.LocalHubCfg
ResultsPath string
ParserResultFile string
ScenarioResultFile string
BucketPourResultFile string
HubPath string
HubTestPath string
HubIndexFile string
TemplateConfigPath string
TemplateProfilePath string
TemplateSimulationPath string
TemplateAcquisPath string
TemplateAppsecProfilePath string
HubIndex *cwhub.Hub
Config *HubTestItemConfig
Success bool
ErrorsList []string
AutoGen bool
ParserAssert *ParserAssert
ScenarioAssert *ScenarioAssert
CustomItemsLocation []string
NucleiTargetHost string
AppSecHost string
}
func (*HubTestItem) Clean ¶
func (t *HubTestItem) Clean()
func (*HubTestItem) ImprovedLogDisplay ¶ added in v1.7.0
func (*HubTestItem) ImprovedLogDisplay(crowdsecLogFile string) error
func (*HubTestItem) InstallHub ¶
func (t *HubTestItem) InstallHub(ctx context.Context) error
func (*HubTestItem) RunWithLogFile ¶ added in v1.6.0
func (t *HubTestItem) RunWithLogFile(ctx context.Context) error
func (*HubTestItem) RunWithNucleiTemplate ¶ added in v1.6.0
func (t *HubTestItem) RunWithNucleiTemplate(ctx context.Context) error
type HubTestItemConfig ¶
type HubTestItemConfig struct {
Parsers []string `yaml:"parsers,omitempty"`
Scenarios []string `yaml:"scenarios,omitempty"`
PostOverflows []string `yaml:"postoverflows,omitempty"`
AppsecRules []string `yaml:"appsec-rules,omitempty"`
NucleiTemplate string `yaml:"nuclei_template,omitempty"`
ExpectedNucleiFailure bool `yaml:"expect_failure,omitempty"`
LogFile string `yaml:"log_file,omitempty"`
LogType string `yaml:"log_type,omitempty"`
Labels map[string]string `yaml:"labels,omitempty"`
IgnoreParsers bool `yaml:"ignore_parsers,omitempty"` // if we test a scenario, we don't want to assert on Parser
OverrideStatics []parser.Static `yaml:"override_statics,omitempty"` // Allow to override statics. Executed before s00
OwnDataDir bool `yaml:"own_data_dir,omitempty"` // Don't share dataDir with the other tests
}
type NucleiConfig ¶ added in v1.6.0
type NucleiConfig struct {
Path string `yaml:"nuclei_path"`
OutputDir string `yaml:"output_dir"`
CmdLineOptions []string `yaml:"cmdline_options"`
}
func (*NucleiConfig) RunNucleiTemplate ¶ added in v1.6.0
type ParserAssert ¶
type ParserAssert struct {
File string
AutoGenAssert bool
AutoGenAssertData string
NbAssert int
Fails []AssertFail
Success bool
TestData *dumps.ParserResults
}
func NewParserAssert ¶
func NewParserAssert(file string) *ParserAssert
func (*ParserAssert) AssertFile ¶
func (p *ParserAssert) AssertFile(testFile string) error
func (*ParserAssert) AutoGenFromFile ¶
func (p *ParserAssert) AutoGenFromFile(filename string) (string, error)
func (*ParserAssert) AutoGenParserAssert ¶
func (p *ParserAssert) AutoGenParserAssert() string
func (*ParserAssert) EvalExpression ¶
func (p *ParserAssert) EvalExpression(expression string) (string, error)
func (*ParserAssert) LoadTest ¶
func (p *ParserAssert) LoadTest(filename string) error
func (*ParserAssert) RunExpression ¶
func (p *ParserAssert) RunExpression(expression string) (interface{}, error)
type ScenarioAssert ¶
type ScenarioAssert struct {
File string
AutoGenAssert bool
AutoGenAssertData string
NbAssert int
Fails []AssertFail
Success bool
TestData *BucketResults
PourData *dumps.BucketPourInfo
}
func NewScenarioAssert ¶
func NewScenarioAssert(file string) *ScenarioAssert
func (*ScenarioAssert) AssertFile ¶
func (s *ScenarioAssert) AssertFile(testFile string) error
func (*ScenarioAssert) AutoGenFromFile ¶
func (s *ScenarioAssert) AutoGenFromFile(filename string) (string, error)
func (*ScenarioAssert) AutoGenScenarioAssert ¶
func (s *ScenarioAssert) AutoGenScenarioAssert() string
func (*ScenarioAssert) EvalExpression ¶
func (s *ScenarioAssert) EvalExpression(expression string) (string, error)
func (*ScenarioAssert) LoadTest ¶
func (s *ScenarioAssert) LoadTest(filename string, bucketpour string) error
func (*ScenarioAssert) RunExpression ¶
func (s *ScenarioAssert) RunExpression(expression string) (any, error)
Click to show internal directories.
Click to hide internal directories.