Class: FIDIUS::EvasionDB::RuleFetcher

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

Overview

A Fetcher is used to fetch rules from an ids

Constant Summary collapse

@@fetchers =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, &block) ⇒ RuleFetcher

Returns a new instance of RuleFetcher.



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

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

Instance Attribute Details

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

Class Method Details

.allObject



44
45
46
# File 'lib/evasion-db/rule_fetchers/rule_fetchers.rb', line 44

def self.all
  @@fetchers
end

.by_name(name) ⇒ Object



48
49
50
51
52
53
# File 'lib/evasion-db/rule_fetchers/rule_fetchers.rb', line 48

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

Instance Method Details

#config(conf) ⇒ Object



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

def config(conf)
  raise "overwrite this"
end

#fetch_rules(attack_module) ⇒ Object



40
41
42
# File 'lib/evasion-db/rule_fetchers/rule_fetchers.rb', line 40

def fetch_rules(attack_module)
  raise "overwrite this"
end

#install(&block) ⇒ Object



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

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

#run_installObject



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

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