From d0463e8ca39cf28e5e25b6426d041eab4c30b569 Mon Sep 17 00:00:00 2001 From: "alban.stourbe stourbe" Date: Mon, 30 Sep 2024 16:52:54 +0200 Subject: [PATCH] Add vars with SDK --- lib/config.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/config.go b/lib/config.go index 7a9419aa50..e2a56c1375 100644 --- a/lib/config.go +++ b/lib/config.go @@ -392,6 +392,20 @@ func WithHeaders(headers []string) NucleiSDKOptions { } } +// WithVars allows setting custom variables to use in templates/workflows context +func WithVars(vars []string) NucleiSDKOptions { + // Create a goflags.RuntimeMap + runtimeVars := goflags.RuntimeMap{} + for _, v := range vars { + runtimeVars.Set(v) + } + + return func(e *NucleiEngine) error { + e.opts.Vars = runtimeVars + return nil + } +} + // EnablePassiveMode allows enabling passive HTTP response processing mode func EnablePassiveMode() NucleiSDKOptions { return func(e *NucleiEngine) error {