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,

-SorCerer

Recommended Answers

All 5 Replies

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.

-SorCerer

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 ?

-SorCerer

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 ??

-SorCerer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.