From 8a4be4463196f9c85223eabf08716361a287ed8d Mon Sep 17 00:00:00 2001 From: chuu <602484935@qq.com> Date: Thu, 24 Oct 2024 14:34:50 +0800 Subject: [PATCH] perf(sdk): sdk functions to access workflow store --- lib/sdk.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/sdk.go b/lib/sdk.go index 9bd46f476..7f2ec5bcc 100644 --- a/lib/sdk.go +++ b/lib/sdk.go @@ -112,6 +112,14 @@ func (e *NucleiEngine) GetTemplates() []*templates.Template { return e.store.Templates() } +// GetWorkflows returns all nuclei workflows that are loaded +func (e *NucleiEngine) GetWorkflows() []*templates.Template { + if !e.templatesLoaded { + _ = e.LoadAllTemplates() + } + return e.store.Workflows() +} + // LoadTargets(urls/domains/ips only) adds targets to the nuclei engine func (e *NucleiEngine) LoadTargets(targets []string, probeNonHttp bool) { for _, target := range targets { @@ -271,6 +279,11 @@ func (e *NucleiEngine) Engine() *core.Engine { return e.engine } +// Store returns store of nuclei +func (e *NucleiEngine) Store() *loader.Store { + return e.store +} + // NewNucleiEngineCtx creates a new nuclei engine instance with given context func NewNucleiEngineCtx(ctx context.Context, options ...NucleiSDKOptions) (*NucleiEngine, error) { // default options