コード例 #1
0
        public void onResetPlugin()
        {
            if (InvokeRequired)
            {
                BeginInvoke(new onResetPluginDelegate(onResetPlugin), new object[] { });
                return;
            } // if (InvokeRequired)


            cPluginParams.HostApplication.PluginSetStatus(this, "grey");

            /*
             * Clear DataGridView
             */
            //if (cSessions != null)
            //  cSessions.Clear();

            //DGV_Sessions.DataSource = cSessions;
            //DGV_Sessions.Refresh();

            /*
             * Clear TreeView
             */
            try
            {
                if (TV_Sessions != null && TV_Sessions.Nodes.Count > 0)
                {
                    foreach (TreeNode lNode in TV_Sessions.Nodes)
                    {
                        foreach (TreeNode lSubNode in lNode.Nodes)
                        {
                            if (lSubNode != null && lSubNode.Nodes.Count > 0)
                            {
                                lSubNode.Nodes.Clear();
                            }
                        }
                    }
                }
            }
            catch (Exception) { }

            /*
             * Select Main TV-Node.
             */
            mFilterNode = TV_Sessions.Nodes[0];
            TV_Sessions.SelectedNode = TV_Sessions.Nodes[0];
            TV_Sessions.Select();
            //            myTreeView.SelectedNode = myTreeNode
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TSMI_Clear_Click(object sender, EventArgs e)
        {
            /*
             * Clear DataGridView
             */
            if (cSessions != null)
            {
                cSessions.Clear();
            }

            DGV_Sessions.DataSource = cSessions;
            DGV_Sessions.Refresh();

            /*
             * Clear TreeView
             */
            try
            {
                if (TV_Sessions != null && TV_Sessions.Nodes.Count > 0)
                {
                    foreach (TreeNode lNode in TV_Sessions.Nodes)
                    {
                        foreach (TreeNode lSubNode in lNode.Nodes)
                        {
                            if (lSubNode != null && lSubNode.Nodes.Count > 0)
                            {
                                lSubNode.Nodes.Clear();
                            }
                        }
                    }
                }
            }
            catch (Exception lEx)
            {
                cPluginParams.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message));
            }

            /*
             * Select Main TV-Node.
             */
            mFilterNode = TV_Sessions.Nodes[0];
            TV_Sessions.SelectedNode = TV_Sessions.Nodes[0];
            TV_Sessions.Select();
            //myTreeView.SelectedNode = myTreeNode
        }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TV_Sessions_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     // This wont work :  mFilterNode = TV_Sessions.SelectedNode;
     mFilterNode = TV_Sessions.GetNodeAt(e.X, e.Y);
     DGVFilter();
 }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TV_Sessions_AfterCollapse(object sender, TreeViewEventArgs e)
 {
     TV_Sessions.ExpandAll();
 }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        public PluginSessionsUC(PluginParameters pPluginParams)
        {
            InitializeComponent();

            TV_Sessions.ExpandAll();


            #region DATAGRID HEADER

            DGV_Sessions.AutoGenerateColumns = false;

            DataGridViewTextBoxColumn cSrcMAC = new DataGridViewTextBoxColumn();
            cSrcMAC.DataPropertyName = "SrcMAC";
            cSrcMAC.Name             = "SrcMAC";
            cSrcMAC.HeaderText       = "Source MAC";
            cSrcMAC.Width            = 125;
            DGV_Sessions.Columns.Add(cSrcMAC);


            DataGridViewTextBoxColumn cSrcIPCol = new DataGridViewTextBoxColumn();
            cSrcIPCol.DataPropertyName = "SrcIP";
            cSrcIPCol.Name             = "SrcIP";
            cSrcIPCol.HeaderText       = "Source IP";
            cSrcIPCol.Width            = 120;
            //            cSrcIPCol.Visible = false;
            DGV_Sessions.Columns.Add(cSrcIPCol);


            DataGridViewTextBoxColumn cServiceURLCol = new DataGridViewTextBoxColumn();
            cServiceURLCol.DataPropertyName = "URL";
            cServiceURLCol.Name             = "URL";
            cServiceURLCol.HeaderText       = "URL";
            cServiceURLCol.ReadOnly         = true;
            cServiceURLCol.Resizable        = System.Windows.Forms.DataGridViewTriState.False;
            //            cServiceURLCol.Width = 180;
            cServiceURLCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            DGV_Sessions.Columns.Add(cServiceURLCol);


            DataGridViewTextBoxColumn cDestPortCol = new DataGridViewTextBoxColumn();
            cDestPortCol.DataPropertyName = "DstPort";
            cDestPortCol.Name             = "DstPort";
            cDestPortCol.HeaderText       = "Service";
            cDestPortCol.Visible          = false;
            cDestPortCol.ReadOnly         = true;
            DGV_Sessions.Columns.Add(cDestPortCol);


            DataGridViewTextBoxColumn cCookiesCol = new DataGridViewTextBoxColumn();
            cCookiesCol.DataPropertyName = "SessionCookies";
            cCookiesCol.Name             = "SessionCookies";
            cCookiesCol.HeaderText       = "Cookies";
            cCookiesCol.Visible          = false;
            DGV_Sessions.Columns.Add(cCookiesCol);


            DataGridViewTextBoxColumn cBrowserCol = new DataGridViewTextBoxColumn();
            cBrowserCol.DataPropertyName = "Browser";
            cBrowserCol.Name             = "Browser";
            cBrowserCol.HeaderText       = "Browser";
            cBrowserCol.Visible          = false;
            cBrowserCol.Width            = 120;
            DGV_Sessions.Columns.Add(cBrowserCol);



            DataGridViewTextBoxColumn cGroupCol = new DataGridViewTextBoxColumn();
            cGroupCol.DataPropertyName = "Group";
            cGroupCol.Name             = "Group";
            cGroupCol.HeaderText       = "Group";
            cGroupCol.Visible          = false;
            cGroupCol.Width            = 0;
            DGV_Sessions.Columns.Add(cGroupCol);

            cSessions = new BindingList <Session.Config.Session>();
            DGV_Sessions.DataSource = cSessions;
            #endregion


            /*
             * Plugin configuration
             */
            T_GUIUpdate.Interval = 1000;
            cPluginParams        = pPluginParams;
            String lBaseDir    = String.Format(@"{0}\", (pPluginParams != null) ? pPluginParams.PluginDirectoryFullPath : Directory.GetCurrentDirectory());
            String lSessionDir = (pPluginParams != null) ? pPluginParams.SessionDirectoryFullPath : String.Format("{0}sessions", lBaseDir);

            Config = new PluginProperties()
            {
                BaseDir           = lBaseDir,
                SessionDir        = lSessionDir,
                PluginName        = "Sessions",
                PluginDescription = "Listing and taking over session where valid session cookies where found within HTTP requests.",
                PluginVersion     = "0.8",
                Ports             = "TCP:80;TCP:443;",
                IsActive          = true
            };
            cDataBatch = new List <String>();

            // Make it double buffered.
            typeof(DataGridView).InvokeMember("DoubleBuffered", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, null, DGV_Sessions, new object[] { true });
            T_GUIUpdate.Start();

            cSessionPatterns         = new List <MngSessionsConfig.SessionPattern>();
            TV_Sessions.DoubleClick += TreeView_DoubleClick;

            cTask = TaskFacade.getInstance(this);
            DomainFacade.getInstance(this).addObserver(this);
        }