Class: FIDIUS::EvasionDB::Recorder

Inherits:
Object
  • Object
show all
Defined in:
lib/evasion-db/recorders/recorders.rb

Overview

A Recorder us used to log packets for an executed attack

Constant Summary collapse

@@recorders =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, &block) ⇒ Recorder

Returns a new instance of Recorder.



19
20
21
22
23
# File 'lib/evasion-db/recorders/recorders.rb', line 19

def initialize(name,&block)
  self.instance_eval(&block)
  @name = name
  @@recorders << self
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



17
18
19
# File 'lib/evasion-db/recorders/recorders.rb', line 17

def name
  @name
end

Class Method Details

.allObject



36
37
38
# File 'lib/evasion-db/recorders/recorders.rb', line 36

def self.all
  @@recorders
end

.by_name(name) ⇒ Object



40
41
42
43
44
45
# File 'lib/evasion-db/recorders/recorders.rb', line 40

def self.by_name(name)
  self.all.each do |recorder|
    return recorder if recorder.name == name
  end
  nil
end

Instance Method Details

#install(&block) ⇒ Object



25
26
27
28
# File 'lib/evasion-db/recorders/recorders.rb', line 25

def install(&block)
  $logger.debug "setting installblock"
  @install = block
end

#log_packetObject



51
52
53
# File 'lib/evasion-db/recorders/recorders.rb', line 51

def log_packet
  raise "overwrite this"
end

#run_installObject



30
31
32
33
34
# File 'lib/evasion-db/recorders/recorders.rb', line 30

def run_install
  raise "no install block given" unless @install
  $logger.debug "run install of #{@name}"
  @install.call
end

#startObject



47
48
49
# File 'lib/evasion-db/recorders/recorders.rb', line 47

def start
  raise "overwrite this"
end