mirror of https://github.com/daffainfo/nuclei.git
parent
b64d422b67
commit
305ac6a143
|
@ -1,18 +0,0 @@
|
|||
id: basic-example
|
||||
|
||||
info:
|
||||
name: Test HTTP Template
|
||||
author: pdteam
|
||||
severity: info
|
||||
|
||||
http:
|
||||
- raw:
|
||||
- |+
|
||||
GET / HTTP/1.1
|
||||
Host: {{Hostname}}
|
||||
|
||||
unsafe: true
|
||||
matchers:
|
||||
- type: dsl
|
||||
dsl:
|
||||
- true
|
|
@ -25,14 +25,23 @@ func (e *Engine) executeWorkflow(input *contextargs.MetaInput, w *workflows.Work
|
|||
ctxArgs.MetaInput = input
|
||||
ctxArgs.CookieJar = workflowCookieJar
|
||||
|
||||
swg := sizedwaitgroup.New(w.Options.Options.TemplateThreads)
|
||||
// we can know the nesting level only at runtime, so the best we can do here is increase template threads by one unit in case it's equal to 1 to allow
|
||||
// at least one subtemplate to go through, which it's idempotent to one in-flight template as the parent one is in an idle state
|
||||
templateThreads := w.Options.Options.TemplateThreads
|
||||
if templateThreads == 1 {
|
||||
templateThreads++
|
||||
}
|
||||
swg := sizedwaitgroup.New(templateThreads)
|
||||
|
||||
for _, template := range w.Workflows {
|
||||
swg.Add()
|
||||
|
||||
func(template *workflows.WorkflowTemplate) {
|
||||
defer swg.Done()
|
||||
|
||||
if err := e.runWorkflowStep(template, ctxArgs, results, &swg, w); err != nil {
|
||||
gologger.Warning().Msgf(workflowStepExecutionError, template.Template, err)
|
||||
}
|
||||
swg.Done()
|
||||
}(template)
|
||||
}
|
||||
swg.Wait()
|
||||
|
@ -126,10 +135,11 @@ func (e *Engine) runWorkflowStep(template *workflows.WorkflowTemplate, input *co
|
|||
swg.Add()
|
||||
|
||||
go func(subtemplate *workflows.WorkflowTemplate) {
|
||||
defer swg.Done()
|
||||
|
||||
if err := e.runWorkflowStep(subtemplate, input, results, swg, w); err != nil {
|
||||
gologger.Warning().Msgf(workflowStepExecutionError, subtemplate.Template, err)
|
||||
}
|
||||
swg.Done()
|
||||
}(subtemplate)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ func Parse(filePath string, preprocessor Preprocessor, options protocols.Executo
|
|||
|
||||
var reader io.ReadCloser
|
||||
if utils.IsURL(filePath) {
|
||||
//todo:instead of creating a new client each time, a default one should be reused (same as the standard library)
|
||||
// use retryablehttp (tls verification is enabled by default in the standard library)
|
||||
resp, err := retryablehttp.DefaultClient().Get(filePath)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue