event

package
v0.0.0-...-05965fc Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	PingEvent       = Type("PING")
	Operational     = Type("OPERATIONAL:Event")
	OperationalAuth = Type("OPERATIONAL:AUTH")
	DataRequest     = Type("DATA:REQUEST")
	DataRead        = Type("DATA:READ")
	DataWrite       = Type("DATA:WRITE")
	ServiceEnded    = Type("SERVICE:ENDED")

	SeverityFatal = Type("fatal")
	SeverityError = Type("error")
	SeverityInfo  = Type("info")

	ServiceStarted       = Type("SERVICE:STARTED")
	ConnectionOpened     = Type("CONNECTION:OPENED")
	ConnectionClosed     = Type("CONNECTION:CLOSED")
	UserSessionOpened    = Type("SESSION:USER:OPENED")
	UserSessionClosed    = Type("SESSION:USER:CLOSED")
	ConnectionReadError  = Type("CONNECTION:ERROR:READ")
	ConnectionWriteError = Type("CONNECTION:ERROR:WRITE")
	ContainerStarted     = Type("CONTAINER:STARTED")
	ContainerFrozen      = Type("CONTAINER:FROZEN")
	ContainerDial        = Type("CONTAINER:DIAL")
	ContainerError       = Type("CONTAINER:ERROR")
	ContainerUnfrozen    = Type("CONTAINER:UNFROZEN")
	ContainerCloned      = Type("CONTAINER:CLONED")
	ContainerStopped     = Type("CONTAINER:STOPPED")
	ContainerPaused      = Type("CONTAINER:PAUSED")
	ContainerResumed     = Type("CONTAINER:RESUMED")
	ContainerTarred      = Type("CONTAINER:TARRED")
	ContainerCheckpoint  = Type("CONTAINER:CHECKPOINT")
	ContainerPcaped      = Type("CONTAINER:PCAPED")
)

contains different sets of possible events type.

View Source
var (
	ContainersSensorName      = "CONTAINER"
	ConnectionSensorName      = "CONNECTION"
	ServiceSensorName         = "SERVICE"
	SessionSensorName         = "SESSIONS"
	EventSensorName           = "EVENTS"
	PingSensorName            = "PING"
	DataSensorName            = "DATA"
	ErrorsSensorName          = "ERRORS"
	DataErrorSensorName       = "DATA:ERROR"
	ConnectionErrorSensorName = "CONNECTION:ERROR"

	ContainersSensor      = Sensor("CONTAINER")
	ConnectionSensor      = Sensor("CONNECTION")
	ServiceSensor         = Sensor("SERVICE")
	SessionSensor         = Sensor("SESSIONS")
	EventSensor           = Sensor("EVENTS")
	PingSensor            = Sensor("PING")
	DataSensor            = Sensor("DATA")
	ErrorsSensor          = Sensor("ERRORS")
	DataErrorSensor       = Sensor("DATA:ERROR")
	ConnectionErrorSensor = Sensor("CONNECTION:ERROR")
)

Contains a series of sensors variables.

Functions

func ToMap

func ToMap(ev Event) map[string]interface{}

ToMap returns a map containing all available data which map a string key and value type.

Types

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func WithConn

func WithConn(conn net.Conn, options ...Option) *Conn

func (*Conn) Options

func (ec *Conn) Options() Option

type Event

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

Event defines a object which adds key-value pairs into a map type for event data.

func Apply

func Apply(e Event, opts ...Option) Event

Apply applies all options to the Event returning it after it's done.

func New

func New(opts ...Option) Event

New returns a new Event with the options applied.

func (Event) Get

func (e Event) Get(s string) string

Get retrieves a giving value for a key has string.

func (Event) Has

func (e Event) Has(s string) bool

Has returns true/false if the giving key exists.

func (Event) MarshalJSON

func (e Event) MarshalJSON() ([]byte, error)

func (Event) Range

func (e Event) Range(fx func(interface{}, interface{}) bool)

Range defines a function which ranges the underline key-values with the provided syncmap.

func (Event) Store

func (e Event) Store(s string, v interface{})

Store adds the key and value into the event.

type Option

type Option func(Event)

Option defines a function type for events modifications.

func Category

func Category(s string) Option

Category returns an option for setting the category value.

func CopyFrom

func CopyFrom(data map[string]interface{}) Option

CopyFrom copies the internal key-value pair into the event, overwritten any previous key's value if matching key.

func Custom

func Custom(name string, value interface{}) Option

Custom returns an option for setting the custom key-value pair.

func DestinationAddr

func DestinationAddr(addr net.Addr) Option

DestinationAddr returns an option for setting the destination-ip value.

func DestinationHardwareAddr

func DestinationHardwareAddr(addr net.HardwareAddr) Option

DestinationAddr returns an option for setting the destination-ip value.

func DestinationIP

func DestinationIP(ip net.IP) Option

DestinationIP returns an option for setting the destination-ip value.

func DestinationPort

func DestinationPort(port uint16) Option

DestinationPort returns an option for setting the destination-port value.

func Error

func Error(err error) Option

Error returns an option for setting the error value.

func HostAddr

func HostAddr(addr string) Option

HostAddr returns an option for setting the host-addr value.

func HostAddrFrom

func HostAddrFrom(addr net.Addr) Option

HostAddrFrom returns an option for setting the host-addr value.

func MergeFrom

func MergeFrom(data map[string]interface{}) Option

MergeFrom copies the internal key-value pair into the event if the event lacks the given key.

func Message

func Message(format string, a ...interface{}) Option

Message returns an option for setting the payload value. should this be just a formatter? eg Bla Bla {src-ip}

func NewWith

func NewWith(opts ...Option) Option

NewWith combines the set of option into a single option which applies all the series when called.

func Payload

func Payload(data []byte) Option

Payload returns an option for setting the payload value.

func Protocol

func Protocol(v string) Option

Protocol sets the protocol of the event

func RemoteAddr

func RemoteAddr(addr string) Option

RemoteAddr returns an option for setting the host-addr value.

func RemoteAddrFrom

func RemoteAddrFrom(addr net.Addr) Option

RemoteAddrFrom returns an option for setting the host-addr value.

func Sensor

func Sensor(s string) Option

Sensor returns an option for setting the sensor value.

func Service

func Service(v string) Option

Service sets the service of the event

func SourceAddr

func SourceAddr(addr net.Addr) Option

SourceAddr returns an option for setting the source-ip value.

func SourceHardwareAddr

func SourceHardwareAddr(addr net.HardwareAddr) Option

SourceAddr returns an option for setting the source-ip value.

func SourceIP

func SourceIP(ip net.IP) Option

SourceIP returns an option for setting the source-ip value.

func SourcePort

func SourcePort(port uint16) Option

SourcePort returns an option for setting the source-port value.

func Stack

func Stack() Option

Stack returns a stacktrace

func Token

func Token(token string) Option

Token adds the provided token into the giving Event.

func Type

func Type(s string) Option

Type returns an option for setting the type value.

Jump to

Keyboard shortcuts

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