Add dynamic extracted values to history

dev
Ice3man543 2021-01-01 16:52:41 +05:30
parent d106ae2ef1
commit bf63eb5937
2 changed files with 8 additions and 2 deletions

View File

@ -56,7 +56,7 @@ type Result struct {
// OutputExtracts is the list of extracts to be displayed on screen.
OutputExtracts []string
// DynamicValues contains any dynamic values to be templated
DynamicValues map[string]string
DynamicValues map[string]interface{}
// PayloadValues contains payload values provided by user. (Optional)
PayloadValues map[string]interface{}
}
@ -75,7 +75,7 @@ func (r *Operators) Execute(data map[string]interface{}, match MatchFunc, extrac
result := &Result{
Matches: make(map[string]struct{}),
Extracts: make(map[string][]string),
DynamicValues: make(map[string]string),
DynamicValues: make(map[string]interface{}),
}
for _, matcher := range r.Matchers {
// Check if the matcher matched

View File

@ -197,6 +197,12 @@ func (e *Request) ExecuteWithResults(reqURL string, dynamicValues map[string]int
if err != nil {
requestErr = multierr.Append(requestErr, err)
} else {
// Add the extracts to the dynamic values if any.
for _, o := range output {
if o.OperatorsResult != nil {
dynamicValues = generators.MergeMaps(dynamicValues, o.OperatorsResult.DynamicValues)
}
}
outputs = append(outputs, output...)
}
e.options.Progress.IncrementRequests()