api

package
v1.1.28 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CheckStateCreated      = "CREATED"
	CheckStateQueued       = "QUEUED"
	CheckStateAssingned    = "ASSIGNED"
	CheckStateRunning      = "RUNNING"
	CheckStatePurging      = "PURGING"
	CheckStateMalformed    = "MALFORMED"
	CheckStateKilled       = "KILLED"
	CheckStateFailed       = "FAILED"
	CheckStateFinished     = "FINISHED"
	CheckStateInconclusive = "INCONCLUSIVE"
)
View Source
var (
	CheckStates = States{
		[]string{"CREATED"},
		[]string{"QUEUED"},
		[]string{"ASSIGNED"},
		[]string{"RUNNING"},
		[]string{"PURGING"},
		[]string{"MALFORMED", "ABORTED", "KILLED", "FAILED", "FINISHED", "TIMEOUT", "INCONCLUSIVE"},
	}
)

Functions

This section is empty.

Types

type Check

type Check struct {
	ID            string             `json:"id" validate:"required"`
	Status        string             `json:"status,omitempty"`
	ScanID        string             `json:"scan_id,omitempty"`
	Target        string             `json:"target,omitempty"`
	Progress      *float32           `json:"progress,omitempty"`
	ScanIndex     *string            `json:"scan_index,omitempty"`
	AgentID       *string            `json:"agent_id,omitempty"`
	ChecktypeID   *string            `json:"checktype_id,omitempty"`
	ChecktypeName *string            `json:"checktype_name,omitempty"`
	Image         *string            `json:"image,omitempty"`
	Options       *string            `json:"options,omitempty"`
	WebHook       *string            `json:"webhook,omitempty"`
	Report        *string            `json:"report,omitempty"`
	Raw           *string            `json:"raw,omitempty"`
	QueueName     *string            `json:"queue_name,omitempty"`
	Tag           *string            `json:"tag,omitempty"`
	Assettype     *string            `json:"assettype,omitempty"`
	Metadata      *map[string]string `json:"metadata,omitempty"`
	RequiredVars  *[]string          `json:"required_vars,omitempty"`
	CreatedAt     *time.Time         `json:"created_at,omitempty"`
	UpdatedAt     *time.Time         `json:"updated_at,omitempty"`
	Timeout       *int               `json:"timeout,omitempty"`
	CheckAdded    *bool              `json:"check_added,omitempty"`
	Data          []byte             `json:"-"`
}

Check holds all the information this service needs to process regarding a check.

func (Check) ToCheckNotification

func (c Check) ToCheckNotification() CheckNotification

ToCheckNotification returns a CheckNotification from a Check.

type CheckNotification

type CheckNotification struct {
	ID            string    `json:"id"`
	Status        string    `json:"status"`
	ScanID        string    `json:"scan_id"`
	Target        string    `json:"target"`
	Progress      float32   `json:"progress,omitempty"`
	AgentID       string    `json:"agent_id,omitempty"`
	ChecktypeID   string    `json:"checktype_id,omitempty"`
	ChecktypeName string    `json:"checktype_name,omitempty"`
	Options       string    `json:"options,omitempty"`
	WebHook       string    `json:"webhook,omitempty"`
	Report        string    `json:"report,omitempty"`
	Raw           string    `json:"raw,omitempty"`
	QueueName     string    `json:"queue_name,omitempty"`
	CreatedAt     time.Time `json:"created_at,omitempty"`
	UpdatedAt     time.Time `json:"updated_at,omitempty"`
	Tag           string    `json:"tag,omitempty"`
}

CheckNotification represents the data of a check sent to an SNS topic.

type CheckStats

type CheckStats struct {
	Status string `json:"status"`
	Total  int    `json:"total"`
}

CheckStats represents the stats for a check status.

type Checktype

type Checktype struct {
	Name        string  `json:"name"`
	Options     string  `json:"options"`
	Description *string `json:"description,omitempty"`
	Enabled     *bool   `json:"enabled,omitempty"`
	ID          *string `form:"id,omitempty" `
	Image       *string `json:"image,omitempty" `
	Timeout     *int    `json:"timeout,omitempty"`
}

Checktype defines one kind of check that belongs to a ChecktypesGroup.

type ChecktypesByAssettypes added in v1.1.7

type ChecktypesByAssettypes map[string]map[string]struct{}

ChecktypesByAssettypes is used as a lookup table to check if a checktype can be run against a concrete assettype.

type ChecktypesGroup

type ChecktypesGroup struct {
	Name       string      `json:"name"`
	Checktypes []Checktype `json:"checktypes"`
}

ChecktypesGroup represents a group of checktypes that are used to generated the checks of a scan.

type Scan

type Scan struct {
	ID              uuid.UUID                 `json:"id,omitempty"`
	ExternalID      *string                   `json:"external_id,omitempty"`
	Status          *string                   `json:"status,omitempty"`
	ScheduledTime   *time.Time                `json:"scheduled_time,omitempty"`
	StartTime       *time.Time                `json:"start_time,omitempty"`
	EndTime         *time.Time                `json:"endtime_time,omitempty"`
	Progress        *float32                  `json:"progress,omitempty"`
	Trigger         *string                   `json:"trigger,omitempty"`
	Targets         *TargetGroup              `json:"targets,omitempty"`
	ChecktypesGroup *ChecktypesGroup          `json:"check_types_groups,omitempty"`
	TargetGroups    *[]TargetsChecktypesGroup `json:"target_groups,omitempty"`
	Tag             *string                   `json:"tag,omitempty"`
	CheckCount      *int                      `json:"check_count,omitempty"`
	AbortedAt       *time.Time                `json:"aborted_at,omitempty"`

	LastTargetCheckGCreated *int                    `json:"last_target_check_g_created,omitempty"`
	LastCheckCreated        *int                    `json:"last_check_created,omitempty"`
	ChecksCreated           *int                    `json:"checks_created,omitempty"`
	ChecksFinished          *int                    `json:"checks_finished,omitempty"`
	ChecktypesInfo          *ChecktypesByAssettypes `json:"checkstypes_info,omitempty"`
}

Scan holds all the data related to a scan.

func (Scan) ToScanNotification

func (s Scan) ToScanNotification() ScanNotification

ToScanNotification returns a ScanNotification from a Scan.

type ScanNotification

type ScanNotification struct {
	ScanID        string    `json:"scan_id"`
	ProgramID     string    `json:"program_id"`
	Tag           string    `json:"tag"`
	Status        string    `json:"status"`
	Trigger       string    `json:"trigger"`
	ScheduledTime time.Time `json:"scheduled_time"`
	StartTime     time.Time `json:"start_time"`
	EndTime       time.Time `json:"endtime_time"`
	CheckCount    int       `json:"check_count"`
}

ScanNotification represents the data of a scan sent to an SNS topic.

type States

type States [][]string

States holds all prosibles States of a finite state machine in a way that is easy to determine the States less or equal than a given state. This implementation supposes that there are only few States so the cost of walking through all the States is close to constant.

func (States) High

func (c States) High(s string) []string

func (States) Init

func (c States) Init()

func (States) IsHigher

func (c States) IsHigher(s, base string) bool

func (States) IsLessOrEqual

func (c States) IsLessOrEqual(s, base string) bool

func (States) IsTerminal

func (c States) IsTerminal(s string) bool

func (States) LessOrEqual

func (c States) LessOrEqual(s string) []string

LessOrEqual returns the states from state machine that are preceding s. if s is not an existent state in state machine, all states are returned.

func (States) Terminal

func (c States) Terminal() []string

type Target

type Target struct {
	Identifier string `json:"identifier"`
	Type       string `json:"type"`
	Options    string `json:"options"`
}

Target represents a target of a scan.

type TargetGroup

type TargetGroup struct {
	Name    string   `json:"name"`
	Options string   `json:"options"`
	Targets []Target `json:"targets"`
}

TargetGroup Defines a group of targets against which to execute the checktypes.

type TargetsChecktypesGroup

type TargetsChecktypesGroup struct {
	TargetGroup     TargetGroup     `json:"target_group"`
	ChecktypesGroup ChecktypesGroup `json:"checktypes_group"`
}

TargetsChecktypesGroup defines a set of targets and the checktypes a scan must run against them.

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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