Path: blob/dev/pkg/protocols/offlinehttp/offlinehttp.go
2070 views
package offlinehttp12import (3"github.com/pkg/errors"45"github.com/projectdiscovery/nuclei/v3/pkg/operators"6"github.com/projectdiscovery/nuclei/v3/pkg/protocols"7)89// Request is a offline http response processing request10type Request struct {11options *protocols.ExecutorOptions12compiledOperators []*operators.Operators13}1415// RequestPartDefinitions contains a mapping of request part definitions and their16// description. Multiple definitions are separated by commas.17// Definitions not having a name (generated on runtime) are prefixed & suffixed by <>.18var RequestPartDefinitions = map[string]string{19"template-id": "ID of the template executed",20"template-info": "Info Block of the template executed",21"template-path": "Path of the template executed",22"host": "Host is the input to the template",23"matched": "Matched is the input which was matched upon",24"type": "Type is the type of request made",25"request": "HTTP request made from the client",26"response": "HTTP response received from server",27"status_code": "Status Code received from the Server",28"body": "HTTP response body received from server (default)",29"content_length": "HTTP Response content length",30"header,all_headers": "HTTP response headers",31"duration": "HTTP request time duration",32"all": "HTTP response body + headers",33"cookies_from_response": "HTTP response cookies in name:value format",34"headers_from_response": "HTTP response headers in name:value format",35}3637// GetID returns the unique ID of the request if any.38func (request *Request) GetID() string {39return ""40}4142// Compile compiles the protocol request for further execution.43func (request *Request) Compile(options *protocols.ExecutorOptions) error {44for _, operator := range options.Operators {45if err := operator.Compile(); err != nil {46return errors.Wrap(err, "could not compile operators")47}48request.compiledOperators = append(request.compiledOperators, operator)49}50request.options = options51return nil52}5354// Requests returns the total number of requests the YAML rule will perform55func (request *Request) Requests() int {56return 157}585960