From b526b19273190686ebde447e5e00ee479254ab71 Mon Sep 17 00:00:00 2001 From: "alban.stourbe stourbe" Date: Mon, 15 Jul 2024 15:11:40 +0200 Subject: [PATCH 1/2] Add Workflows SDK scan --- lib/sdk.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/sdk.go b/lib/sdk.go index 60f5255bcd..4ee21057a4 100644 --- a/lib/sdk.go +++ b/lib/sdk.go @@ -243,7 +243,15 @@ func (e *NucleiEngine) ExecuteCallbackWithCtx(ctx context.Context, callback ...f } e.resultCallbacks = append(e.resultCallbacks, filtered...) - _ = e.engine.ExecuteScanWithOpts(ctx, e.store.Templates(), e.inputProvider, false) + finalTemplates := []*templates.Template{} + finalTemplates = append(finalTemplates, e.store.Templates()...) + finalTemplates = append(finalTemplates, e.store.Workflows()...) + + if len(finalTemplates) == 0 { + return ErrNoTemplatesAvailable + } + + _ = e.engine.ExecuteScanWithOpts(ctx, finalTemplates, e.inputProvider, false) defer e.engine.WorkPool().Wait() return nil } From c6a9e36c9ade6edc364f3b295d8d5a6f25352554 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Thu, 1 Aug 2024 15:48:07 +0200 Subject: [PATCH 2/2] minor --- lib/sdk.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/sdk.go b/lib/sdk.go index 4ee21057a4..04b084f244 100644 --- a/lib/sdk.go +++ b/lib/sdk.go @@ -243,15 +243,12 @@ func (e *NucleiEngine) ExecuteCallbackWithCtx(ctx context.Context, callback ...f } e.resultCallbacks = append(e.resultCallbacks, filtered...) - finalTemplates := []*templates.Template{} - finalTemplates = append(finalTemplates, e.store.Templates()...) - finalTemplates = append(finalTemplates, e.store.Workflows()...) - - if len(finalTemplates) == 0 { + templatesAndWorkflows := append(e.store.Templates(), e.store.Workflows()...) + if len(templatesAndWorkflows) == 0 { return ErrNoTemplatesAvailable } - _ = e.engine.ExecuteScanWithOpts(ctx, finalTemplates, e.inputProvider, false) + _ = e.engine.ExecuteScanWithOpts(ctx, templatesAndWorkflows, e.inputProvider, false) defer e.engine.WorkPool().Wait() return nil }