-1

I am wanting to send raw ethernet frames with C++ for networking testing, I've looked at a few methods but some have some truly terrible examples. So I thought I would just ask what the best method would be, I don't need to drop frames, so no need for kernel mode (although a kernel mode solution would be useful as well). Doesn't need to be Windows, but it would make it easier.

Dark Light
  • 19
  • 2
  • Could you provide a little more information about your question. What format are your frames in? What are the methods you looked into already? – Juicestus Sep 05 '21 at 14:28
  • The frames will be in standard ethernet format, select an interface and start sending bytes. The main one I looked at is winpcap, but the examples seem really badly written since they are basically in c in c++. I know a thing to two about networking and C++, its just there is so much bad information out there, so I thought I would just ask and maybe a straight answer will help a lot of other people. What I am wanting to do is networking testing, things like send loads of DHCP packets, send HTTP packets with fake MAC addresses to overload the NAT, that sort of thing. – Dark Light Sep 05 '21 at 14:41
  • 1
    if you are interested in Windows specific solution you should mention it in the question and add Windows tag. Then afaik windows [does not allow](https://stackoverflow.com/a/22699340) to fake MAC etc. on purpose (to limit botnet attacks etc.), so you will need winpcap-like driver that provides API to bypass this limitation. – dewaffled Sep 05 '21 at 14:56
  • It doesn't have to be Windows, although it would make it a bit easier. – Dark Light Sep 05 '21 at 15:00
  • Please use the [edit](https://stackoverflow.com/posts/69064259/edit) link beneath the question to update the question with the new information. SO doesn't guarantee that the longevity of comments will match the question. In general, prefer to answer requests for more information by updating the question then notify the requester with a "@username I've updated the question with the information you asked for" comment. – user4581301 Sep 05 '21 at 15:20

1 Answers1

-1

You can use Boost:ASIO rawsockets for this purpose if understand you correctly

https://github.com/kevincon/asio-rawsockets-example

Create a layer 2 / ethernet socket with boost asio raw socket (in C++)

LexusA
  • 23
  • 3