core

package
v3.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	Callback func(*output.ResultEvent) // Executed on results
	// contains filtered or unexported fields
}

Engine is an executer for running Nuclei Templates/Workflows.

The engine contains multiple thread pools which allow using different concurrency values per protocol executed.

The engine does most of the heavy lifting of execution, from clustering templates to leading to the final execution by the work pool, it is handled by the engine.

func New

func New(options *types.Options) *Engine

New returns a new Engine instance

func (*Engine) Execute

func (e *Engine) Execute(ctx context.Context, templates []*templates.Template, target provider.InputProvider) *atomic.Bool

Execute takes a list of templates/workflows that have been compiled and executes them based on provided concurrency options.

All the execution logic for the templates/workflows happens in this part of the engine.

func (*Engine) ExecuteScanWithOpts

func (e *Engine) ExecuteScanWithOpts(ctx context.Context, templatesList []*templates.Template, target provider.InputProvider, noCluster bool) *atomic.Bool

ExecuteScanWithOpts executes scan with given scanStrategy

func (*Engine) ExecuteWithResults

func (e *Engine) ExecuteWithResults(ctx context.Context, templatesList []*templates.Template, target provider.InputProvider, callback func(*output.ResultEvent)) *atomic.Bool

ExecuteWithResults a list of templates with results

func (*Engine) ExecuterOptions

func (e *Engine) ExecuterOptions() protocols.ExecutorOptions

ExecuterOptions returns protocols.ExecutorOptions for nuclei engine.

func (*Engine) GetWorkPool

func (e *Engine) GetWorkPool() *WorkPool

GetWorkPool returns a workpool from options

func (*Engine) GetWorkPoolConfig

func (e *Engine) GetWorkPoolConfig() WorkPoolConfig

func (*Engine) SetExecuterOptions

func (e *Engine) SetExecuterOptions(options protocols.ExecutorOptions)

SetExecuterOptions sets the executer options for the engine. This is required before using the engine to perform any execution.

func (*Engine) WorkPool

func (e *Engine) WorkPool() *WorkPool

WorkPool returns the worker pool for the engine

type WorkPool

type WorkPool struct {
	Headless *syncutil.AdaptiveWaitGroup
	Default  *syncutil.AdaptiveWaitGroup
	// contains filtered or unexported fields
}

WorkPool implements an execution pool for executing different types of task with different concurrency requirements.

It also allows Configuration of such requirements. This is used for per-module like separate headless concurrency etc.

func NewWorkPool

func NewWorkPool(config WorkPoolConfig) *WorkPool

NewWorkPool returns a new WorkPool instance

func (*WorkPool) InputPool

func (w *WorkPool) InputPool(templateType types.ProtocolType) *syncutil.AdaptiveWaitGroup

InputPool returns a work pool for an input type

func (*WorkPool) Refresh

func (w *WorkPool) Refresh(ctx context.Context)

func (*WorkPool) RefreshWithConfig

func (w *WorkPool) RefreshWithConfig(config WorkPoolConfig)

func (*WorkPool) Wait

func (w *WorkPool) Wait()

Wait waits for all the work pool wait groups to finish

type WorkPoolConfig

type WorkPoolConfig struct {
	// InputConcurrency is the concurrency for inputs values.
	InputConcurrency int
	// TypeConcurrency is the concurrency for the request type templates.
	TypeConcurrency int
	// HeadlessInputConcurrency is the concurrency for headless inputs values.
	HeadlessInputConcurrency int
	// TypeConcurrency is the concurrency for the headless request type templates.
	HeadlessTypeConcurrency int
}

WorkPoolConfig is the configuration for work pool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL