@@ -68,17 +68,21 @@ func executeNucleiAsLibrary(templatePath, templateURL string) ([]string, error)
68
68
cache := hosterrorscache .New (30 , hosterrorscache .DefaultMaxHostsCount , nil )
69
69
defer cache .Close ()
70
70
71
+ defaultOpts := types .DefaultOptions ()
72
+ defaultOpts .ExecutionId = "test"
73
+
71
74
mockProgress := & testutils.MockProgressClient {}
72
- reportingClient , err := reporting .New (& reporting.Options {}, "" , false )
75
+ reportingClient , err := reporting .New (& reporting.Options {ExecutionId : defaultOpts . ExecutionId }, "" , false )
73
76
if err != nil {
74
77
return nil , err
75
78
}
76
79
defer reportingClient .Close ()
77
80
78
- defaultOpts := types .DefaultOptions ()
79
81
_ = protocolstate .Init (defaultOpts )
80
82
_ = protocolinit .Init (defaultOpts )
81
83
84
+ defer protocolstate .Close (defaultOpts .ExecutionId )
85
+
82
86
defaultOpts .Templates = goflags.StringSlice {templatePath }
83
87
defaultOpts .ExcludeTags = config .ReadIgnoreFile ().Tags
84
88
@@ -100,7 +104,7 @@ func executeNucleiAsLibrary(templatePath, templateURL string) ([]string, error)
100
104
ratelimiter := ratelimit .New (context .Background (), 150 , time .Second )
101
105
defer ratelimiter .Stop ()
102
106
103
- executerOpts := protocols.ExecutorOptions {
107
+ executerOpts := & protocols.ExecutorOptions {
104
108
Output : outputWriter ,
105
109
Options : defaultOpts ,
106
110
Progress : mockProgress ,
@@ -116,7 +120,7 @@ func executeNucleiAsLibrary(templatePath, templateURL string) ([]string, error)
116
120
engine := core .New (defaultOpts )
117
121
engine .SetExecuterOptions (executerOpts )
118
122
119
- workflowLoader , err := parsers .NewLoader (& executerOpts )
123
+ workflowLoader , err := parsers .NewLoader (executerOpts )
120
124
if err != nil {
121
125
log .Fatalf ("Could not create workflow loader: %s\n " , err )
122
126
}
@@ -128,7 +132,7 @@ func executeNucleiAsLibrary(templatePath, templateURL string) ([]string, error)
128
132
}
129
133
store .Load ()
130
134
131
- _ = engine .Execute (context .Background (), store .Templates (), provider .NewSimpleInputProviderWithUrls (templateURL ))
135
+ _ = engine .Execute (context .Background (), store .Templates (), provider .NewSimpleInputProviderWithUrls (defaultOpts . ExecutionId , templateURL ))
132
136
engine .WorkPool ().Wait () // Wait for the scan to finish
133
137
134
138
return results , nil
0 commit comments