model

package
v0.0.0-...-e81be6b Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const CASE_STATUS_NEW = "new"
View Source
const DEFAULT_JOB_KIND = "pcap"
View Source
const FILTER_DRILLDOWN = "DRILLDOWN"
View Source
const FILTER_EXACT = "EXACT"
View Source
const FILTER_EXCLUDE = "EXCLUDE"
View Source
const FILTER_INCLUDE = "INCLUDE"
View Source
const JobStatusCompleted = 1
View Source
const JobStatusDeleted = 3
View Source
const JobStatusIncomplete = 2
View Source
const JobStatusPending = 0
View Source
const NodeStatusFault = "fault"
View Source
const NodeStatusOk = "ok"
View Source
const NodeStatusUnknown = "unknown"
View Source
const SegmentKind_GroupBy = "groupby"
View Source
const SegmentKind_Search = "search"
View Source
const SegmentKind_SortBy = "sortby"

Variables

This section is empty.

Functions

func IsScalar

func IsScalar(value interface{}) bool

Types

type AlertsStatus

type AlertsStatus struct {
	NewCount int `json:"newCount"`
}

type Analyzer

type Analyzer struct {
	Id   string `json:"id"`
	Path string `json:"path"`
}

func NewAnalyzer

func NewAnalyzer(id string, path string) *Analyzer

func (*Analyzer) GetModule

func (analyzer *Analyzer) GetModule() string

func (*Analyzer) GetRequirementsPath

func (analyzer *Analyzer) GetRequirementsPath() string

func (*Analyzer) GetSitePackagesPath

func (analyzer *Analyzer) GetSitePackagesPath() string

func (*Analyzer) GetSourcePackagesPath

func (analyzer *Analyzer) GetSourcePackagesPath() string

type Artifact

type Artifact struct {
	Auditable
	CaseId       string   `json:"caseId"`
	GroupType    string   `json:"groupType"`
	GroupId      string   `json:"groupId"`
	ArtifactType string   `json:"artifactType"`
	Value        string   `json:"value"`
	MimeType     string   `json:"mimeType"`
	StreamLen    int      `json:"streamLength"`
	StreamId     string   `json:"streamId"`
	Tlp          string   `json:"tlp"`
	Tags         []string `json:"tags"`
	Description  string   `json:"description"`
	Ioc          bool     `json:"ioc"`
	Md5          string   `json:"md5"`
	Sha1         string   `json:"sha1"`
	Sha256       string   `json:"sha256"`
}

func NewArtifact

func NewArtifact() *Artifact

type ArtifactStream

type ArtifactStream struct {
	Auditable
	Content string `json:"content"`
}

func NewArtifactStream

func NewArtifactStream() *ArtifactStream

func (*ArtifactStream) Read

func (stream *ArtifactStream) Read() io.Reader

func (*ArtifactStream) Write

func (stream *ArtifactStream) Write(reader io.Reader) (int, string, string, string, string, error)

type Auditable

type Auditable struct {
	Id         string     `json:"id,omitempty"`
	CreateTime *time.Time `json:"createTime"`
	UpdateTime *time.Time `json:"updateTime,omitempty"`
	UserId     string     `json:"userId"`
	Kind       string     `json:"kind,omitempty"`
	Operation  string     `json:"operation,omitempty"`
}

type BaseSegment

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

func (*BaseSegment) AddField

func (segment *BaseSegment) AddField(field string) error

func (*BaseSegment) Clear

func (segment *BaseSegment) Clear()

func (*BaseSegment) Fields

func (segment *BaseSegment) Fields() []string

func (*BaseSegment) RawFields

func (segment *BaseSegment) RawFields() []string

func (*BaseSegment) RemoveTermsWith

func (segment *BaseSegment) RemoveTermsWith(raw string) int

func (*BaseSegment) Terms

func (segment *BaseSegment) Terms() []*QueryTerm

func (*BaseSegment) TermsAsString

func (segment *BaseSegment) TermsAsString() string

type Case

type Case struct {
	Auditable
	StartTime    *time.Time `json:"startTime"`
	CompleteTime *time.Time `json:"completeTime"`
	Title        string     `json:"title"`
	Description  string     `json:"description"`
	Priority     int        `json:"priority"`
	Severity     string     `json:"severity"`
	Status       string     `json:"status"`
	Template     string     `json:"template"`
	Tlp          string     `json:"tlp"`
	Pap          string     `json:"pap"`
	Category     string     `json:"category"`
	AssigneeId   string     `json:"assigneeId"`
	Tags         []string   `json:"tags"`
}

func NewCase

func NewCase() *Case

func (*Case) ProcessWorkflowForStatus

func (socCase *Case) ProcessWorkflowForStatus(oldCase *Case)

type Comment

type Comment struct {
	Auditable
	CaseId      string `json:"caseId"`
	Description string `json:"description"`
}

func NewComment

func NewComment() *Comment

type EventAckCriteria

type EventAckCriteria struct {
	SearchFilter    string                 `json:"searchFilter"`
	EventFilter     map[string]interface{} `json:"eventFilter"`
	DateRange       string                 `json:"dateRange"`
	DateRangeFormat string                 `json:"dateRangeFormat"`
	Timezone        string                 `json:"timezone"`
	Escalate        bool                   `json:"escalate"`
	Acknowledge     bool                   `json:"acknowledge"`
}

func NewEventAckCriteria

func NewEventAckCriteria() *EventAckCriteria

type EventIndexResults

type EventIndexResults struct {
	Success    bool   `json:"success"`
	DocumentId string `json:"id"`
}

func NewEventIndexResults

func NewEventIndexResults() *EventIndexResults

type EventMetric

type EventMetric struct {
	Keys  []interface{} `json:"keys"`
	Value int           `json:"value"`
}

type EventRecord

type EventRecord struct {
	Source    string `json:"source"`
	Time      time.Time
	Timestamp string                 `json:"timestamp"`
	Id        string                 `json:"id"`
	Type      string                 `json:"type"`
	Score     float64                `json:"score"`
	Payload   map[string]interface{} `json:"payload"`
}

type EventResults

type EventResults struct {
	CreateTime   time.Time `json:"createTime"`
	CompleteTime time.Time `json:"completeTime"`
	ElapsedMs    int       `json:"elapsedMs"`
	Errors       []string  `json:"errors"`
}

func (*EventResults) Complete

func (results *EventResults) Complete()

type EventSearchCriteria

type EventSearchCriteria struct {
	RawQuery    string `json:"query"`
	DateRange   string `json:"dateRange"`
	MetricLimit int    `json:"metricLimit"`
	EventLimit  int    `json:"eventLimit"`
	BeginTime   time.Time
	EndTime     time.Time
	CreateTime  time.Time
	ParsedQuery *Query
	SortFields  []*SortCriteria
}

func NewEventSearchCriteria

func NewEventSearchCriteria() *EventSearchCriteria

func (*EventSearchCriteria) Populate

func (criteria *EventSearchCriteria) Populate(query string, dateRange string, dateRangeFormat string, timezone string, metricLimit string, eventLimit string) error

type EventSearchResults

type EventSearchResults struct {
	EventResults
	Criteria    *EventSearchCriteria        `json:"criteria"`
	TotalEvents int                         `json:"totalEvents"`
	Events      []*EventRecord              `json:"events"`
	Metrics     map[string]([]*EventMetric) `json:"metrics"`
}

func NewEventSearchResults

func NewEventSearchResults() *EventSearchResults

type EventUpdateCriteria

type EventUpdateCriteria struct {
	EventSearchCriteria
	UpdateScripts []string `json:"updateScripts"`
	Asynchronous  bool     `json:"async"`
}

func NewEventUpdateCriteria

func NewEventUpdateCriteria() *EventUpdateCriteria

func (*EventUpdateCriteria) AddUpdateScript

func (criteria *EventUpdateCriteria) AddUpdateScript(script string)

type EventUpdateResults

type EventUpdateResults struct {
	EventResults
	Criteria       *EventUpdateCriteria `json:"criteria"`
	UpdatedCount   int                  `json:"updatedCount"`
	UnchangedCount int                  `json:"unchangedCount"`
}

func NewEventUpdateResults

func NewEventUpdateResults() *EventUpdateResults

func (*EventUpdateResults) AddEventUpdateResults

func (results *EventUpdateResults) AddEventUpdateResults(newResults *EventUpdateResults)

type Filter

type Filter struct {
	ImportId   string                 `json:"importId"`
	BeginTime  time.Time              `json:"beginTime"`
	EndTime    time.Time              `json:"endTime"`
	SrcIp      string                 `json:"srcIp"`
	SrcPort    int                    `json:"srcPort"`
	DstIp      string                 `json:"dstIp"`
	DstPort    int                    `json:"dstPort"`
	Parameters map[string]interface{} `json:"parameters"`
}

func NewFilter

func NewFilter() *Filter

type GridStatus

type GridStatus struct {
	TotalNodeCount     int `json:"totalNodeCount"`
	UnhealthyNodeCount int `json:"unhealthyNodeCount"`
	Eps                int `json:"eps"`
}

type GroupBySegment

type GroupBySegment struct {
	*BaseSegment
}

func NewGroupBySegment

func NewGroupBySegment(terms []*QueryTerm) (*GroupBySegment, error)

func NewGroupBySegmentEmpty

func NewGroupBySegmentEmpty() *GroupBySegment

func (*GroupBySegment) Kind

func (segment *GroupBySegment) Kind() string

func (*GroupBySegment) String

func (segment *GroupBySegment) String() string

type Info

type Info struct {
	Version        string                   `json:"version"`
	License        string                   `json:"license"`
	Parameters     *config.ClientParameters `json:"parameters"`
	ElasticVersion string                   `json:"elasticVersion"`
	WazuhVersion   string                   `json:"wazuhVersion"`
	UserId         string                   `json:"userId"`
	Timezones      []string                 `json:"timezones"`
}

type Job

type Job struct {
	Id             int          `json:"id"`
	CreateTime     time.Time    `json:"createTime"`
	Status         int          `json:"status"`
	CompleteTime   time.Time    `json:"completeTime"`
	FailTime       time.Time    `json:"failTime"`
	Failure        string       `json:"failure"`
	FailCount      int          `json:"failCount"`
	Owner          string       `json:"owner"`
	NodeId         string       `json:"nodeId"`
	LegacySensorId string       `json:"sensorId"`
	FileExtension  string       `json:"fileExtension"`
	Filter         *Filter      `json:"filter"`
	UserId         string       `json:"userId"`
	Kind           string       `json:"kind"`
	Results        []*JobResult `json:"results"`
}

func NewJob

func NewJob() *Job

func (*Job) CanProcess

func (job *Job) CanProcess() bool

func (*Job) Complete

func (job *Job) Complete()

func (*Job) Fail

func (job *Job) Fail(err error)

func (*Job) GetKind

func (job *Job) GetKind() string

func (*Job) GetNodeId

func (job *Job) GetNodeId() string

func (*Job) SetNodeId

func (job *Job) SetNodeId(nodeId string)

type JobResult

type JobResult struct {
	Id      string      `json:"id"`
	Data    interface{} `json:"data"`
	Summary string      `json:"summary"`
}

func NewJobResult

func NewJobResult(id string, data interface{}, summary string) *JobResult

type Node

type Node struct {
	Id               string    `json:"id"`
	OnlineTime       time.Time `json:"onlineTime"`
	UpdateTime       time.Time `json:"updateTime"`
	EpochTime        time.Time `json:"epochTime"`
	UptimeSeconds    int       `json:"uptimeSeconds"`
	Description      string    `json:"description"`
	Address          string    `json:"address"`
	Role             string    `json:"role"`
	Model            string    `json:"model"`
	ImageFront       string    `json:"imageFront"`
	ImageBack        string    `json:"imageBack"`
	Status           string    `json:"status"`
	Version          string    `json:"version"`
	ConnectionStatus string    `json:"connectionStatus"`
	RaidStatus       string    `json:"raidStatus"`
	ProcessStatus    string    `json:"processStatus"`
	ProductionEps    int       `json:"productionEps"`
	ConsumptionEps   int       `json:"consumptionEps"`
	FailedEvents     int       `json:"failedEvents"`
	MetricsEnabled   bool      `json:"metricsEnabled"`
}

func NewNode

func NewNode(id string) *Node

func (*Node) SetModel

func (node *Node) SetModel(model string)

func (*Node) UpdateOverallStatus

func (node *Node) UpdateOverallStatus(enhancedStatusEnabled bool) bool

type Packet

type Packet struct {
	Number        int       `json:"number"`
	Type          string    `json:"type"`
	SrcMac        string    `json:"srcMac"`
	DstMac        string    `json:"dstMac"`
	SrcIp         string    `json:"srcIp"`
	SrcPort       int       `json:"srcPort"`
	DstIp         string    `json:"dstIp"`
	DstPort       int       `json:"dstPort"`
	Length        int       `json:"length"`
	Timestamp     time.Time `json:"timestamp"`
	Sequence      int       `json:"sequence"`
	Acknowledge   int       `json:"acknowledge"`
	Window        int       `json:"window"`
	Checksum      int       `json:"checksum"`
	Flags         []string  `json:"flags"`
	Payload       string    `json:"payload"`
	PayloadOffset int       `json:"payloadOffset"`
}

func NewPacket

func NewPacket(number int) *Packet

type Query

type Query struct {
	Segments []QuerySegment
}

func NewQuery

func NewQuery() *Query

func (*Query) AddSegment

func (query *Query) AddSegment(segment QuerySegment)

func (*Query) Filter

func (query *Query) Filter(field string, value string, scalar bool, mode string, condense bool) (string, error)

func (*Query) Group

func (query *Query) Group(segmentIdx int, field string) (string, error)

func (*Query) NamedSegment

func (query *Query) NamedSegment(name string) QuerySegment

func (*Query) NamedSegments

func (query *Query) NamedSegments(name string) []QuerySegment

func (*Query) Parse

func (query *Query) Parse(str string) error

func (*Query) RemoveSegment

func (query *Query) RemoveSegment(name string) QuerySegment

func (*Query) Sort

func (query *Query) Sort(field string) (string, error)

func (*Query) String

func (query *Query) String() string

type QuerySegment

type QuerySegment interface {
	String() string
	Kind() string
}

func NewSegment

func NewSegment(kind string, terms []*QueryTerm) (QuerySegment, error)

type QueryTerm

type QueryTerm struct {
	Raw     string
	Quoted  bool
	Quote   rune
	Grouped bool
}

func NewQueryTerm

func NewQueryTerm(str string) (*QueryTerm, error)

func (*QueryTerm) String

func (term *QueryTerm) String() string

type RelatedEvent

type RelatedEvent struct {
	Auditable
	CaseId string                 `json:"caseId"`
	Fields map[string]interface{} `json:"fields"`
}

func NewRelatedEvent

func NewRelatedEvent() *RelatedEvent

type SearchSegment

type SearchSegment struct {
	*BaseSegment
}

func NewSearchSegment

func NewSearchSegment(terms []*QueryTerm) (*SearchSegment, error)

func NewSearchSegmentEmpty

func NewSearchSegmentEmpty() *SearchSegment

func (*SearchSegment) AddFilter

func (segment *SearchSegment) AddFilter(field string, value string, scalar bool, inclusive bool, condense bool) error

func (*SearchSegment) Kind

func (segment *SearchSegment) Kind() string

func (*SearchSegment) String

func (segment *SearchSegment) String() string

type SortBySegment

type SortBySegment struct {
	*BaseSegment
}

func NewSortBySegment

func NewSortBySegment(terms []*QueryTerm) (*SortBySegment, error)

func NewSortBySegmentEmpty

func NewSortBySegmentEmpty() *SortBySegment

func (*SortBySegment) Kind

func (segment *SortBySegment) Kind() string

func (*SortBySegment) String

func (segment *SortBySegment) String() string

type SortCriteria

type SortCriteria struct {
	Field string
	Order string
}

type Status

type Status struct {
	Grid   *GridStatus   `json:"grid"`
	Alerts *AlertsStatus `json:"alerts"`
}

func NewStatus

func NewStatus() *Status

type Unauthorized

type Unauthorized struct {
	CreateTime time.Time
	Subject    string
	Operation  string
	Target     string
}

func NewUnauthorized

func NewUnauthorized(subject string, operation string, target string) *Unauthorized

func (*Unauthorized) Error

func (err *Unauthorized) Error() string

type User

type User struct {
	Id             string    `json:"id"`
	CreateTime     time.Time `json:"createTime"`
	UpdateTime     time.Time `json:"updateTime"`
	Email          string    `json:"email"`
	FirstName      string    `json:"firstName"`
	LastName       string    `json:"lastName"`
	MfaStatus      string    `json:"mfaStatus"`
	Note           string    `json:"note"`
	Roles          []string  `json:"roles"`
	Status         string    `json:"status"`
	SearchUsername string    `json:"searchUsername"`
}

func NewUser

func NewUser() *User

func (*User) String

func (user *User) String() string

Jump to

Keyboard shortcuts

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