class Rex::Post::Meterpreter::Extensions::Stdapi::Net::Arp

This class represents an arp entry on the remote machine.

Attributes

interface[RW]

The name of the interface.

ip_addr[RW]

The ip address corresponding to the arp address.

mac_addr[RW]

The physical (MAC) address of the ARP entry

Public Class Methods

new(opts={}) click to toggle source

Returns an arp entry and initializes it to the supplied parameters.

# File lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb, line 29
def initialize(opts={})
  self.ip_addr   = IPAddr.new_ntoh(opts[:ip_addr]).to_s
  self.mac_addr  = mac_to_string(opts[:mac_addr])
  self.interface = opts[:interface]
end

Public Instance Methods

mac_to_string(mac_addr) click to toggle source
# File lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb, line 35
def mac_to_string(mac_addr)
  macocts = []
  mac_addr.each_byte { |o| macocts << o }
  macocts += [0] * (6 - macocts.size) if macocts.size < 6
  return sprintf("%02x:%02x:%02x:%02x:%02x:%02x",
    macocts[0], macocts[1], macocts[2],
    macocts[3], macocts[4], macocts[5])
end