core

package
v3.1.7 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 16 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChildExecuter

type ChildExecuter struct {
	// contains filtered or unexported fields
}

func (*ChildExecuter) Close

func (e *ChildExecuter) Close() *atomic.Bool

Close closes the executer returning bool results

func (*ChildExecuter) Execute

func (e *ChildExecuter) Execute(template *templates.Template, value *contextargs.MetaInput)

Execute executes a template and URLs

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) ChildExecuter

func (e *Engine) ChildExecuter() *ChildExecuter

ExecuteWithOpts executes with the full options

func (*Engine) Execute

func (e *Engine) Execute(templates []*templates.Template, target 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(templatesList []*templates.Template, target InputProvider, noCluster bool) *atomic.Bool

ExecuteScanWithOpts executes scan with given scanStrategy

func (*Engine) ExecuteWithResults

func (e *Engine) ExecuteWithResults(templatesList []*templates.Template, target 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) 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 InputProvider

type InputProvider interface {
	// Count returns the number of items for input provider
	Count() int64
	// Scan iterates the input and each found item is passed to the
	// callback consumer.
	Scan(callback func(value *contextargs.MetaInput) bool)
	// Set adds item to input provider
	Set(value string)
}

InputProvider is an input providing interface for the nuclei execution engine.

An example InputProvider implementation is provided in form of hybrid input provider in pkg/core/inputs/hybrid/hmap.go

type InputWorkPool

type InputWorkPool struct {
	WaitGroup *sizedwaitgroup.SizedWaitGroup
}

InputWorkPool is a work pool per-input

type WorkPool

type WorkPool struct {
	Headless *sizedwaitgroup.SizedWaitGroup
	Default  *sizedwaitgroup.SizedWaitGroup
	// 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) *InputWorkPool

InputPool returns a work pool for an input type

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

Directories

Path Synopsis
hybrid
Package hybrid implements a hybrid hmap/filekv backed input provider for nuclei that can either stream or store results using different kv stores.
Package hybrid implements a hybrid hmap/filekv backed input provider for nuclei that can either stream or store results using different kv stores.

Jump to

Keyboard shortcuts

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