Class: BetterCap::Discovery::Thread
- Inherits:
-
Object
- Object
- BetterCap::Discovery::Thread
- Defined in:
- lib/bettercap/discovery/thread.rb
Overview
Class responsible to actively discover targets on the network.
Instance Method Summary collapse
-
#initialize(ctx) ⇒ Thread
constructor
Initialize the class using the
ctx
BetterCap::Context instance. -
#start ⇒ Object
Start the active network discovery thread.
-
#stop ⇒ Object
Stop the active network discovery thread.
Constructor Details
#initialize(ctx) ⇒ Thread
Initialize the class using the ctx
BetterCap::Context instance.
18 19 20 21 22 |
# File 'lib/bettercap/discovery/thread.rb', line 18 def initialize( ctx ) @ctx = ctx @running = false @thread = nil end |
Instance Method Details
#start ⇒ Object
Start the active network discovery thread.
25 26 27 28 |
# File 'lib/bettercap/discovery/thread.rb', line 25 def start @running = true @thread = ::Thread.new { worker } end |
#stop ⇒ Object
Stop the active network discovery thread.
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bettercap/discovery/thread.rb', line 31 def stop @running = false if @thread != nil Logger.info( 'Stopping network discovery thread ...' ) unless @ctx..core.arpcache begin @thread.exit rescue end end end |