Class: FIDIUS::EvasionDB::Fetcher

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

Overview

A Fetcher is used to fetch events from an ids

Constant Summary collapse

@@fetchers =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, &block) ⇒ Fetcher

Returns a new instance of Fetcher.



20
21
22
23
24
25
# File 'lib/evasion-db/idmef-fetchers/fetchers.rb', line 20

def initialize(name,&block)
  self.instance_eval(&block)
  @local_ip = nil
  @name = name
  @@fetchers << self
end

Instance Attribute Details

#local_ipObject

Returns the value of attribute local_ip.



18
19
20
# File 'lib/evasion-db/idmef-fetchers/fetchers.rb', line 18

def local_ip
  @local_ip
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

Class Method Details

.allObject



50
51
52
# File 'lib/evasion-db/idmef-fetchers/fetchers.rb', line 50

def self.all
  @@fetchers
end

.by_name(name) ⇒ Object



54
55
56
57
58
59
# File 'lib/evasion-db/idmef-fetchers/fetchers.rb', line 54

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

Instance Method Details

#begin_recordObject



42
43
44
# File 'lib/evasion-db/idmef-fetchers/fetchers.rb', line 42

def begin_record
  raise "overwrite this"
end

#config(conf) ⇒ Object



38
39
40
# File 'lib/evasion-db/idmef-fetchers/fetchers.rb', line 38

def config(conf)
  raise "overwrite this"
end

#fetch_eventsObject



46
47
48
# File 'lib/evasion-db/idmef-fetchers/fetchers.rb', line 46

def fetch_events
  raise "overwrite this"
end

#install(&block) ⇒ Object



27
28
29
30
# File 'lib/evasion-db/idmef-fetchers/fetchers.rb', line 27

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

#run_installObject



32
33
34
35
36
# File 'lib/evasion-db/idmef-fetchers/fetchers.rb', line 32

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