engine

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HistoryReplayable

func HistoryReplayable(conf *ffuf.Config) (bool, string)

func ResultPassesFilters

func ResultPassesFilters(result ffuf.Result, filters map[string]ffuf.FilterProvider, mode string) (bool, error)

ResultPassesFilters applies a filter set to the metrics retained for an already-observed result. It mirrors ffuf's OR/AND filter semantics without inventing response content that the high-throughput web output deliberately does not store. Regexp filtering is therefore unavailable post-start.

func WriteHistoryEntry

func WriteHistoryEntry(conf *ffuf.Config) (string, error)

Types

type ConfigOptionsHistory

type ConfigOptionsHistory struct {
	ffuf.ConfigOptions
	Time time.Time `json:"time"`
}

func SearchHash

func SearchHash(hash string) ([]ConfigOptionsHistory, int, error)

type Job

type Job struct {
	AuditLogger  ffuf.AuditLogger
	Config       *ffuf.Config
	Input        ffuf.InputProvider
	Runner       ffuf.RunnerProvider
	ReplayRunner ffuf.RunnerProvider
	Scraper      ffuf.Scraper
	Output       ffuf.OutputProvider
	Jobhash      string
	Total        int
	Rate         *RateThrottle
	// contains filtered or unexported fields
}

Job ties together Config, Runner, Input and Output

func NewJob

func NewJob(conf *ffuf.Config) *Job

func (*Job) AddFilters

func (j *Job) AddFilters(options map[string]string) error

AddFilters atomically appends metric filters to a running job. Live filter changes are restricted to OR mode because appending a new predicate in AND mode can make previously hidden responses visible, and those responses were never retained by the output pipeline. In OR mode additions are monotonic: they affect future match decisions and can safely be replayed over persisted findings without requiring a scan restart.

func (*Job) BeginRunTransportAttempt

func (j *Job) BeginRunTransportAttempt()

func (*Job) Calibrate

func (j *Job) Calibrate(input map[string][]byte) error

CalibrateResponses returns slice of Responses for randomly generated filter autocalibration requests

func (*Job) CalibrateForHost

func (j *Job) CalibrateForHost(host string, baseinput map[string][]byte) error

CalibrateForHost runs autocalibration for a specific host

func (*Job) CalibrateIfNeeded

func (j *Job) CalibrateIfNeeded(host string, input map[string][]byte) error

CalibrateIfNeeded runs a self-calibration task for filtering options (if needed) by requesting random resources and

configuring the filters accordingly

func (*Job) CheckStop

func (j *Job) CheckStop()

CheckStop stops the job if stopping conditions are met

func (*Job) DeleteQueueItem

func (j *Job) DeleteQueueItem(index int)

DeleteQueueItem deletes a recursion job from the queue by its index in the slice

func (*Job) EndRunTransportAttempt

func (j *Job) EndRunTransportAttempt()

func (*Job) Next

func (j *Job) Next()

Stop current, resume to next

func (*Job) Pause

func (j *Job) Pause()

Pause pauses the job process. The pause gate is a sync.RWMutex: while Pause holds the write lock, every worker blocks at its pauseCheckpoint (an RLock).

pauseStateMutex makes the paused-flag flip and the pauseMutex Lock/Unlock a single atomic step, so there is exactly one Lock per Unlock and no goroutine ever unlocks an unlocked mutex (a fatal panic), however Pause, Resume, and the SIGINT handler interleave.

Pausing is refused once the job is stopping (isRunning is false). Together with Stop() calling Resume(), that guarantees the gate always ends OPEN after a Stop regardless of ordering, so a Pause racing a Stop can never strand a worker at the checkpoint with no Resume left to wake it.

func (*Job) QueuedJobs

func (j *Job) QueuedJobs() []QueueJob

QueuedJobs returns the slice of queued recursive jobs

func (*Job) RecordRunTransportAttempt

func (j *Job) RecordRunTransportAttempt(attempt ffuf.RunTransportAttempt)

func (*Job) Reset

func (j *Job) Reset(cycle bool)

Reset resets the counters and wordlist position for a job

func (*Job) Resume

func (j *Job) Resume()

Resume resumes the job process

func (*Job) SetExternallyManaged

func (j *Job) SetExternallyManaged(managed bool)

SetExternallyManaged configures lifecycle ownership for an embedded Job. Call it before Start. Managed jobs leave process signal handling to their host and retain Pause/Resume support when Config.Noninteractive is true.

func (*Job) SkipQueue

func (j *Job) SkipQueue()

SkipQueue allows to skip the current job and advance to the next queued recursion job

func (*Job) Snapshot

func (j *Job) Snapshot() JobSnapshot

Snapshot returns a point-in-time view of lifecycle state and progress. All mutable fields are read through the same atomics and locks used by the engine.

func (*Job) Start

func (j *Job) Start()

Start the execution of the Job

func (*Job) Stop

func (j *Job) Stop()

Stop the execution of the Job

type JobSnapshot

type JobSnapshot struct {
	Running      bool          `json:"running"`
	RunningJob   bool          `json:"running_job"`
	Paused       bool          `json:"paused"`
	Progress     ffuf.Progress `json:"progress"`
	Error        string        `json:"error,omitempty"`
	StartedAt    time.Time     `json:"started_at"`
	StartedAtJob time.Time     `json:"started_at_job"`
}

JobSnapshot is an immutable, race-safe view of a Job's lifecycle and progress. It is intended for embedders that need to render status while the job is running without reaching into Job's mutable internals.

type QueueJob

type QueueJob struct {
	Url string
	// contains filtered or unexported fields
}

type RateThrottle

type RateThrottle struct {
	Config      *ffuf.Config
	RateMutex   sync.Mutex
	RateLimiter *time.Ticker
	// contains filtered or unexported fields
}

func NewRateThrottle

func NewRateThrottle(conf *ffuf.Config) *RateThrottle

func (*RateThrottle) ChangeRate

func (r *RateThrottle) ChangeRate(rate int)

func (*RateThrottle) CurrentConfiguredRate

func (r *RateThrottle) CurrentConfiguredRate() int64

CurrentConfiguredRate returns the configured rate under the lock, for callers (e.g. the interactive handler) that only need to display it.

func (*RateThrottle) CurrentRate

func (r *RateThrottle) CurrentRate() int64

CurrentRate reports processed wordlist inputs over a rolling one-second window. Progress rendering can poll every few milliseconds while HTTP/3 completions arrive in batches. Sampling those tiny intervals made the displayed value alternate between zero and implausibly high spikes. Keeping sparse snapshots makes the display stable; Tick only adds atomic counter/activity updates.

func (*RateThrottle) Tick

func (r *RateThrottle) Tick()

Tick records one completed input. It remains lock-free and allocation-free; the timestamp lets CurrentRate prove a full quiet window even when progress rendering did not poll between the burst and the idle period.

func (*RateThrottle) Wait

func (r *RateThrottle) Wait()

Wait blocks until a configured rate-limit token is available. The common unlimited path is one atomic load and no timer/channel operation. If the rate changes while a caller is waiting, changed wakes it to re-evaluate rather than leaving it blocked on a ticker that was just stopped.

Jump to

Keyboard shortcuts

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