Documentation ¶
Overview ¶
Package waftest implements types and functions for testing WAFs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPClient ¶
NewHTTPClient creates an HTTP client. Clients and Transports are safe for concurrent use by multiple goroutines and for efficiency should only be created once and re-used. See https://golang.org/pkg/net/http/ for more.
Types ¶
type Details ¶
type Details struct { RuleID string File string LineNumber string Data string Match string Tags []string }
Details is details field in logs.
type LogLine ¶
type LogLine struct {
Transaction Transaction
}
LogLine is a line from logs.
func GetLogLines ¶
GetLogLines gets lines of WAF logs from URL or file.
type Response ¶
type Response struct {
HTTPCode int `json:"http_code"`
}
Response is response field in logs.
type Test ¶
type Test struct { ID string Title string Desc string Tags []string File string Method string Scheme string Host string Path string // URI URL string // scheme + host + Path Headers map[string]string Data []string Err error StatusCode int // ex: 403 ExpectedStatusCodes []int Status string // ex: 403 Forbidden TestStatus string Logs []LogLine LogContains string LogContainsNot string ExpectError bool Executed bool }
Test represents an HTTP test. It contains both request and response fields + additional fields.
func (*Test) Evaluate ¶
Evaluate evaluates a test from response status or logs. Then it sets overall TestStatus to OK, FAIL or ERR.
func (*Test) Execute ¶
Execute executes a Test. It fills in some of the Test fields (like URL, StatusCode).
func (*Test) PrintVerbose ¶
PrintVerbose prints lot of information about a Test.
type Transaction ¶
type Transaction struct { TimeStamp string `json:"time_stamp"` ClientIP string `json:"client_ip"` ClientPort int `json:"client_port"` HostIP string `json:"host_ip"` HostPort int `json:"host_port"` Messages []Message Request Request Response Response Producer Producer }
Transaction is transaction field in logs.