mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2026-11-07 17:43:04 -10:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49974403f7 | ||
|
|
7f0026b090 |
No files matched your search
@@ -2,6 +2,7 @@ package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
@@ -132,6 +133,7 @@ func (e *Engine) executeTemplateSpray(ctx context.Context, templatesList []*temp
|
||||
wg.Add()
|
||||
go func(tpl *templates.Template) {
|
||||
defer wg.Done()
|
||||
fmt.Printf("[spray] executing template: %s\n", tpl.ID)
|
||||
// All other request types are executed here
|
||||
// Note: executeTemplateWithTargets creates goroutines and blocks
|
||||
// given template is executed on all targets
|
||||
|
||||
@@ -2,6 +2,7 @@ package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
@@ -78,8 +79,10 @@ func (e *Engine) executeTemplateWithTargets(ctx context.Context, template *templ
|
||||
}
|
||||
|
||||
target.Iterate(func(scannedValue *contextargs.MetaInput) bool {
|
||||
fmt.Printf("[iter] iterating target: %s %s\n", template.ID, scannedValue.Input)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
fmt.Printf("[iter] ctx done: %s %s\n", template.ID, scannedValue.Input)
|
||||
return false // exit
|
||||
default:
|
||||
}
|
||||
@@ -108,6 +111,7 @@ func (e *Engine) executeTemplateWithTargets(ctx context.Context, template *templ
|
||||
|
||||
// Skip if the host has had errors
|
||||
if e.executerOpts.HostErrorsCache != nil && e.executerOpts.HostErrorsCache.Check(e.executerOpts.ProtocolType.String(), contextargs.NewWithMetaInput(ctx, scannedValue)) {
|
||||
fmt.Printf("[iter] host error: %s %s\n", template.ID, scannedValue.Input)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -116,6 +120,7 @@ func (e *Engine) executeTemplateWithTargets(ctx context.Context, template *templ
|
||||
defer wg.Done()
|
||||
defer cleanupInFlight(index)
|
||||
if skip {
|
||||
fmt.Printf("[iter] skip: %s %s\n", template.ID, value.Input)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -128,6 +133,7 @@ func (e *Engine) executeTemplateWithTargets(ctx context.Context, template *templ
|
||||
case types.WorkflowProtocol:
|
||||
match = e.executeWorkflow(ctx, template.CompiledWorkflow)
|
||||
default:
|
||||
fmt.Printf("[iter] executing template: %s %s\n", template.ID, value.Input)
|
||||
if e.Callback != nil {
|
||||
if results, err := template.Executer.ExecuteWithResults(ctx); err == nil {
|
||||
for _, result := range results {
|
||||
@@ -139,7 +145,9 @@ func (e *Engine) executeTemplateWithTargets(ctx context.Context, template *templ
|
||||
match, err = template.Executer.Execute(ctx)
|
||||
}
|
||||
}
|
||||
fmt.Printf("[iter] match: %s %s %v\n", template.ID, value.Input, match)
|
||||
if err != nil {
|
||||
fmt.Printf("[iter] error: %s %s\n", template.ID, value.Input)
|
||||
gologger.Warning().Msgf("[%s] Could not execute step on %s: %s\n", e.executerOpts.Colorizer.BrightBlue(template.ID), value.Input, err)
|
||||
}
|
||||
results.CompareAndSwap(false, match)
|
||||
|
||||
Reference in new issue
Block a user