Documentation ¶
Index ¶
- type Profile
- type Test
- func (t *Test) DisableMagic()
- func (t *Test) LogContains(log string) bool
- func (t *Test) OutputErrors() []string
- func (t *Test) Request() string
- func (t *Test) RunPhases() error
- func (t *Test) SetEncodedRequest(request string) error
- func (t *Test) SetRawRequest(request []byte) error
- func (t *Test) SetRequestBody(body interface{}) error
- func (t *Test) SetResponseBody(body interface{}) error
- func (t *Test) SetWaf(waf *engine.Waf)
- func (t *Test) String() string
- func (t *Test) Transaction() *engine.Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Profile ¶
type Profile struct { Rules string `yaml:"rules,omitempty"` Pass bool Meta struct { Author string `yaml:"author,omitempty"` Description string `yaml:"description,omitempty"` Enabled bool `yaml:"enabled,omitempty"` Name string `yaml:"name,omitempty"` } `yaml:"meta,omitempty"` Tests []struct { Title string `yaml:"test_title,omitempty"` Description string `yaml:"desc,omitempty"` Stages []struct { Stage struct { Input struct { DestAddr string `yaml:"dest_addr,omitempty"` Port int `yaml:"port,omitempty"` Method string `yaml:"method,omitempty"` URI string `yaml:"uri,omitempty"` Version string `yaml:"version,omitempty"` Data interface{} `yaml:"data,omitempty"` // Accepts array or string Headers map[string]string `yaml:"headers,omitempty"` RawRequest []byte `yaml:"raw_request,omitempty"` EncodedRequest string `yaml:"encoded_request,omitempty"` StopMagic bool `yaml:"stop_magic,omitempty"` } `yaml:"input,omitempty"` Output expectedOutput `yaml:"output,omitempty"` } `yaml:"stage,omitempty"` } `yaml:"stages,omitempty"` } `yaml:"tests,omitempty"` }
Profile represents a test profile It contains metadata and instructions for a test It requires more documentation
func NewProfile ¶
NewProfile creates a new profile from a file
type Test ¶
type Test struct { Name string // public variables // RequestAddress contains the address of the request RequestAddress string // RequestPort contains the port of the request RequestPort int // RequestURI contains the uri of the request RequestURI string // RequestMethod contains the method of the request RequestMethod string // RequestProtocol contains the protocol of the request RequestProtocol string // RequestHeaders contains the headers of the request RequestHeaders map[string]string // ResponseHeaders contains the headers of the response ResponseHeaders map[string]string // ResponseCode contains the response code of the response ResponseCode int // ResponseProtocol contains the protocol of the response ResponseProtocol string // ServerAddress contains the address of the server ServerAddress string // ServerPort contains the port of the server ServerPort int // Expected contains the expected result of the test ExpectedOutput expectedOutput // contains filtered or unexported fields }
Test represents a unique transaction within a WAF instance for a test case
func (*Test) DisableMagic ¶
func (t *Test) DisableMagic()
DisableMagic disables the magic flag which auto sets content-type and content-length
func (*Test) LogContains ¶
LogContains checks if the log contains a string
func (*Test) OutputErrors ¶
OutputErrors returns a list of errors that occurred during the test
func (*Test) SetEncodedRequest ¶
SetEncodedRequest reads a base64 encoded request and sets it as the current request
func (*Test) SetRawRequest ¶
SetRawRequest reads a raw request and sets it as the current request
func (*Test) SetRequestBody ¶
SetRequestBody sets the request body
func (*Test) SetResponseBody ¶
SetResponseBody sets the request body
func (*Test) Transaction ¶
func (t *Test) Transaction() *engine.Transaction
Transaction returns the transaction