queue

package
v2.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrQueueFull = errors.New("queue channel is full")
)

Functions

This section is empty.

Types

type Factory

type Factory interface {
	Create(maxJobs int) Queue
	Type() Type
}

func NewEndlessQueueFactory

func NewEndlessQueueFactory() Factory

func NewSimpleQueueFactory

func NewSimpleQueueFactory() Factory

type Job

type Job struct {
	Exploit *models.Exploit
	Target  *models.Target
	// contains filtered or unexported fields
}

func NewJob

func NewJob(
	exploit *models.Exploit,
	target *models.Target,
	executable, dir string,
	environ []string,
	timeout time.Duration,
	logger *joblogger.JobLogger,
) *Job

func (*Job) Command

func (t *Job) Command(ctx context.Context) *exec.Cmd

func (*Job) String

func (t *Job) String() string

type Metrics

type Metrics struct {
	ExploitInstancesRunning *prometheus.GaugeVec
	ExploitsFinished        *prometheus.CounterVec
	ExploitsFailed          *prometheus.CounterVec
	ExploitRunTime          *prometheus.HistogramVec

	MaxJobs prometheus.Gauge
}

func NewMetrics

func NewMetrics(namespace, id string, queueType Type) *Metrics

type Output

type Output struct {
	Exploit *models.Exploit
	Target  *models.Target
	Out     []byte
}

func NewOutput

func NewOutput(job *Job, out []byte) *Output

func (*Output) String

func (o *Output) String() string

type Queue

type Queue interface {
	Start(context.Context)
	Add(*Job) error
	Results() <-chan *Output
	Type() Type

	fmt.Stringer
}

func NewEndlessQueue

func NewEndlessQueue(maxJobs int) Queue

func NewSimpleQueue

func NewSimpleQueue(maxJobs int) Queue

type Type

type Type string
const (
	TypeSimple  Type = "simple"
	TypeEndless Type = "endless"
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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