Example #1
0
        public static void Test_AnalyzeTcpStreamTest_ReadPcap_01(string file)
        {
            Trace.WriteLine("Test_AnalyzeTcpStreamTest_ReadPcap_01");
            Trace.WriteLine("pcap file \"{0}\"", file);
            Pib.Pcap.Test.AnalyzeTcpStreamTest tcpAnalyze = new Pib.Pcap.Test.AnalyzeTcpStreamTest();
            using (PcapFileReader pcapFileReader = new PcapFileReader(GetPath(file)))
            {
                PPacketManager ppacketManager = new PPacketManager();
                foreach (PcapPacket packet in pcapFileReader)
                {
                    Packet packet2 = new Packet(packet.Data, packet.Timestamp, DataLinkKind.Ethernet);
                    tcpAnalyze.Add(ppacketManager.CreatePPacket(packet2));
                }
            }

            Trace.WriteLine("{0} packet captured", tcpAnalyze.Packets.Count);
            //var q = from p in gPacketList where p.TCPHeader != null orderby p.gGroupNumber, p.PacketNumber select p;
            var q = from p in tcpAnalyze.Packets where p.PPacket.Tcp != null orderby p.StreamNumber, p.PPacket.PacketNumber select p;

            Trace.WriteLine("{0} packet selectionned", q.Count());
            foreach (Pib.Pcap.Test.TcpStreamPacket p in q)
            {
                PrintStreamPacket(p);
            }
        }
Example #2
0
        public static void Test_AnalyzeTcpStreamTest_01(string deviceName)
        {
            Trace.WriteLine("Test_AnalyzeTcpStreamTest_01");
            ReceivePackets receivePackets = CreateReceivePackets(deviceName);

            Pib.Pcap.Test.AnalyzeTcpStreamTest tcpAnalyze = new Pib.Pcap.Test.AnalyzeTcpStreamTest();
            receivePackets.Receive(packet => tcpAnalyze.Add(packet));
            Trace.WriteLine("{0} packet captured", tcpAnalyze.Packets.Count);
            var q = from p in tcpAnalyze.Packets where p.PPacket.Tcp != null orderby p.StreamNumber, p.PPacket.PacketNumber select p;

            Trace.WriteLine("{0} packet selectionned", q.Count());
            foreach (Pib.Pcap.Test.TcpStreamPacket p in q)
            {
                PrintStreamPacket(p);
            }
        }
Example #3
0
        public static void Test_AnalyzeTcpStreamTest_ReadPcap_01(string file)
        {
            Trace.WriteLine("Test_AnalyzeTcpStreamTest_ReadPcap_01");
            Trace.WriteLine("pcap file \"{0}\"", file);
            Pib.Pcap.Test.AnalyzeTcpStreamTest tcpAnalyze = new Pib.Pcap.Test.AnalyzeTcpStreamTest();
            using (PcapFileReader pcapFileReader = new PcapFileReader(GetPath(file)))
            {
                PPacketManager ppacketManager = new PPacketManager();
                foreach (PcapPacket packet in pcapFileReader)
                {
                    Packet packet2 = new Packet(packet.Data, packet.Timestamp, DataLinkKind.Ethernet);
                    tcpAnalyze.Add(ppacketManager.CreatePPacket(packet2));
                }
            }

            Trace.WriteLine("{0} packet captured", tcpAnalyze.Packets.Count);
            //var q = from p in gPacketList where p.TCPHeader != null orderby p.gGroupNumber, p.PacketNumber select p;
            var q = from p in tcpAnalyze.Packets where p.PPacket.Tcp != null orderby p.StreamNumber, p.PPacket.PacketNumber select p;
            Trace.WriteLine("{0} packet selectionned", q.Count());
            foreach (Pib.Pcap.Test.TcpStreamPacket p in q)
                PrintStreamPacket(p);
        }
Example #4
0
 public static void Test_AnalyzeTcpStreamTest_01(string deviceName)
 {
     Trace.WriteLine("Test_AnalyzeTcpStreamTest_01");
     ReceivePackets receivePackets = CreateReceivePackets(deviceName);
     Pib.Pcap.Test.AnalyzeTcpStreamTest tcpAnalyze = new Pib.Pcap.Test.AnalyzeTcpStreamTest();
     receivePackets.Receive(packet => tcpAnalyze.Add(packet));
     Trace.WriteLine("{0} packet captured", tcpAnalyze.Packets.Count);
     var q = from p in tcpAnalyze.Packets where p.PPacket.Tcp != null orderby p.StreamNumber, p.PPacket.PacketNumber select p;
     Trace.WriteLine("{0} packet selectionned", q.Count());
     foreach (Pib.Pcap.Test.TcpStreamPacket p in q)
         PrintStreamPacket(p);
 }