Skip to content

Commit

Permalink
deprecate iterate-all+ missing multi-proto implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
tarunKoyalwar committed Aug 10, 2023
1 parent aa5da2b commit ab36aee
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion v2/pkg/protocols/code/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ func (request *Request) ExecuteWithResults(input *contextargs.Context, dynamicVa

// inject all template context values as gozero env variables
variables := protocolutils.GenerateVariables(input.MetaInput.Input, false, nil)
// add template context values
variables = generators.MergeMaps(variables, request.options.TemplateCtx.GetAll())
// optionvars are vars passed from CLI or env variables
optionVars := generators.BuildPayloadFromOptions(request.options.Options)
variablesMap := request.options.Variables.Evaluate(variables)
variables = generators.MergeMaps(variablesMap, variables, optionVars)
variables = generators.MergeMaps(variablesMap, variables, optionVars, request.options.Constants)
for name, value := range variables {
v := fmt.Sprint(value)
v, interactshURLs = request.options.Interactsh.Replace(v, interactshURLs)
Expand Down Expand Up @@ -153,6 +155,13 @@ func (request *Request) ExecuteWithResults(input *contextargs.Context, dynamicVa
data["template-id"] = request.options.TemplateID
data["template-info"] = request.options.TemplateInfo

// expose response variables in proto_var format
// this is no-op if the template is not a multi protocol template
request.options.AddTemplateVars(request.Type(), request.ID, data)

// add variables from template context before matching/extraction
data = generators.MergeMaps(data, request.options.TemplateCtx.GetAll())

if request.options.Interactsh != nil {
request.options.Interactsh.MakePlaceholders(interactshURLs, data)
}
Expand Down
1 change: 1 addition & 0 deletions v2/pkg/protocols/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ type Request struct {
SkipVariablesCheck bool `yaml:"skip-variables-check,omitempty" json:"skip-variables-check,omitempty" jsonschema:"title=skip variable checks,description=Skips the check for unresolved variables in request"`
// description: |
// IterateAll iterates all the values extracted from internal extractors
// Deprecated: Use flow instead . iterate-all will be removed in future releases
IterateAll bool `yaml:"iterate-all,omitempty" json:"iterate-all,omitempty" jsonschema:"title=iterate all the values,description=Iterates all the values extracted from internal extractors"`
// description: |
// DigestAuthUsername specifies the username for digest authentication
Expand Down
2 changes: 1 addition & 1 deletion v2/pkg/protocols/multi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ to make response fields of that protocol available to global context
outputEvent := request.responseToDSLMap(compiledRequest, response, domain, question, traceData)
// expose response variables in proto_var format
// this is no-op if the template is not a multi protocol template
request.options.AddTemplateVars(request.Type(), outputEvent)
request.options.AddTemplateVars(request.Type(),request.ID, outputEvent)
```

- Append all available template context values to outputEvent
Expand Down

0 comments on commit ab36aee

Please sign in to comment.