Class: Nmunch::Dissectors::Arp
- Defined in:
- lib/nmunch/dissectors/arp.rb
Overview
Public: Address Resolution Protocol dissector
Extracts IP and MAC address from an ARP packet
See en.wikipedia.org/wiki/Address_Resolution_Protocol for protocol details
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#ip_address ⇒ Object
Public: Get sender IP address from ARP packet.
-
#mac_address ⇒ Object
Public: Get sender MAC address from ARP packet.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Nmunch::Dissectors::Base
Instance Method Details
#ip_address ⇒ Object
Public: Get sender IP address from ARP packet
Returns IP address
14 15 16 |
# File 'lib/nmunch/dissectors/arp.rb', line 14 def ip_address @ip_address ||= IPAddr.new(raw_data[28..31].join.hex, Socket::AF_INET).to_s end |
#mac_address ⇒ Object
Public: Get sender MAC address from ARP packet
Returns MAC address
21 22 23 |
# File 'lib/nmunch/dissectors/arp.rb', line 21 def mac_address @mac_address ||= raw_data[22..27].join(':') end |