Class: BetterCap::Discovery::Agents::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bettercap/discovery/agents/base.rb

Overview

Base class for BetterCap::Discovery::Agents.

Direct Known Subclasses

Arp, Ndp, Udp

Instance Method Summary collapse

Constructor Details

#initialize(ctx, address = nil) ⇒ Base

Initialize the agent using the ctx BetterCap::Context instance. If address is not nil only that ip will be probed.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/bettercap/discovery/agents/base.rb', line 22

def initialize( ctx, address = nil )
  @ctx     = ctx
  @address = address

  if @address.nil?
    @ctx.endpoints.each do |ip|
      @ctx.packets.push( get_probe(ip) )
    end
  else
    if skip_address?(@address)
      Logger.debug "Skipping #{@address} ..."
    else
      Logger.debug "Probing #{@address} ..."
      @ctx.packets.push( get_probe(@address) )
    end
  end
end