コード例 #1
0
        private void statis_Click(object sender, RoutedEventArgs e)
        {
            string name = ((MenuItem)sender).Header.ToString();

            if (name.Equals(@"I/O图表"))
            {
                iOChartStatisticsWindow = new IOChartStatisticsWindow();
                iOChartStatisticsWindow.Show();
            }
            else if (name.Equals(@"协议分级(P)"))
            {
                protocalStatisticsWindow = new ProtocalStatisticsWindow();
                protocalStatisticsWindow.Show();
            }
            else if (name.Equals(@"对话"))
            {
                conversationStatisticsWindow = new ConversationStatisticsWindow();
                conversationStatisticsWindow.Show();
            }
            else if (name.Equals(@"端点"))
            {
                endpointsStatisticsWindow = new EndpointsStatisticsWindow();
                endpointsStatisticsWindow.Show();
            }
            else if (name.Equals(@"分组长度"))
            {
                packetLengthsStatisticsWindow = new PacketLengthsStatisticsWindow();
                packetLengthsStatisticsWindow.Show();
            }
            else if (name.Equals(@"攻击日志"))
            {
                attackLogWindow = new AttackLogWindow();
                attackLogWindow.Show();
            }
            else if (name.Equals(@"捕包日志"))
            {
                captureLogWindow = new CaptureLogWindow();
                captureLogWindow.Show();
            }
            else if (name.Equals(@"异常"))
            {
                realTimeWindow = new RealTimeWindow();
                realTimeWindow.Show();
            }
        }
コード例 #2
0
        public void LoadData()
        {
            TreeListModel           = null;
            TreeRoot                = new TreeModelRoot();
            TreeRoot.IsBatchLoading = true;

            protocalStatByLayer = ProtocalStatisticsWindow.getProtocalStatByLayerInfo();
            if (protocalStatByLayer != null)
            {
                //frame
                ProtocalStatisticsTreeModel frame = new ProtocalStatisticsTreeModel()
                {
                    DisplayName   = "Frame",
                    Protocal      = "Frame",
                    PacketPercent = 100.0,
                    PacketNum     = protocalStatByLayer.LinkNum,
                    BytesPercent  = 100.0,
                    Bytes         = protocalStatByLayer.FrameSum,
                    bps           = Math.Round(protocalStatByLayer.FrameSum / protocalStatByLayer.Duration, 3)
                };
                //ethernet
                ProtocalStatisticsTreeModel ethernet = new ProtocalStatisticsTreeModel()
                {
                    DisplayName   = "Ethernet",
                    Protocal      = "Ethernet",
                    PacketPercent = 100.0,
                    PacketNum     = protocalStatByLayer.LinkNum,
                    BytesPercent  = Math.Round(protocalStatByLayer.LinkHeadSum * 100 / (double)protocalStatByLayer.FrameSum, 2),
                    Bytes         = protocalStatByLayer.LinkHeadSum,
                    bps           = Math.Round(protocalStatByLayer.LinkHeadSum / protocalStatByLayer.Duration, 3)
                };
                //ipv4
                ProtocalStatisticsTreeModel ipv4 = new ProtocalStatisticsTreeModel()
                {
                    DisplayName   = "Internet Protocal Version 4",
                    Protocal      = "Internet Protocal Version 4",
                    PacketPercent = Math.Round(protocalStatByLayer.IpV4Num * 100 / (double)protocalStatByLayer.LinkNum, 2),
                    PacketNum     = protocalStatByLayer.IpV4Num,
                    BytesPercent  = Math.Round(protocalStatByLayer.IpV4HSum * 100 / (double)protocalStatByLayer.FrameSum, 2),
                    Bytes         = protocalStatByLayer.IpV4HSum,
                    bps           = Math.Round(protocalStatByLayer.IpV4HSum / protocalStatByLayer.Duration, 3)
                };
                //ipv4-tcp
                ProtocalStatisticsTreeModel ipv4tcp = new ProtocalStatisticsTreeModel()
                {
                    DisplayName   = "Transmisson Control Protocol",
                    Protocal      = "Transmisson Control Protocol",
                    PacketPercent = Math.Round(protocalStatByLayer.IpV4TCPNum * 100 / (double)protocalStatByLayer.IpV4Num, 2),

                    PacketNum    = protocalStatByLayer.IpV4TCPNum,
                    BytesPercent = Math.Round(protocalStatByLayer.IpV4TCPHSum * 100 / (double)protocalStatByLayer.IpV4TSum, 2),
                    Bytes        = protocalStatByLayer.IpV4TCPHSum,
                    bps          = Math.Round(protocalStatByLayer.IpV4TCPHSum / protocalStatByLayer.Duration, 3)
                };
                ////ipv4-tcp-H
                //ProtocalStatisticsTreeModel ipv4tcpH = new ProtocalStatisticsTreeModel()
                //{
                //    DisplayName = "Header",
                //    Protocal = "Header",
                //    PacketPercent = protocalStatByLayer.IpV4TCPNum / (double)protocalStatByLayer.IpV4Num,
                //    PacketNum = protocalStatByLayer.IpV4TCPNum,
                //    BytesPercent = protocalStatByLayer.IpV4TCPHSum / (double)protocalStatByLayer.IpV4TSum,
                //    Bytes = protocalStatByLayer.IpV4TCPHSum,
                //    bps = protocalStatByLayer.IpV4TCPHSum / protocalStatByLayer.Duration
                //};
                ////ipv4-tcp-DATA
                //ProtocalStatisticsTreeModel ipv4tcpdata = new ProtocalStatisticsTreeModel()
                //{
                //    DisplayName = "Data",
                //    Protocal = "Data",
                //    PacketPercent = protocalStatByLayer.IpV4TCPNum / (double)protocalStatByLayer.IpV4Num,
                //    PacketNum = protocalStatByLayer.IpV4TCPNum,
                //    BytesPercent = protocalStatByLayer.IpV4TCPHSum / (double)protocalStatByLayer.IpV4TSum,
                //    Bytes = protocalStatByLayer.IpV4TCPHSum,
                //    bps = protocalStatByLayer.IpV4TCPHSum / protocalStatByLayer.Duration
                //};
                //ipv4-udp
                ProtocalStatisticsTreeModel ipv4udp = new ProtocalStatisticsTreeModel()
                {
                    DisplayName   = "User Datagram Protocol",
                    Protocal      = "User Datagram Protocol",
                    PacketPercent = Math.Round(protocalStatByLayer.IpV4UDPNum * 100 / (double)protocalStatByLayer.IpV4Num, 2),
                    PacketNum     = protocalStatByLayer.IpV4UDPNum,
                    BytesPercent  = Math.Round(protocalStatByLayer.IpV4UDPHSum * 100 / (double)protocalStatByLayer.IpV4TSum, 2),
                    Bytes         = protocalStatByLayer.IpV4UDPHSum,
                    bps           = Math.Round(protocalStatByLayer.IpV4UDPHSum / protocalStatByLayer.Duration, 3)
                };
                //ipv6
                ProtocalStatisticsTreeModel ipv6 = new ProtocalStatisticsTreeModel()
                {
                    DisplayName   = "Internet Protocal Version 6",
                    Protocal      = "Internet Protocal Version 6",
                    PacketPercent = Math.Round(protocalStatByLayer.IpV6Num * 100 / (double)protocalStatByLayer.LinkNum, 2),
                    PacketNum     = protocalStatByLayer.IpV6Num,
                    BytesPercent  = Math.Round(protocalStatByLayer.IpV6HSum * 100 / (double)protocalStatByLayer.FrameSum, 2),
                    Bytes         = protocalStatByLayer.IpV6HSum,
                    bps           = Math.Round(protocalStatByLayer.IpV6HSum / protocalStatByLayer.Duration, 3)
                };
                //ipv6-tcp
                ProtocalStatisticsTreeModel ipv6tcp = new ProtocalStatisticsTreeModel()
                {
                    DisplayName   = "Transmisson Control Protocol",
                    Protocal      = "Transmisson Control Protocol",
                    PacketPercent = Math.Round(protocalStatByLayer.IpV6TCPNum * 100 / (double)protocalStatByLayer.IpV6Num, 2),
                    PacketNum     = protocalStatByLayer.IpV6TCPNum,
                    BytesPercent  = Math.Round(protocalStatByLayer.IpV6TCPHSum * 100 / (double)protocalStatByLayer.IpV6TSum, 2),
                    Bytes         = protocalStatByLayer.IpV6TCPHSum,
                    bps           = Math.Round(protocalStatByLayer.IpV6TCPHSum / protocalStatByLayer.Duration, 3)
                };
                //ipv6-udp
                ProtocalStatisticsTreeModel ipv6udp = new ProtocalStatisticsTreeModel()
                {
                    DisplayName   = "User Datagram Protocol",
                    Protocal      = "User Datagram Protocol",
                    PacketPercent = Math.Round(protocalStatByLayer.IpV6UDPNum * 100 / (double)protocalStatByLayer.IpV6Num, 2),
                    PacketNum     = protocalStatByLayer.IpV6UDPNum,
                    BytesPercent  = Math.Round(protocalStatByLayer.IpV6UDPHSum * 100 / (double)protocalStatByLayer.IpV6TSum, 2),
                    Bytes         = protocalStatByLayer.IpV6UDPHSum,
                    bps           = Math.Round(protocalStatByLayer.IpV6UDPHSum / protocalStatByLayer.Duration, 3)
                };
                //arp
                ProtocalStatisticsTreeModel arp = new ProtocalStatisticsTreeModel()
                {
                    DisplayName   = "Adress Resolution Protocal",
                    Protocal      = "Adress Resolution Protocal",
                    PacketPercent = Math.Round(protocalStatByLayer.ArpNum * 100 / (double)protocalStatByLayer.LinkNum, 2),
                    PacketNum     = protocalStatByLayer.ArpNum,
                    BytesPercent  = Math.Round(protocalStatByLayer.ArpHSum * 100 / (double)protocalStatByLayer.FrameSum, 2),
                    Bytes         = protocalStatByLayer.ArpHSum,
                    bps           = Math.Round(protocalStatByLayer.ArpHSum / protocalStatByLayer.Duration, 3)
                };
                ipv4.Children.Add(ipv4tcp);
                ipv4.Children.Add(ipv4udp);

                ipv6.Children.Add(ipv6tcp);
                ipv6.Children.Add(ipv6udp);

                ethernet.Children.Add(ipv4);
                ethernet.Children.Add(ipv6);
                ethernet.Children.Add(arp);
                frame.Children.Add(ethernet);
                TreeRoot.Children.Add(frame);
            }



            TreeRoot.IsBatchLoading = false;
            TreeListModel           = TreeRoot;
        }