Class: BetterCap::Network::Servers::DnsWrapper

Inherits:
RubyDNS::RuleBasedServer
  • Object
show all
Defined in:
lib/bettercap/network/servers/dnsd.rb

Overview

Class to wrap RubyDNS::RuleBasedServer and add some utility methods.

Constant Summary collapse

@@instance =

we need this in order to add rules at runtime.

nil

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, &block) ⇒ DnsWrapper

Instantiate a server with a block.


31
32
33
34
35
# File 'lib/bettercap/network/servers/dnsd.rb', line 31

def initialize(options = {}, &block)
  super(options,&block)
  @rules     = []
  @@instance = self
end

Instance Attribute Details

#rulesObject

List of redirection rules.


21
22
23
# File 'lib/bettercap/network/servers/dnsd.rb', line 21

def rules
  @rules
end

Class Method Details

.getObject

Return the active instance of this object.


26
27
28
# File 'lib/bettercap/network/servers/dnsd.rb', line 26

def self.get
  @@instance
end

Instance Method Details

#process(name, resource_class, transaction) ⇒ Object

Give a name and a record type, try to match a rule and use it for processing the given arguments.


37
38
39
40
# File 'lib/bettercap/network/servers/dnsd.rb', line 37

def process(name, resource_class, transaction)
  Logger.debug "[#{'DNS'.green}] Received #{resource_class.name} request for #{name} ..."
  super
end