Class: Amnesie::MAC

Inherits:
Object
  • Object
show all
Defined in:
lib/amnesie/mac.rb

Instance Method Summary collapse

Constructor Details

#initialize(card) ⇒ MAC

Returns a new instance of MAC.



5
6
7
8
9
10
# File 'lib/amnesie/mac.rb', line 5

def initialize(card)
  @card = card
  @ip = Helpers::Exec.new("ip")
  save_origin
  new_mac
end

Instance Method Details

#downObject



16
17
18
# File 'lib/amnesie/mac.rb', line 16

def down
  @ip.run("link set dev #{@card} down")
end

#set_addrObject



12
13
14
# File 'lib/amnesie/mac.rb', line 12

def set_addr
  @ip.run("link set dev #{@card} address #{@mac}")
end

#to_sObject



24
25
26
# File 'lib/amnesie/mac.rb', line 24

def to_s
  @card + " " + @mac
end

#upObject



20
21
22
# File 'lib/amnesie/mac.rb', line 20

def up
  @ip.run("link set dev #{@card} up")
end