mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 17:35:28 +00:00
Ensure Headless protocol accesses flow protocol variables (#6003)
This commit is contained in:
parent
540711cf9d
commit
d77eab6e87
@ -52,14 +52,13 @@ func (request *Request) ExecuteWithResults(input *contextargs.Context, metadata,
|
||||
}
|
||||
|
||||
vars := protocolutils.GenerateVariablesWithContextArgs(input, false)
|
||||
payloads := generators.BuildPayloadFromOptions(request.options.Options)
|
||||
optionVars := generators.BuildPayloadFromOptions(request.options.Options)
|
||||
// add templatecontext variables to varMap
|
||||
values := generators.MergeMaps(vars, metadata, payloads)
|
||||
if request.options.HasTemplateCtx(input.MetaInput) {
|
||||
values = generators.MergeMaps(values, request.options.GetTemplateCtx(input.MetaInput).GetAll())
|
||||
vars = generators.MergeMaps(vars, metadata, optionVars, request.options.GetTemplateCtx(input.MetaInput).GetAll())
|
||||
}
|
||||
variablesMap := request.options.Variables.Evaluate(values)
|
||||
payloads = generators.MergeMaps(variablesMap, payloads, request.options.Constants)
|
||||
variablesMap := request.options.Variables.Evaluate(vars)
|
||||
vars = generators.MergeMaps(vars, variablesMap, request.options.Constants)
|
||||
|
||||
// check for operator matches by wrapping callback
|
||||
gotmatches := false
|
||||
@ -71,7 +70,7 @@ func (request *Request) ExecuteWithResults(input *contextargs.Context, metadata,
|
||||
}
|
||||
// verify if fuzz elaboration was requested
|
||||
if len(request.Fuzzing) > 0 {
|
||||
return request.executeFuzzingRule(input, payloads, previous, wrappedCallback)
|
||||
return request.executeFuzzingRule(input, vars, previous, wrappedCallback)
|
||||
}
|
||||
if request.generator != nil {
|
||||
iterator := request.generator.NewIterator()
|
||||
@ -83,13 +82,13 @@ func (request *Request) ExecuteWithResults(input *contextargs.Context, metadata,
|
||||
if gotmatches && (request.StopAtFirstMatch || request.options.Options.StopAtFirstMatch || request.options.StopAtFirstMatch) {
|
||||
return nil
|
||||
}
|
||||
value = generators.MergeMaps(value, payloads)
|
||||
value = generators.MergeMaps(value, vars)
|
||||
if err := request.executeRequestWithPayloads(input, value, previous, wrappedCallback); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
value := maps.Clone(payloads)
|
||||
value := maps.Clone(vars)
|
||||
if err := request.executeRequestWithPayloads(input, value, previous, wrappedCallback); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user