diff --git a/v2/pkg/model/model.go b/v2/pkg/model/model.go index 54a99f54..46f42664 100644 --- a/v2/pkg/model/model.go +++ b/v2/pkg/model/model.go @@ -22,6 +22,7 @@ type Info struct { // description: | // Author of the template. // + // Multiple values can also be specified separated by commas. // examples: // - value: "\"\"" Authors StringSlice `json:"author,omitempty" yaml:"author,omitempty" jsonschema:"title=author of the template,description=Author is the author of the template,example=username"` diff --git a/v2/pkg/operators/extractors/extractors.go b/v2/pkg/operators/extractors/extractors.go index 38342414..624c3300 100644 --- a/v2/pkg/operators/extractors/extractors.go +++ b/v2/pkg/operators/extractors/extractors.go @@ -10,7 +10,7 @@ import ( type Extractor struct { // description: | // Name of the extractor. Name should be lowercase and must not contain - // spaces or dashes (-). + // spaces or underscores (_). // examples: // - value: "\"cookie-extractor\"" Name string `yaml:"name,omitempty" jsonschema:"title=name of the extractor,description=Name of the extractor"` @@ -48,18 +48,22 @@ type Extractor struct { regexCompiled []*regexp.Regexp // description: | - // kval contains the key-value pairs required in the response. + // kval contains the key-value pairs present in the HTTP response header. + // kval extractor can be used to extract HTTP response header and cookie key-value pairs. + // kval extractor inputs are case insensitive, and does not support dash (-) in input which can replaced with underscores (_) + // For example, Content-Type should be replaced with content_type // - // Each protocol exposes a lot of different data in response. The kval - // extractor can be used to extract those key-value pairs. A list of - // supported parts is available in docs for request types. + // A list of supported parts is available in docs for request types. // examples: // - name: Extract Server Header From HTTP Response // value: > - // []string{"Server"} + // []string{"server"} // - name: Extracting value of PHPSESSID Cookie // value: > - // []string{"PHPSESSID"} + // []string{"phpsessid"} + // - name: Extracting value of Content-Type Cookie + // value: > + // []string{"content_type"} KVal []string `yaml:"kval,omitempty" jsonschema:"title=kval pairs to extract from response,description=Kval pairs to extract from response"` // description: | @@ -77,8 +81,6 @@ type Extractor struct { // examples: // - value: > // []string{"/html/body/div/p[2]/a"} - // - value: > - // []string{".batters | .batter | .[] | .id"} XPath []string `yaml:"xpath,omitempty" jsonschema:"title=html xpath expressions to extract data,description=XPath allows using xpath expressions to extract items from html response"` // description: | // Attribute is an optional attribute to extract from response XPath. diff --git a/v2/pkg/operators/matchers/matchers.go b/v2/pkg/operators/matchers/matchers.go index 19cb3c8e..9d9f6439 100644 --- a/v2/pkg/operators/matchers/matchers.go +++ b/v2/pkg/operators/matchers/matchers.go @@ -43,7 +43,7 @@ type Matcher struct { // description: | // Name of the matcher. Name should be lowercase and must not contain - // spaces or dashes (-). + // spaces or underscores (_). // examples: // - value: "\"cookie-matcher\"" Name string `yaml:"name,omitempty" jsonschema:"title=name of the matcher,description=Name of the matcher"` diff --git a/v2/pkg/protocols/dns/dns.go b/v2/pkg/protocols/dns/dns.go index 7812ead1..858f36bb 100644 --- a/v2/pkg/protocols/dns/dns.go +++ b/v2/pkg/protocols/dns/dns.go @@ -18,7 +18,7 @@ type Request struct { // Operators for the current request go here. operators.Operators `yaml:",inline"` - // ID is the ID of the request + // ID is the the optional id of the request ID string `yaml:"id,omitempty" jsonschema:"title=id of the dns request,description=ID is the optional ID of the DNS Request"` // description: | diff --git a/v2/pkg/protocols/file/file.go b/v2/pkg/protocols/file/file.go index 8072e1e0..3f0b3b94 100644 --- a/v2/pkg/protocols/file/file.go +++ b/v2/pkg/protocols/file/file.go @@ -26,7 +26,7 @@ type Request struct { // - value: '[]string{".avi", ".mov", ".mp3"}' ExtensionDenylist []string `yaml:"denylist,omitempty" jsonschema:"title=extensions to deny match,description=List of file extensions to deny during matching"` - // ID is the ID of the request + // ID is the the optional id of the request ID string `yaml:"id,omitempty" jsonschema:"title=id of the request,description=ID is the optional ID for the request"` // description: | diff --git a/v2/pkg/protocols/headless/headless.go b/v2/pkg/protocols/headless/headless.go index b95615ab..b4bb9845 100644 --- a/v2/pkg/protocols/headless/headless.go +++ b/v2/pkg/protocols/headless/headless.go @@ -9,7 +9,7 @@ import ( // Request contains a Headless protocol request to be made from a template type Request struct { - // ID is the ID of the request + // ID is the the optional id of the request ID string `yaml:"id,omitempty" jsonschema:"title=id of the request,description=Optional ID of the headless request"` // description: | diff --git a/v2/pkg/protocols/http/http.go b/v2/pkg/protocols/http/http.go index 09e2a469..d3fa89da 100644 --- a/v2/pkg/protocols/http/http.go +++ b/v2/pkg/protocols/http/http.go @@ -31,7 +31,7 @@ type Request struct { // value: | // []string{"GET /etc/passwd HTTP/1.1\nHost:\nContent-Length: 4", "POST /.%0d./.%0d./.%0d./.%0d./bin/sh HTTP/1.1\nHost: {{Hostname}}\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0\nContent-Length: 1\nConnection: close\n\necho\necho\ncat /etc/passwd 2>&1"} Raw []string `yaml:"raw,omitempty" jsonschema:"http requests in raw format,description=HTTP Requests in Raw Format"` - // ID is the ID of the request + // ID is the the optional id of the request ID string `yaml:"id,omitempty" jsonschema:"title=id for the http request,description=ID for the HTTP Request"` // description: | // Name is the optional name of the request. @@ -162,7 +162,7 @@ type Request struct { // This allows matching on them later for multi-request conditions. ReqCondition bool `yaml:"req-condition,omitempty" jsonschema:"title=preserve request history,description=Automatically assigns numbers to requests and preserves their history"` // description: | - // StopAtFirstMatch stops the execution of the requests as soon as a match is found. + // StopAtFirstMatch stops the execution of the requests and template as soon as a match is found. StopAtFirstMatch bool `yaml:"stop-at-first-match,omitempty" jsonschema:"title=stop at first match,description=Stop the execution after a match is found"` } diff --git a/v2/pkg/protocols/network/network.go b/v2/pkg/protocols/network/network.go index e4ea521b..1178d8f7 100644 --- a/v2/pkg/protocols/network/network.go +++ b/v2/pkg/protocols/network/network.go @@ -15,7 +15,7 @@ import ( // Request contains a Network protocol request to be made from a template type Request struct { - // ID is the ID of the request + // ID is the the optional id of the request ID string `yaml:"id,omitempty" jsonschema:"title=id of the request,description=ID of the network request"` // description: |