Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Creating an ARP Packet

by Anonymous Monk
on Oct 03, 2003 at 19:50 UTC ( #296375=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to create an ARP network packet. Has anyone ever attempted to do this that could possibly point me in the right direction?

Replies are listed 'Best First'.
Re: Creating an ARP Packet
by athomason (Curate) on Oct 03, 2003 at 21:05 UTC
    If you need to use Perl, you'll probably get farthest by using the module hooks into libpcap, which implements raw socket functionality on *NIX and Windows. (A previous discussion of raw sockets in Perl is here).

    Glancing at CPAN, there's NetPacket::ARP, but apparently encoding isn't implemented. Still, it shouldn't be too hard to finish that yourself since the meat of the decoder is in a fairly self-documenting call to unpack, which I imagine could be inverted fairly easily. Once you have the encoded packet, one or more of NetPacket::Ethernet, Net::PcapUtils, and Net::RawIP should help you get it on the wire.

Re: Creating an ARP Packet
by hardburn (Abbot) on Oct 03, 2003 at 20:15 UTC

    Read RFC 826, then search Google for how to create a raw Ethernet packet. I don't know of any modules to help with this.

    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://296375]
Approved by grinder
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2021-11-28 20:23 GMT
Find Nodes?
    Voting Booth?

    No recent polls found