Class: Threatstack::Events::AttackEvent

Inherits:
BaseEvent
  • Object
show all
Defined in:
lib/events/models/attack_event.rb

Overview

Instrumentation event model that inherits the common attributes and adds its own specifics

Instance Attribute Summary collapse

Attributes inherited from BaseEvent

#agent_type, #event_id, #event_type, #timestamp

Instance Method Summary collapse

Methods inherited from BaseEvent

#to_core_hash, #to_json_string

Constructor Details

#initialize(args) ⇒ AttackEvent

Returns a new instance of AttackEvent.

Parameters:

  • args (Hash)
    String

    args.event_id

    String

    args.timestamp

    String

    args.request_ip

    Hash

    args.request_headers

    String

    args.request_url

    String

    args.request_method

    String

    args.module_name

    String

    args.attack_message

    String

    args.attack_stack

    Hash

    args.attack_details



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/events/models/attack_event.rb', line 30

def initialize(args)
  args[:event_type] = Threatstack::Constants::ATTACK
  @request_ip = args[:request_ip]
  @request_headers = args[:request_headers]
  @request_url = args[:request_url]
  @request_method = args[:request_method]
  @module_name = args[:module_name]
  @attack_message = args[:attack_message]
  @attack_stack = args[:attack_stack]
  @attack_details = args[:attack_details]
  super args
end

Instance Attribute Details

#attack_detailsObject

Returns the value of attribute attack_details.



17
18
19
# File 'lib/events/models/attack_event.rb', line 17

def attack_details
  @attack_details
end

#attack_messageObject

Returns the value of attribute attack_message.



15
16
17
# File 'lib/events/models/attack_event.rb', line 15

def attack_message
  @attack_message
end

#attack_stackObject

Returns the value of attribute attack_stack.



16
17
18
# File 'lib/events/models/attack_event.rb', line 16

def attack_stack
  @attack_stack
end

#module_nameObject

Returns the value of attribute module_name.



14
15
16
# File 'lib/events/models/attack_event.rb', line 14

def module_name
  @module_name
end

#request_headersObject

Returns the value of attribute request_headers.



11
12
13
# File 'lib/events/models/attack_event.rb', line 11

def request_headers
  @request_headers
end

#request_ipObject

Returns the value of attribute request_ip.



10
11
12
# File 'lib/events/models/attack_event.rb', line 10

def request_ip
  @request_ip
end

#request_methodObject

Returns the value of attribute request_method.



13
14
15
# File 'lib/events/models/attack_event.rb', line 13

def request_method
  @request_method
end

#request_urlObject

Returns the value of attribute request_url.



12
13
14
# File 'lib/events/models/attack_event.rb', line 12

def request_url
  @request_url
end

Instance Method Details

#to_hashObject



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/events/models/attack_event.rb', line 43

def to_hash
  hash = to_core_hash
  hash[:module_name] = @module_name
  hash[:payload] = {
    :attack => {
      :message => @attack_message, :stack => @attack_stack, :details => @attack_details
    },
    :req => {
      :headers => @request_headers, :ip_address => @request_ip, :url => @request_url, :method => @request_method
    }
  }
  hash
end