mirror of https://github.com/daffainfo/nuclei.git
Reworked self-contained requests to template
parent
6e7318bcba
commit
612ab61df4
|
@ -138,8 +138,9 @@ type Request struct {
|
|||
dynamicValues map[string]interface{}
|
||||
|
||||
// description: |
|
||||
// Self Contained marks HTTP Requests for the template as self-contained
|
||||
SelfContained bool `yaml:"self-contained,omitempty" jsonschema:"title=mark http requests as self-contained,description=Mark HTTP Requests for the template as self-contained"`
|
||||
// SelfContained specifies if the request is self contained.
|
||||
SelfContained bool `yaml:"-" json:"-"`
|
||||
|
||||
// description: |
|
||||
// CookieReuse is an optional setting that enables cookie reuse for
|
||||
// all requests defined in raw section.
|
||||
|
|
|
@ -60,9 +60,10 @@ type Request struct {
|
|||
// examples:
|
||||
// - value: "2048"
|
||||
ReadSize int `yaml:"read-size,omitempty" jsonschema:"title=size of network response to read,description=Size of response to read at the end. Default is 1024 bytes"`
|
||||
|
||||
// description: |
|
||||
// Self Contained marks Network Requests for the template as self-contained
|
||||
SelfContained bool `yaml:"self-contained,omitempty" jsonschema:"title=mark network requests as self-contained,description=Mark Network Requests for the template as self-contained"`
|
||||
// SelfContained specifies if the request is self contained.
|
||||
SelfContained bool `yaml:"-" json:"-"`
|
||||
|
||||
// Operators for the current request go here.
|
||||
operators.Operators `yaml:",inline,omitempty"`
|
||||
|
|
|
@ -144,6 +144,21 @@ func Parse(filePath string, preprocessor Preprocessor, options protocols.Execute
|
|||
}
|
||||
template.Path = filePath
|
||||
|
||||
template.parseSelfContainedRequests()
|
||||
|
||||
parsedTemplatesCache.Store(filePath, template, err)
|
||||
return template, nil
|
||||
}
|
||||
|
||||
// parseSelfContainedRequests parses the self contained template requests.
|
||||
func (t *Template) parseSelfContainedRequests() {
|
||||
if !t.SelfContained {
|
||||
return
|
||||
}
|
||||
for _, request := range t.RequestsHTTP {
|
||||
request.SelfContained = true
|
||||
}
|
||||
for _, request := range t.RequestsNetwork {
|
||||
request.SelfContained = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,10 @@ type Template struct {
|
|||
workflows.Workflow `yaml:",inline,omitempty" jsonschema:"title=workflows to run,description=Workflows to run for the template"`
|
||||
CompiledWorkflow *workflows.Workflow `yaml:"-" json:"-" jsonschema:"-"`
|
||||
|
||||
// description: |
|
||||
// Self Contained marks Network Requests for the template as self-contained
|
||||
SelfContained bool `yaml:"self-contained,omitempty" jsonschema:"title=mark requests as self-contained,description=Mark Requests for the template as self-contained"`
|
||||
|
||||
// TotalRequests is the total number of requests for the template.
|
||||
TotalRequests int `yaml:"-" json:"-"`
|
||||
// Executer is the actual template executor for running template requests
|
||||
|
|
Loading…
Reference in New Issue