Sha256: 0d6f773f7bfa88359d2b0cc591f5608691131d737cf3db6490e349eefa7719f4

Contents?: true

Size: 1.05 KB

Versions: 15

Compression:

Stored size: 1.05 KB

Contents

# -*- coding: binary -*-

require 'ipaddr'

module Rex
module Post
module Meterpreter
module Extensions
module Stdapi
module Net

###
#
# This class represents an arp entry
# on the remote machine.
#
###
class Arp

  ##
  #
  # Constructor
  #
  ##

  #
  # Returns an arp entry and initializes it to the supplied
  # parameters.
  #
  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

  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

  #
  # The ip address corresponding to the arp address.
  #
  attr_accessor :ip_addr
  #
  # The physical (MAC) address of the ARP entry
  #
  attr_accessor :mac_addr
  #
  # The name of the interface.
  #
  attr_accessor :interface
end

end; end; end; end; end; end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
rex-2.0.13 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb
rex-2.0.12 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb
rex-2.0.11 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb
rex-2.0.10 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb
rex-2.0.9 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb
rex-2.0.8 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb
rex-2.0.7 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb
rex-2.0.5 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb
rex-2.0.4 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb
dstruct-0.0.1 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb
rex-2.0.3 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb
librex-0.0.999 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb
rex-2.0.2 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb
librex-0.0.71 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb
librex-0.0.70 lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb