Class: ARPScan::Host

Inherits:
Object
  • Object
show all
Defined in:
lib/arp_scan/host.rb

Overview

Abstracts replying hosts from the arp-scan output.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ip_addr, mac, oui) ⇒ Host

Create a new hsot. IP address, MAC address and OUI information are expected.



22
23
24
25
26
# File 'lib/arp_scan/host.rb', line 22

def initialize(ip_addr, mac, oui)
  @ip_addr = ip_addr
  @mac = mac
  @oui = oui
end

Instance Attribute Details

#ip_addrObject (readonly)

The IP address of the host.



9
10
11
# File 'lib/arp_scan/host.rb', line 9

def ip_addr
  @ip_addr
end

#macObject (readonly)

The MAC address of the host.



13
14
15
# File 'lib/arp_scan/host.rb', line 13

def mac
  @mac
end

#ouiObject (readonly)

OUI information about the host.



17
18
19
# File 'lib/arp_scan/host.rb', line 17

def oui
  @oui
end

Instance Method Details

#to_arrayObject

Returns an array representation of the Host object.



38
39
40
41
42
# File 'lib/arp_scan/host.rb', line 38

def to_array
  [@ip_addr,
   @mac,
   @oui]
end

#to_hashObject

Returns a hash representation of the Host object.



30
31
32
33
34
# File 'lib/arp_scan/host.rb', line 30

def to_hash
  { ip_addr: @ip_addr,
    mac: @mac,
    oui: @oui }
end