Class: BetterCap::Spoofers::MAC

Inherits:
Base
  • Object
show all
Defined in:
lib/bettercap/spoofers/mac.rb

Overview

Instance Method Summary collapse

Methods inherited from Base

available, get_by_name, inherited

Constructor Details

#initializeMAC

Initialize the BetterCap::Spoofers::MAC object.



45
46
47
48
49
50
51
# File 'lib/bettercap/spoofers/mac.rb', line 45

def initialize
  @ctx          = Context.get
  @flood_thread = nil
  @running      = false

  update_gateway!
end

Instance Method Details

#startObject

Start the MAC spoofing



54
55
56
57
58
59
60
61
# File 'lib/bettercap/spoofers/mac.rb', line 54

def start
  Logger.debug 'Starting MAC spoofer ...'

  stop() if @running
  @running = true

  @flood_thread = Thread.new { mac_flood }
end

#stopObject

Stop the MAC spoofing



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/bettercap/spoofers/mac.rb', line 64

def stop
  raise 'MAC spoofer is not running' unless @running

  Logger.debug 'Stopping MAC spoofer ...'

  @running = false
  begin
    @flood_thread.exit
  rescue
  end
end