コード例 #1
0
        public HashesUserControl(CommonUi.NetworkContext networkContext)
        {
            InitializeComponent();
            _networkContext = networkContext;

            this._hashesTableUserControl = new GenericTableUserControl();
            _hashesTableUserControl.Dock = DockStyle.Fill;
            _hashesTableUserControl.SetTableDataType(typeof(PcapAnalyzer.NetworkHash));
            _hashesTableUserControl.SelectionChanged += OnSelectionChanged;
            this.mainSplitContainer.Panel1.Controls.Clear();
            this.mainSplitContainer.Panel1.Controls.Add(_hashesTableUserControl);
        }
コード例 #2
0
        public SessionsExplorerUserControl(CommonUi.NetworkContext networkContext)
        {
            InitializeComponent();

            // Initialize the sessions gridview.
            _networkContext = networkContext;
            this.sessionsDataGridView.SelectionChanged  += OnSessionsDataGridViewSelectionChanged;
            this.sessionsDataGridView.AllowUserToAddRows = false;

            // Add the Session Viewer control.
            _sessionViewerUserControl      = new SessionViewerUserControl();
            _sessionViewerUserControl.Dock = DockStyle.Fill;
            this.bottomSplitContainer.Panel1.Controls.Add(_sessionViewerUserControl);

            // Initialize the filter columns Combo Box.
            InitializeColumnsNames();
        }
コード例 #3
0
        public NetworkMapUserControl(CommonUi.NetworkContext networkContext)
        {
            InitializeComponent();
            _networkContext = networkContext;

            // Add MSAGL Graph control and register to click events.
            _dnsMappings        = new Dictionary <string, HashSet <string> >();
            _edges              = new HashSet <NetworkMapEdge>();
            _viewer             = new Microsoft.Msagl.GraphViewerGdi.GViewer();
            _viewer.MouseClick += OnGraphMouseClick;
            _graph              = new Microsoft.Msagl.Drawing.Graph("graph");
            _viewer.Graph       = _graph;
            _viewer.Dock        = DockStyle.Fill;
            this.mainSplitContainer.Panel1.Controls.Add(_viewer);

            // There is a bit odd behavior of the controls in the second panel when the msagl is at
            // the first panel (not drawing the tree view). This force the second panel to refresh.
            this.mainSplitContainer.Panel2.Refresh();
            this.nodeTreeView.Click += (object sender, EventArgs e) => this.mainSplitContainer.Panel2.Refresh();
        }
コード例 #4
0
        private void clearResutlsButton_Click(object sender, EventArgs e)
        {
            _networkContext = new CommonUi.NetworkContext();
            _analyzer.Clear();

            // Clear all modules user controls by recreating them.
            InitilizeModulesUserControls();

            // Remove the items count of each module from the tree view (e.g "DNS (13)" -> "DNS").
            foreach (var node in Utilities.IterateAllNodes(modulesTreeView.Nodes))
            {
                var index = node.Text.LastIndexOf('(');

                if (index > 0)
                {
                    node.Text = node.Text.Substring(0, index);
                }
            }

            // Select the head of the modules tree view to force refreshing of the current user control.
            modulesTreeView.SelectedNode = modulesTreeView.Nodes[0];
        }
コード例 #5
0
        public MainForm()
        {
            InitializeComponent();

            _files          = new HashSet <string>();
            _cts            = new CancellationTokenSource();
            _networkContext = new CommonUi.NetworkContext();

            // Create the DAL and BLL objects.
            _processor = new PcapProcessor.Processor();
            _sniffer   = new PcapProcessor.Sniffer();
            _analyzer  = new PcapAnalyzer.Analyzer();
            _processor.BuildTcpSessions = true;
            _processor.BuildUdpSessions = true;

            // Contract the events.
            _sniffer.UdpPacketArived               += (s, e) => _analyzer.Analyze(CommonUi.Casting.CastProcessorUdpPacketToAnalyzerUdpPacket(e.Packet));
            _sniffer.TcpPacketArived               += (s, e) => _analyzer.Analyze(CommonUi.Casting.CastProcessorTcpPacketToAnalyzerTcpPacket(e.Packet));
            _sniffer.TcpSessionArrived             += (s, e) => _analyzer.Analyze(CommonUi.Casting.CastProcessorTcpSessionToAnalyzerTcpSession(e.TcpSession));
            _sniffer.TcpSessionArrived             += (s, e) => SwitchToMainThreadContext(() => OnSessionArived(e.TcpSession));
            _sniffer.UdpSessionArrived             += (s, e) => SwitchToMainThreadContext(() => OnSessionArived(e.UdpSession));
            _processor.UdpPacketArived             += (s, e) => _analyzer.Analyze(CommonUi.Casting.CastProcessorUdpPacketToAnalyzerUdpPacket(e.Packet));
            _processor.TcpPacketArived             += (s, e) => _analyzer.Analyze(CommonUi.Casting.CastProcessorTcpPacketToAnalyzerTcpPacket(e.Packet));
            _processor.TcpSessionArrived           += (s, e) => _analyzer.Analyze(CommonUi.Casting.CastProcessorTcpSessionToAnalyzerTcpSession(e.TcpSession));
            _processor.TcpSessionArrived           += (s, e) => SwitchToMainThreadContext(() => OnSessionArived(e.TcpSession));
            _processor.UdpSessionArrived           += (s, e) => SwitchToMainThreadContext(() => OnSessionArived(e.UdpSession));
            _processor.FileProcessingStatusChanged += (s, e) => SwitchToMainThreadContext(() => OnFileProcessingStatusChanged(s, e));
            _processor.ProcessingPrecentsChanged   += (s, e) => SwitchToMainThreadContext(() => OnProcessingPrecentsChanged(s, e));
            _processor.ProcessingFinished          += (s, e) => SwitchToMainThreadContext(() => OnProcessingFinished(s, e));
            _analyzer.ParsedItemDetected           += (s, e) => SwitchToMainThreadContext(() => OnParsedItemDetected(s, e));
            _analyzer.UpdatedItemProprertyDetected += (s, e) => SwitchToMainThreadContext(() => OnUpdatedItemProprertyDetected(s, e));

            InitilizeModulesUserControls();
            InitilizeFilesIconsList();
            InitilizeModulesCheckedListBox();
            InitilizeInterfacesComboBox();
            this.modulesTreeView.ExpandAll();
            CheckForUpdates();
        }