Net::F...r::ARP(3pm)

πŸ“¦
version 1.21 Β· 2 versions
  • 1.21 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.21 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ Net::Frame::Layer::ARP πŸ’– (that's the Net::F...r::ARP(3pm) page bestie, welcome)

okay so you want to speak ARP. Address Resolution Protocol. The thing that goes "hey who has this IP" and everyone in the room turns around. This module is the ARP layer object from Net::Frame, and it does encoding and decoding, which is giving bilingual icon behaviour ngl πŸŽ€


🌸 NAME 🌸

Net::Frame::Layer::ARP β€” the Address Resolution Protocol layer object. yes she's a whole class, and yes she's slaying πŸ’…


✨ SYNOPSIS ✨

here's the whole vibe, copy-paste ready:

use Net::Frame::Layer::ARP qw(:consts);

# Build a layer
my $layer = Net::Frame::Layer::ARP->new(
   hType   => NF_ARP_HTYPE_ETH,
   pType   => NF_ARP_PTYPE_IPv4,
   hSize   => NF_ARP_HSIZE_ETH,
   pSize   => NF_ARP_PSIZE_IPv4,
   opCode  => NF_ARP_OPCODE_REQUEST,
   src     => '00:00:00:00:00:00',
   dst     => NF_ARP_ADDR_BROADCAST,
   srcIp   => '127.0.0.1',
   dstIp   => '127.0.0.1',
);
$layer->pack;

print 'RAW: '.$layer->dump."\n";

# Read a raw layer
my $layer = Net::Frame::Layer::ARP->new(raw => $raw);

print $layer->print."\n";
print 'PAYLOAD: '.unpack('H*', $layer->payload)."\n"
   if $layer->payload;

first half = you building a packet from scratch, main character energy. second half = you reading one that already showed up. both are valid, both eat 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

this module implements the encoding and decoding of the ARP layer. that's the whole job description, and she does it flawlessly no cap.

RFC: ftp://ftp.rfc-editor.org/in-notes/rfc826.txt β€” go read it, it's the blueprint, the lore, the origin story πŸ“œ

also peep Net::Frame::Layer for other attributes and methods, because a lot of the good stuff is inherited from there.


πŸ’œ ATTRIBUTES πŸ’œ

  • hType, pType β€” hardware and protocol address types. the "what kind of addresses are we even talking about" fields.
  • hSize, pSize β€” hardware and protocol address sizes, in bytes. yes, bytes, keep up bestie.
  • opCode β€” the operation code number to perform. the actual "what am I doing here" of the packet.
  • src, dst β€” source and destination hardware addresses.
  • srcIp, dstIp β€” source and destination IP addresses.

okay and the following are inherited attributes. head to Net::Frame::Layer if you want the full tea:

  • raw
  • payload
  • nextLayer

πŸŽ€ METHODS πŸŽ€

  • new
  • new (hash) β€” the object constructor. you can pass attributes in and they'll overwrite the default ones. wanna know what the defaults are? go look at SYNOPSIS, it's all laid out up there ⬆️
  • getKey
  • getKeyReverse β€” these two are basically there to make things faster when you use the recv method from Net::Frame::Simple. usually you write them when you need to write a match method. iykyk πŸ”‘
  • match (Net::Frame::Layer::ARP object) β€” mostly used internally, ngl. you hand it a Net::Frame::Layer::ARP layer as a parameter, and it returns true if this is a response corresponding for the request, or false if it's not. a yes/no girlie, we respect it πŸ’…

and the following are inherited methods. some of them may be overridden in this layer, and some others may not be meaningful in this layer. see Net::Frame::Layer for more:

  • layer
  • computeLengths
  • computeChecksums
  • pack
  • unpack
  • encapsulate
  • getLength
  • getPayloadLength
  • print
  • dump

🌈 CONSTANTS 🌈

load them like this, don't forget the :consts:

use Net::Frame::Layer::ARP qw(:consts);
  • NF_ARP_HTYPE_ETH β€” hardware address types.
  • NF_ARP_PTYPE_IPv4
  • NF_ARP_PTYPE_IPv6 β€” protocol address types.
  • NF_ARP_HSIZE_ETH β€” hardware address sizes.
  • NF_ARP_PSIZE_IPv4
  • NF_ARP_PSIZE_IPv6 β€” protocol address sizes.
  • NF_ARP_OPCODE_REQUEST
  • NF_ARP_OPCODE_REPLY β€” operation code numbers.
  • NF_ARP_ADDR_BROADCAST β€” broadcast address for the src or dst attributes. she's shouting, and honestly? valid πŸ“£

πŸ‘‘ SEE ALSO πŸ‘‘

  • Net::Frame::Layer

🌟 AUTHOR 🌟

Patrice <GomoR> Auffret β€” legend behaviour, we stan 🫢


Copyright (c) 2006-2019, Patrice <GomoR> Auffret

You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.


and that's the whole page bestie, go forth and ARP responsibly πŸ¦‹

made with perl v5.36.0 and dated 2022-12-04 β€” mwah, xoxo, happy packet crafting πŸ’…βœ¨