exposing dynamicvalues to ongoing iteration
package operators
import (
+ "fmt"
"strconv"
"github.com/pkg/errors"
"github.com/projectdiscovery/nuclei/v2/pkg/operators/extractors"
"github.com/projectdiscovery/nuclei/v2/pkg/operators/matchers"
+ "github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/generators"
"github.com/projectdiscovery/sliceutil"
)
@@ -217,6 +219,23 @@ func (operators *Operators) Execute(data map[string]interface{}, match MatchFunc
}
}
+ // expose dynamic values to same request matchers
+ if len(result.DynamicValues) > 0 {
+ dataDynamicValues := make(map[string]interface{})
+ for dynName, dynValues := range result.DynamicValues {
+ if len(dynValues) > 1 {
+ for dynIndex, dynValue := range dynValues {
+ dynKeyName := fmt.Sprintf("%s%d", dynName, dynIndex)
+ dataDynamicValues[dynKeyName] = dynValue
+ }
+ } else {
+ dataDynamicValues[dynName] = dynValues[0]
+ }
+
+ }
+ data = generators.MergeMaps(data, dataDynamicValues)
+ }
+
for matcherIndex, matcher := range operators.Matchers {
if isMatch, matched := match(data, matcher); isMatch {
if isDebug { // matchers without an explicit name or with AND condition should only be made visible if debug is enabled
