http://www.perlmonks.org?node_id=688428


in reply to Re: ARP Lookups
in thread ARP Lookups

Grinder: Thank you for the pointer to what looks like yet another wonderful tool. I should explain however, that I am trying to do this as an educational/hobbyist experience type of deal. So the end result isn't so much important as learning how to get there =) My perl knowledge is pretty much all self learned through Oreilly Books, Perlmonks, and painful trial and error. I know this will generate naysayers who will tell me "give up this is too advanced for you" but frankly I don't care. The act of figuring it all out is what is important to me here, not making the greatest piece of software ever or trying to prove I am a great programmer(cus I'm not)

Replies are listed 'Best First'.
Re^3: ARP Lookups
by starbolin (Hermit) on May 25, 2008 at 19:32 UTC

    WalkingZero writes:

    I am trying to write a function that, given an array of IP addresses, will run ARP requests to find out which IPs are currently assigned to live hosts.
    If that's all you are trying to do then send some packet to the host that you think it will respond to and, if it responds, then your ARP cache is correct. Look in the ARP cache for the MAC.
    I think Net::Pcap is probably half of what I need.
    Not likely.
    I still feel that dealing with a raw ARP Request and Reply over the wire is the best way to accomplish my ends.
    If you use a perl module to construct a packet to send then most such modules also will provide a way to deconstruct the packet you receive. For ARP packets you might try NetPacket::ARP. Claims to do what you need. You'll have to open a socket to your destination to send the packets formated by NetPacket::ARP.


    s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}
      After the blessed duh moment pointed out by the Anonymous monk, I have the sending don with Net::ARP however a strange thing occurs. NOTHING bothers listening for the reply packet. I watched with wireshark and I get the reply, but it is not stored in ARP Cache and if Net::ARP is listening for it somewhere I don't know where it could be. So I just need to figure out the best way to listen for this reply packet. I'm looking at both Net::Pcap and the Net::Frame tools