Trying to get just the address or raw bytes in SharpPcap

33 views Asked by At

I am using SharpPcap to capture packets on the network but I am having a problem. I can not get just the destination IP ADDRES or raw the ray bytes from the packets. Is there a way to print the raw bytes or the destination IP Address? My code:

static void Main(string[] args)
        {
            CaptureDeviceList devices = CaptureDeviceList.Instance;

            if (devices.Count == 0)
            {
                Console.WriteLine("No device was found");
                return;
            }
            /*foreach (var i in devices)
                Console.WriteLine(i.ToString()+"-----------");*/

            ICaptureDevice device = devices[4];

            device.Open();
            device.OnPacketArrival += Device_OnPacketArrival;
            device.Filter = "port 5900";
            device.StartCapture();

            Console.ReadLine();
        }
        static void Device_OnPacketArrival(object s, PacketCapture e)
        {
            Console.WriteLine(e.Device); //print packets information. I cannot use "e" to print the raw bytes or the IP address. Is there a way to do that?
        }

e.Device

I tried several things but none worked.

0

There are 0 answers