ICMP数据包的源IP和目的IP

时间:2014-03-19 18:34:28

标签: .net sharppcap

我正在使用Sharp Pcap捕获数据包,我可以轻松检查IP包或IP数据包的IP:

Dim ip1 As IpPacket = IpPacket.GetEncapsulated(pack)
Dim arp As ARPPacket = ARPPacket.GetEncapsulated(pack)

    If (Not ip1 Is Nothing) Then
        log1.WriteLine("Received IP packet from {0}", ip1.SourceAddress.ToString)
    End If

    If (Not arp Is Nothing) Then
        log1.WriteLine("Received ARP packet from {0}", arp.SenderProtocolAddress.ToString)
    End If

我想找到ICMPPacket的属性,没有运气。如何查看ICMPPacket的源/目标地址?

1 个答案:

答案 0 :(得分:0)

ICMP数据包是IP数据包的一部分,因此要获取ICMPPacket的源IP,您必须获取IP数据包的源地址,然后检查它是否是ICMPPacket