perf(sdk): sdk functions to access workflow store

This commit is contained in:
chuu 2024-10-24 14:34:50 +08:00
parent 49811d24a1
commit 8a4be44631

View File

@ -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