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

View File

@ -197,6 +197,12 @@ func (e *Request) ExecuteWithResults(reqURL string, dynamicValues map[string]int
if err != nil { if err != nil {
requestErr = multierr.Append(requestErr, err) requestErr = multierr.Append(requestErr, err)
} else { } 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...) outputs = append(outputs, output...)
} }
e.options.Progress.IncrementRequests() e.options.Progress.IncrementRequests()