model

package
v0.0.0-...-7be17cd Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

provides helpers to build models based on keys or names

Index

Constants

View Source
const (
	// shared:status
	Deleted string = "D"
	// asset:status
	Active     string = "A"
	ActiveLow  string = "AL"
	ActiveHigh string = "AH"
	Frozen     string = "F"
	FrozenLow  string = "FL"
	FrozenHigh string = "FH"
	// job:status
	Queued  string = "JQ"
	Running string = "JR"
	Fail    string = "JF"
	Pass    string = "JP"
	// risk:status
	Triage             string = "T"
	TriageInfo         string = "TI"
	TriageLow          string = "TL"
	TriageMedium       string = "TM"
	TriageHigh         string = "TH"
	TriageCritical     string = "TC"
	Ignored            string = "I"
	IgnoredExposure    string = "IE"
	IgnoredInfo        string = "II"
	IgnoredLow         string = "IL"
	IgnoredMedium      string = "IM"
	IgnoredHigh        string = "IH"
	IgnoredCritical    string = "IC"
	Open               string = "O"
	OpenExposure       string = "OE"
	OpenInfo           string = "OI"
	OpenLow            string = "OL"
	OpenMedium         string = "OM"
	OpenHigh           string = "OH"
	OpenCritical       string = "OC"
	OpenMaterial       string = "OX"
	Remediated         string = "R"
	RemediatedExposure string = "RE"
	RemediatedInfo     string = "RI"
	RemediatedLow      string = "RL"
	RemediatedMedium   string = "RM"
	RemediatedHigh     string = "RH"
	RemediatedCritical string = "RC"
	RemediatedMaterial string = "RX"
	// asset:source
	Discovered string = "discovered"
	Provided   string = "provided"
)

Variables

This section is empty.

Functions

func Future

func Future(hours int) int64

func Now

func Now() string

Types

type Account

type Account struct {
	Username string `dynamodbav:"username" json:"username"`
	Key      string `dynamodbav:"key" json:"key"`
	// Attributes
	Name    string            `dynamodbav:"name" json:"name"`
	Member  string            `dynamodbav:"member" json:"member"`
	Value   string            `dynamodbav:"value,omitempty" json:"value"`
	Config  map[string]string `dynamodbav:"config" json:"config"`
	Updated string            `dynamodbav:"updated" json:"updated"`
	TTL     int64             `dynamodbav:"ttl" json:"ttl"`
}

func NewAccount

func NewAccount(name, member, value string, config map[string]string) Account

type Asset

type Asset struct {
	Username string `dynamodbav:"username" json:"username"`
	Key      string `dynamodbav:"key" json:"key"`
	// Attributes
	Source  string            `dynamodbav:"source" json:"source"`
	DNS     string            `dynamodbav:"dns" json:"dns"`
	Name    string            `dynamodbav:"name" json:"name"`
	Status  string            `dynamodbav:"status" json:"status"`
	Config  map[string]string `dynamodbav:"config" json:"config"`
	Created string            `dynamodbav:"created" json:"created"`
	Visited string            `dynamodbav:"visited" json:"visited"`
	TTL     int64             `dynamodbav:"ttl" json:"ttl"`
	History []History         `dynamodbav:"history" json:"history"`
}

func FilterAssetsByKey

func FilterAssetsByKey(assets []Asset, filter string) []Asset

func GetAssetFromKey

func GetAssetFromKey(key string) (*Asset, error)

func NewAsset

func NewAsset(dns, name string) Asset

func (*Asset) Attribute

func (a *Asset) Attribute(name, value string) Attribute

func (*Asset) Class

func (a *Asset) Class() string

func (*Asset) Is

func (a *Asset) Is(value string) bool

func (*Asset) Merge

func (a *Asset) Merge(update Asset)

func (*Asset) Spawn

func (a *Asset) Spawn(dns, name string) Asset

func (*Asset) System

func (a *Asset) System() bool

func (*Asset) Valid

func (a *Asset) Valid() bool

func (*Asset) Visit

func (a *Asset) Visit(config map[string]string) Asset

type Attribute

type Attribute struct {
	Username string `dynamodbav:"username" json:"username"`
	Key      string `dynamodbav:"key" json:"key"`
	// Attributes
	Source  string `dynamodbav:"source" json:"source"`
	Name    string `dynamodbav:"name" json:"name"`
	Value   string `dynamodbav:"value" json:"value"`
	Status  string `dynamodbav:"status" json:"status"`
	Created string `dynamodbav:"created" json:"created"`
	Visited string `dynamodbav:"visited" json:"visited"`
	TTL     int64  `dynamodbav:"ttl" json:"ttl"`
}

func GetAttributeFromKey

func GetAttributeFromKey(key string) (*Attribute, error)

func NewAttribute

func NewAttribute(name, value, key string) Attribute

func (*Attribute) Is

func (a *Attribute) Is(value string) bool

func (*Attribute) Target

func (a *Attribute) Target(status string) Asset

func (*Attribute) Tasks

func (a *Attribute) Tasks() []string

func (*Attribute) Valid

func (a *Attribute) Valid() bool

func (*Attribute) Visit

func (a *Attribute) Visit() Attribute

type Capability

type Capability interface {
	Match() bool
	Invoke() error
	Secret() string
	Timeout() int
}

type File

type File struct {
	Username string `dynamodbav:"username" json:"username"`
	Key      string `dynamodbav:"key" json:"key"`
	// Attributes
	Name    string `dynamodbav:"name" json:"name"`
	Updated string `dynamodbav:"updated" json:"updated"`
	Bytes   []byte `dynamodbav:"-" json:"-"`
}

func FilterFilesByName

func FilterFilesByName(files []File, filter string) []File

func NewFile

func NewFile(name string) File

type History

type History struct {
	From    string   `json:"from"`
	To      string   `json:"to"`
	By      string   `json:"by"`
	Comment string   `json:"comment"`
	Updated string   `json:"updated"`
	Model   *string  `json:"model"`
	Logit   *float32 `json:"logit"`
}

type Integration

type Integration interface {
	Push(risk Risk)
}

type Job

type Job struct {
	Username string `dynamodbav:"username" json:"username"`
	Key      string `dynamodbav:"key" json:"key"`
	// Attributes
	DNS     string            `dynamodbav:"dns" json:"dns"`
	Source  string            `dynamodbav:"source" json:"source"`
	Comment string            `dynamodbav:"comment" json:"comment"`
	Config  map[string]string `dynamodbav:"config" json:"config"`
	Created string            `dynamodbav:"created" json:"created"`
	Updated string            `dynamodbav:"updated" json:"updated"`
	Status  string            `dynamodbav:"status" json:"status"`
	TTL     int64             `dynamodbav:"ttl" json:"ttl"`
	Name    string            `dynamodbav:"name,omitempty" json:"name,omitempty"`
	Queue   string            `dynamodbav:"-"`
	Target  Asset             `dynamodbav:"-"`
	Origin  Asset             `dynamodbav:"-"`
	Stream  chan interface{}  `dynamodbav:"-" json:"-"`
}

func ConstructJob

func ConstructJob(key string) (Job, error)

func NewJob

func NewJob(source string, asset Asset) Job

func (*Job) Is

func (j *Job) Is(status string) bool

func (*Job) Raw

func (j *Job) Raw() string

func (*Job) SpawnJob

func (job *Job) SpawnJob(source string, asset Asset) Job

func (*Job) State

func (job *Job) State() string

func (*Job) Update

func (job *Job) Update(status string)

type Risk

type Risk struct {
	Username string `dynamodbav:"username" json:"username"`
	Key      string `dynamodbav:"key" json:"key"`
	// Attributes
	DNS     string    `dynamodbav:"dns" json:"dns"`
	Name    string    `dynamodbav:"name" json:"name"`
	Source  string    `dynamodbav:"source" json:"source"`
	Status  string    `dynamodbav:"status" json:"status"`
	Created string    `dynamodbav:"created" json:"created"`
	Updated string    `dynamodbav:"updated" json:"updated"`
	Visited string    `dynamodbav:"visited" json:"visited"`
	History []History `dynamodbav:"history" json:"history"`
	TTL     int64     `dynamodbav:"ttl" json:"ttl"`
	Comment string    `dynamodbav:"-" json:"comment"`
}

func GetRiskFromKey

func GetRiskFromKey(key string) (*Risk, error)

func NewRisk

func NewRisk(asset Asset, name string) Risk

func (*Risk) Attribute

func (r *Risk) Attribute(name, value string) Attribute

func (*Risk) Is

func (r *Risk) Is(status string) bool
func (r *Risk) Link() string

func (*Risk) Merge

func (r *Risk) Merge(update Risk)

func (*Risk) Proof

func (r *Risk) Proof(bits []byte) File

func (*Risk) Raw

func (r *Risk) Raw() string

func (*Risk) Set

func (r *Risk) Set(status string)

func (*Risk) Severity

func (r *Risk) Severity() string

func (*Risk) State

func (r *Risk) State() string

func (*Risk) Valid

func (r *Risk) Valid() bool

func (*Risk) Visit

func (r *Risk) Visit(n Risk) Risk

type SearchResult

type SearchResult struct {
	Offset     map[string]string `json:"offset,omitempty"`
	Assets     []Asset           `json:"assets,omitempty"`
	Attributes []Attribute       `json:"attributes,omitempty"`
	Risks      []Risk            `json:"risks,omitempty"`
	Files      []File            `json:"files,omitempty"`
	Jobs       []Job             `json:"jobs,omitempty"`
	Accounts   []Account         `json:"accounts,omitempty"`
	Term       string            `json:"-"`
}

Jump to

Keyboard shortcuts

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