I am looking for an arp sender written in c++ with no deps (no libpcap or libnet). I am working now at some raw sockets code, but i get all sort of errors in the sendto(), even with the IP_HDRINCL option set. The code is ok, it sends TCP and UDP fine.

So, if anyone has any arp-related code, or some info, please share. Any info on lower-than-raw level is also apreciated.

Thanks for your time,


12 Years
Discussion Span
Last Post by SorCerer

Now this is a bit OS specific when it comes to raw packet sending.I really dont know if you can manually control ARP packets on a Windows PC (XP,2000,NT [you dont even get raw packet access on other windows vers]).

You can find *nix code easily on the net.(try send_arp.c).

Using Windows XP,eh?


I`m working on win2000. Well it can be done (ettercap has been ported using vmware and libpcap ...) so i guess there is a way. I just need to reach the lowest layer...

Thanks, for the linux send_arp.c tip, i`ll take a look.



Yea, you can also use wincap, that library provides you with raw packet access and is portable.


Well, after doing some research, i came over this quote :

I don't think you can govern the Ethernet header encapsulation having a raw IP socket. The Ethernet part of the header (inlcuding the protocol ID) will be formed automatically by IP and you will not be able to influence this. You will only be able to form the _IP_ header manually, not the _Ethernet_ header

It seems that i need do go one level deeper. Any ideas on doing that ? Some sort of driver implementation maybe ? Asm ?



After some more research, i found out that on linux one can use an socket like this

fd = socket(AF_INET, SOCK_PACKET, htons(ETH_P_ARP));

but it seems that SOCK_PACKET is not supported by windows.

Does anyone know an alternative to this that will work on windows 2k ??


Edited by ~s.o.s~: formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.