jobs

package
v2.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package jobs holds the structures for Agent jobs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

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

Info is a structure for holding data for single task assigned to a single agent

func NewInfo

func NewInfo(agent uuid.UUID, jobType string, cmd string) Info

NewInfo is a factory to return an Info structure used to track a job's status

func NewInfoWithID added in v2.1.2

func NewInfoWithID(agent uuid.UUID, jobType string, cmd string, id string, token uuid.UUID) Info

func (*Info) Active

func (i *Info) Active()

Active set's the Job Info status to "active"

func (*Info) AgentID

func (i *Info) AgentID() uuid.UUID

AgentID returns the associated Agent's ID

func (*Info) Cancel

func (i *Info) Cancel()

Cancel set's the Job Info status to "canceled"

func (*Info) Command

func (i *Info) Command() string

Command returns the command associated with the Job

func (*Info) Complete

func (i *Info) Complete()

Complete set's the Job Info status to "complete"

func (*Info) Completed

func (i *Info) Completed() time.Time

Completed returns the time of when the Job completed

func (*Info) Created

func (i *Info) Created() time.Time

Created returns the time of when the Job was created

func (*Info) ID

func (i *Info) ID() string

ID returns the Job's unique identifier

func (*Info) Send

func (i *Info) Send()

Send set's the Job Info status to "sent"

func (*Info) Sent

func (i *Info) Sent() time.Time

Sent returns the time of when the Job was sent

func (*Info) Status

func (i *Info) Status() Status

Status returns the Job's status

func (*Info) StatusString

func (i *Info) StatusString() string

StatusString returns the Job's status as a string

func (*Info) Token

func (i *Info) Token() uuid.UUID

Token returns the Job's token

type Repository

type Repository interface {
	// Add the Job and associated Info tracking structure to the repository
	Add(job jobs2.Job, info Info)
	// Clear removes all Jobs that have not already been sent to the associated Agent
	Clear(agentID uuid.UUID) error
	// ClearAll removes all Jobs that have not already been sent for ALL Agents
	ClearAll() error
	// GetAll returns all Job Info tracking structures as map to be iterated over
	GetAll() map[string]Info
	// GetInfo returns the Job Info tracking structure for the associate Job ID
	GetInfo(jobID string) (Info, error)
	// GetJobs returns all jobs waiting to be sent to the associated Agent
	GetJobs(agentID uuid.UUID) ([]jobs2.Job, error)
	// UpdateInfo replaces the Job Info tracking structure with the one provided
	UpdateInfo(info Info) error
}

type Status

type Status int
const (
	UNDEFINED Status = iota
	// CREATED is used to denote that job has been created
	CREATED
	// SENT is used to denote that the job has been sent to the Agent
	SENT
	// RETURNED is for when a chunk has been returned but the job hasn't finished running
	RETURNED
	// COMPLETE is used to denote that the job has finished running and the Agent has sent back the results
	COMPLETE
	// CANCELED is used to denoted jobs that were cancelled with the "clear" command
	CANCELED
	// ACTIVE is used with SOCKS connections to show the connection between the SOCKS client and server is active
	ACTIVE
)

func (Status) String

func (s Status) String() string

Directories

Path Synopsis
Package memory is an in-memory repository for storing and managing Agent Jobs and associated Job tracking structures
Package memory is an in-memory repository for storing and managing Agent Jobs and associated Job tracking structures

Jump to

Keyboard shortcuts

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