Beispiel #1
0
        // The callback function for the SharpPcap library
        private static void device_PcapOnPacketArrival(object sender, Packet packet)
        {
            if (!(packet is TCPPacket))
            {
                return;
            }

            TCPPacket tcpPacket = (TCPPacket)packet;
            // Creates a key for the dictionary
            Connection c = new Connection(tcpPacket);

            // create a new entry if the key does not exists
            if (!sharpPcapDict.ContainsKey(c))
            {
                string   fileName = c.getFileName(path);
                TcpRecon tcpRecon = new TcpRecon(fileName);
                sharpPcapDict.Add(c, tcpRecon);
            }

            // Use the TcpRecon class to reconstruct the session
            sharpPcapDict[c].ReassemblePacket(tcpPacket);
        }
Beispiel #2
0
        // The callback function for the SharpPcap library
        private static void device_PcapOnPacketArrival(object sender, Packet packet)
        {
            if (!(packet is TCPPacket)) return;

            TCPPacket tcpPacket = (TCPPacket)packet;
            // Creates a key for the dictionary
            Connection c = new Connection(tcpPacket);

            // create a new entry if the key does not exists
            if (!sharpPcapDict.ContainsKey(c))
            {
                string fileName = c.getFileName(path);
                TcpRecon tcpRecon = new TcpRecon(fileName);
                sharpPcapDict.Add(c, tcpRecon);
            }

            // Use the TcpRecon class to reconstruct the session
            sharpPcapDict[c].ReassemblePacket(tcpPacket);
        }