【问题标题】:Manipulating and sending an ARP response in pcap.net?在 pcap.net 中操作和发送 ARP 响应?
【发布时间】:2015-12-06 23:19:07
【问题描述】:

我正在构建一个人工网桥,为了让数据包通过它,它必须发送一个 arp 响应,就好像它是目标计算机一样,以便针对网络另一端的数据包通过它.

我找到了一种发送 ARP 请求广播的方法 Sending my own ARP packet using SharpPcap and Packet.Net

但是我找不到任何关于如何发送响应的 API 描述。

谢谢

【问题讨论】:

  • 这个问题是关于 Pcap.Net 还是 SharpPcap?标签和标题说 pcap.net 但内容说 SharpPcap。
  • @brickner 抱歉,我没有注意到我链接的代码在 SharpPcap 中。两者都可以作为解决方案。

标签: c# network-programming arp spoofing pcap.net


【解决方案1】:

我查找了一个示例 ARP pcap 文件并找到了这个:http://packetlife.net/captures/icmp_in_l2tpv3.cap(在 Wireshark 中搜索 arp)。

这里是Pcap.Net 代码,它应该创建一个与此文件中的 ARP 回复数据包等效的数据包:

Packet packet = PacketBuilder.Build(
    DateTime.Now,
    new EthernetLayer
    {
        Source = new MacAddress("00:50:56:a5:64:4d"),
        Destination = new MacAddress("00:50:56:9a:78:c7"),
        EtherType = EthernetType.Arp
    },
    new ArpLayer
    {
        ProtocolType = EthernetType.IpV4,
        SenderHardwareAddress = new byte[] {0x00, 0x50, 0x56, 0xa5, 0x64, 0x4d}.AsReadOnly(),
        SenderProtocolAddress = new byte[] {0x0a, 0xd8, 0x64, 0xd2}.AsReadOnly(),
        TargetHardwareAddress = new byte[] {0x00, 0x50, 0x56, 0x9a, 0x78, 0xc7}.AsReadOnly(),
        TargetProtocolAddress = new byte[] {0x0a, 0xd8, 0x64, 0xd3}.AsReadOnly(),
        Operation = ArpOperation.Reply,
    });

【讨论】:

    猜你喜欢
    • 2015-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-29
    • 2015-11-11
    • 2022-01-01
    • 2019-06-29
    • 2011-03-30
    相关资源
    最近更新 更多