如何用C#发送原始以太网数据包?以太网、数据包、如何用、原始

2023-09-02 21:24:35 作者:唯有、努力

有没有办法通过C#发送原始数据包的以太网到其他主机?在Windows 7中,如果它使不同。

Is there a way to send raw packet Ethernet to other host via C#? In Windows 7 if it makes difference.

推荐答案

根据建议由Saint_pl:

Based on suggestion by Saint_pl:

我觉得可能是更好的解决方案 - 类似于SharpPcap。这是 Pcap.Net - .NET包装WinPcap的。现在,我可以修改我的包我想做的事情。

I found probably better solution - similar to SharpPcap. It's Pcap.Net - .NET wrapper for WinPcap. Now I can modify my packets whatever I want.

我有一些资源给你,也许有帮助。我不尝试在Windows 7解决方案,但也许它包含了一些好消息的开始。

I have some resources for you that maybe helpful. I don't try that solutions in Windows 7 but maybe it contains some good info to start.

原始以太网数据包操纵或的镜子$ C $的CProject

这篇文章做的目的是解释如何使用C#在Microsoft平台发送原始以太网数据包。甲原始以太网包是发送到物理线的完整二层网络帧。在发送帧这样可以让你操纵的目标和源MAC地址和第3层协议字段。

以太网数据传输原理

This purpose of this article is to explain how to send a raw Ethernet packet using C# on a Microsoft platform. A raw Ethernet packet is the complete Layer 2 network frame that is sent to the physical wire. Sending a frame like this allows you to manipulate the target and source MAC addresses and the Layer 3 protocol fields.

还有一些原始套接字信息(以防万一你有意思太):

Also some info on raw sockets (just in case you interesting too):

Client (和服务器)套接字通信取整章,但这里的关键部位一看:

Client (and Server) Sockets Communication take a look on whole chapter but here key parts:

C#原始UDP套接字程序范例 在C#原始套接字坪程序示例part一个 | part乙 所有例子 C# Raw UDP Socket Program Example C# Raw Socket Ping Program Example part A | part B All examples

不发送数据包,但也许有趣:网络嗅探器在C#中,的 SharpPcap - 数据包捕获框架.NET

Not sending packets but maybe interesting: A Network Sniffer in C#, SharpPcap - A Packet Capture Framework for .NET