I am capturing packets with Sharp Pcap, I can easily check IP of IPpacket or ARP packet:

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

I wanted to find properties for ICMPPacket, with no luck. How can I check source/destination address of ICMPPacket?

有帮助吗?

解决方案

ICMP packet is part of IP packet, thus to get source IP of ICMPPacket, you have to get source address of IP packet then check if it's ICMPPacket

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top