Вопрос

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