Documentation
¶
Index ¶
- type BaseEvent
- func (ev *BaseEvent) AddAdditional(add map[string]string)
- func (ev *BaseEvent) AddTags(tags map[string]string)
- func (ev BaseEvent) GetDestPort() uint16
- func (ev BaseEvent) GetKind() string
- func (ev BaseEvent) GetSession() string
- func (ev BaseEvent) GetSourceIP() string
- func (ev BaseEvent) GetTags() map[string][]string
- type Event
- type EventLog
- type HTTPEvent
- type ICMPv4Event
- type ICMPv6Event
- type TCPEvent
- type Tags
- type UDPEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseEvent ¶
type BaseEvent struct { IPVersion uint Tags Tags Kind string SourceIP string DestPort uint16 Session string Timestamp time.Time Additional map[string]string Event loggable.Loggable }
BaseEvent described the common structure to all the events generated by the received packets
func (*BaseEvent) AddAdditional ¶
AddAdditional fetches the Additional values of an event
func (BaseEvent) GetDestPort ¶
GetDestPort fetches the DestPort of an event
func (BaseEvent) GetSession ¶ added in v1.0.1
GetSession fetches the Session of an event
func (BaseEvent) GetSourceIP ¶
GetSourceIP fetches the SourceIP of an event
type Event ¶
type Event interface { //Match(rule rules.Rule) bool ToLog() EventLog GetIPHeader() *layers.IPv4 GetICMPv6Header() *layers.ICMPv6 GetICMPv4Header() *layers.ICMPv4 GetUDPHeader() *layers.UDP GetTCPHeader() *layers.TCP GetHTTPData() HTTPEvent AddTags(tags map[string]string) AddAdditional(add map[string]string) loggable.Loggable }
Event is the interface implementing common methods to generated events
type HTTPEvent ¶
type HTTPEvent struct { Verb string `json:"verb"` Proto string `json:"proto"` RequestURI string `json:"URI"` SourcePort uint16 `json:"src_port"` DestHost string `json:"dst_host"` DestPort uint16 `json:"dst_port"` Headers map[string]string `json:"headers"` HeadersKeys []string `json:"headers_keys"` HeadersValues []string `json:"headers_values"` InlineHeaders []string Errors []string `json:"errors"` Body logdata.Payload `json:"body"` IsTLS bool `json:"is_tls"` Req *http.Request LogData logdata.HTTPEventLog BaseEvent }
HTTPEvent describes the structure of an event generated by a reassembled HTTP packet
func NewHTTPEvent ¶
func NewHTTPEvent(r *http.Request, network gopacket.Flow, transport gopacket.Flow) (*HTTPEvent, error)
NewHTTPEvent creates an HTTPEvent from a reassembled http.Request. It uses flow information if available to allow quality source and destination information. Only available to HTTP events, as HTTPS events are generated from a webserver and thus not reassembled
func NewHTTPEventFromRequest ¶
NewHTTPEventFromRequest creates an HTTPEvent from an http.Request if flow information is not available. It is used for HTTPS events, as they're generated from the dummy webserver and not reassembled by Melody
func (HTTPEvent) GetHTTPData ¶
GetHTTPData returns the event's data
func (HTTPEvent) GetIPHeader ¶
GetIPHeader satisfies the Event interface by returning nil. As they're application-level data, HTTP events does not support IP header data
type ICMPv4Event ¶
type ICMPv4Event struct { //ICMPv4Header *layers.ICMPv4 LogData logdata.ICMPv4EventLog BaseEvent helpers.IPv4Layer helpers.ICMPv4Layer }
ICMPv4Event describes the structure of an event generated by an ICPMv4 packet
func NewICMPv4Event ¶
func NewICMPv4Event(packet gopacket.Packet) (*ICMPv4Event, error)
NewICMPv4Event created a new ICMPv4Event from a packet
func (ICMPv4Event) ToLog ¶
func (ev ICMPv4Event) ToLog() EventLog
ToLog parses the event structure and generate an EventLog almost ready to be sent to the logging file
type ICMPv6Event ¶
type ICMPv6Event struct { LogData logdata.ICMPv6EventLog BaseEvent helpers.IPv6Layer helpers.ICMPv6Layer }
ICMPv6Event describes the structure of an event generated by an ICPMv6 packet
func NewICMPv6Event ¶
func NewICMPv6Event(packet gopacket.Packet) (*ICMPv6Event, error)
NewICMPv6Event created a new ICMPv6Event from a packet
func (ICMPv6Event) ToLog ¶
func (ev ICMPv6Event) ToLog() EventLog
ToLog parses the event structure and generate an EventLog almost ready to be sent to the logging file
type TCPEvent ¶
type TCPEvent struct { LogData logdata.TCPEventLog BaseEvent helpers.TCPLayer helpers.IPv4Layer helpers.IPv6Layer }
TCPEvent describes the structure of an event generated by an ICPMv4 packet
func NewTCPEvent ¶
NewTCPEvent created a new TCPEvent from a packet
type Tags ¶
Tags is an abstraction of map[string]interface{} allowing for the use of a set-like structure and a more graceful conversion to array