Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/tmplexec/utils/utils.go
2070 views
1
package utils
2
3
import (
4
"strings"
5
6
"github.com/projectdiscovery/nuclei/v3/pkg/output"
7
mapsutil "github.com/projectdiscovery/utils/maps"
8
)
9
10
// FillPreviousEvent is a helper function to get the previous event from the event
11
// without leading to duplicate prefixes
12
func FillPreviousEvent(reqID string, event *output.InternalWrappedEvent, previous *mapsutil.SyncLockMap[string, any]) {
13
if reqID == "" {
14
return
15
}
16
17
for k, v := range event.InternalEvent {
18
if _, ok := previous.Get(k); ok {
19
continue
20
}
21
22
if strings.HasPrefix(k, reqID+"_") {
23
continue
24
}
25
26
var builder strings.Builder
27
28
builder.WriteString(reqID)
29
builder.WriteString("_")
30
builder.WriteString(k)
31
32
_ = previous.Set(builder.String(), v)
33
}
34
}
35
36