Пример #1
0
        private void ScanBranchStartScanBtn_Click(object sender, EventArgs e)
        {
            ScanBranchStartScanBtn.Enabled = false;
            ScanBranchErrorTB.Text         = "";
            if (ScanBranchHostNameTB.Text.Trim().Length == 0)
            {
                ScanBranchErrorTB.Text         = "No HostName Specified";
                ScanBranchStartScanBtn.Enabled = true;
                return;
            }
            if (ScanBranchUrlPatternTB.Text.Trim().Length == 0)
            {
                ScanBranchErrorTB.Text         = "No Url Pattern Specified";
                ScanBranchStartScanBtn.Enabled = true;
                return;
            }
            if (!(ScanBranchHTTPCB.Checked || ScanBranchHTTPSCB.Checked))
            {
                ScanBranchErrorTB.Text         = "Both HTTP & HTTPS are Unchecked. Select Atleast One";
                ScanBranchStartScanBtn.Enabled = true;
                return;
            }
            if (!(ScanBranchInjectAllCB.Checked || ScanBranchInjectURLCB.Checked || ScanBranchInjectQueryCB.Checked || ScanBranchInjectBodyCB.Checked || ScanBranchInjectCookieCB.Checked || ScanBranchInjectHeadersCB.Checked))
            {
                ScanBranchErrorTB.Text         = "No Injection Points Selected";
                ScanBranchStartScanBtn.Enabled = true;
                return;
            }
            if (!(ScanBranchPickProxyLogCB.Checked || ScanBranchPickProbeLogCB.Checked))
            {
                ScanBranchErrorTB.Text         = "Log source not selected. Select from Proxy Log/Probe Log";
                ScanBranchStartScanBtn.Enabled = true;
                return;
            }
            bool Checked = false;

            foreach (DataGridViewRow Row in ScanBranchScanPluginsGrid.Rows)
            {
                if ((bool)Row.Cells[0].Value)
                {
                    Checked = true;
                    break;
                }
            }
            if (!Checked)
            {
                ScanBranchErrorTB.Text         = "No Scan Plugins Selected";
                ScanBranchStartScanBtn.Enabled = true;
                return;
            }
            if (ScanBranchSessionPluginsCombo.Text.Length > 0)
            {
                if (ScanBranchSessionPluginsCombo.SelectedItem == null)
                {
                    ScanBranchErrorTB.Text         = "Selected Session Plugin is Not Valid";
                    ScanBranchStartScanBtn.Enabled = true;
                    return;
                }
            }
            if (ScanBranchFormatPluginsCombo.Text.Length > 0)
            {
                if (ScanBranchFormatPluginsCombo.SelectedItem == null)
                {
                    ScanBranchErrorTB.Text         = "Selected Format Plugin is Not Valid";
                    ScanBranchStartScanBtn.Enabled = true;
                    return;
                }
            }
            ScanBranch.ProxyLogIDs.Clear();
            ScanBranch.ProbeLogIDs.Clear();
            IronUI.UpdateScanBranchConfigFromUI();
            ScanBranchStatsPanel.Visible = true;
            ScanBranchProgressLbl.Text   = "Selecting requests based on filter";
            if (ScanBranch.PickFromProxyLog)
            {
                if (IronUI.UI.ProxyLogGrid.Rows.Count == 0 && !ScanBranch.PickFromProbeLog)
                {
                    ScanBranchErrorTB.Text         = "Proxy Log is Empty. Capture Some Traffic with the Proxy First";
                    ScanBranchStatsPanel.Visible   = false;
                    ScanBranchStartScanBtn.Enabled = true;
                    return;
                }
                foreach (DataGridViewRow Row in IronUI.UI.ProxyLogGrid.Rows)
                {
                    try
                    {
                        if (ScanBranch.CanScan(Row, "Proxy"))
                        {
                            ScanBranch.ProxyLogIDs.Add((int)Row.Cells[0].Value);
                        }
                    }
                    catch (Exception Exp)
                    {
                        IronException.Report("ScanBranch Error reading ProxyLogGrid Message", Exp.Message, Exp.StackTrace);
                    }
                }
                if (ScanBranch.ProxyLogIDs.Count == 0 && !ScanBranch.PickFromProbeLog)
                {
                    ScanBranchErrorTB.Text         = "No Requests were Selected. Try Changing the Filter or Capture More Traffic With the Proxy";
                    ScanBranchStatsPanel.Visible   = false;
                    ScanBranchStartScanBtn.Enabled = true;
                    return;
                }
            }
            if (ScanBranch.PickFromProbeLog)
            {
                if (IronUI.UI.ProbeLogGrid.Rows.Count == 0 && !ScanBranch.PickFromProxyLog)
                {
                    ScanBranchErrorTB.Text         = "Probe Log is Empty. Crawl a website to populate the Probe Log";
                    ScanBranchStatsPanel.Visible   = false;
                    ScanBranchStartScanBtn.Enabled = true;
                    return;
                }
                foreach (DataGridViewRow Row in IronUI.UI.ProbeLogGrid.Rows)
                {
                    try
                    {
                        if (ScanBranch.CanScan(Row, "Probe"))
                        {
                            ScanBranch.ProbeLogIDs.Add((int)Row.Cells[0].Value);
                        }
                    }
                    catch (Exception Exp)
                    {
                        IronException.Report("ScanBranch Error reading ProbeLogGrid Message", Exp.Message, Exp.StackTrace);
                    }
                }
                if (ScanBranch.ProbeLogIDs.Count == 0 && !ScanBranch.PickFromProxyLog)
                {
                    ScanBranchErrorTB.Text         = "No Requests were Selected. Try Changing the Filter or Crawl more of the site.";
                    ScanBranchStatsPanel.Visible   = false;
                    ScanBranchStartScanBtn.Enabled = true;
                    return;
                }
            }
            if (ScanBranch.ProxyLogIDs.Count == 0 && ScanBranch.ProbeLogIDs.Count == 0)
            {
                ScanBranchErrorTB.Text         = "No Requests were Selected. Try Changing the Filter or make sure there are Requests in the Proxy/Probe Logs";
                ScanBranchStatsPanel.Visible   = false;
                ScanBranchStartScanBtn.Enabled = true;
                return;
            }
            ScanBranchProgressBar.Minimum = 0;
            ScanBranchProgressBar.Maximum = ScanBranch.ProxyLogIDs.Count + ScanBranch.ProbeLogIDs.Count;
            ScanBranchProgressBar.Step    = 1;
            ScanBranchProgressBar.Value   = 0;
            ScanBranchProgressLbl.Text    = ScanBranch.ProxyLogIDs.Count.ToString() + " Requests Selected";
            IronUI.UI.ASMainTabs.SelectTab(0);
            if (!IronUI.UI.main_tab.SelectedTab.Name.Equals("mt_auto"))
            {
                IronUI.UI.main_tab.SelectTab("mt_auto");
            }
            ScanBranch.Start();
        }
Пример #2
0
        private void FinalBtn_Click(object sender, EventArgs e)
        {
            FinalBtn.Enabled            = false;
            StepFourPreviousBtn.Enabled = false;

            ScanBranchErrorTB.Text = "";
            if (ScanBranchHostNameTB.Text.Trim().Length == 0)
            {
                ScanBranchErrorTB.Text      = "No HostName Specified";
                FinalBtn.Enabled            = true;
                StepFourPreviousBtn.Enabled = true;
                return;
            }
            if (ScanBranchUrlPatternTB.Text.Trim().Length == 0)
            {
                ScanBranchErrorTB.Text      = "No Url Pattern Specified";
                FinalBtn.Enabled            = true;
                StepFourPreviousBtn.Enabled = true;
                return;
            }
            if (!(ScanBranchPickProxyLogCB.Checked || ScanBranchPickProbeLogCB.Checked))
            {
                ScanBranchErrorTB.Text      = "Log source not selected. Select from Proxy Log/Probe Log";
                FinalBtn.Enabled            = true;
                StepFourPreviousBtn.Enabled = true;
                return;
            }

            ScanBranch.ProxyLogIDs.Clear();
            ScanBranch.ProbeLogIDs.Clear();
            UpdateScanBranchConfigFromUI();
            ScanBranchStatsPanel.Visible = true;
            ScanBranchProgressLbl.Text   = "Selecting requests based on filter";
            if (ScanBranch.PickFromProxyLog)
            {
                if (IronUI.UI.ProxyLogGrid.Rows.Count == 0 && !ScanBranch.PickFromProbeLog)
                {
                    ScanBranchErrorTB.Text       = "Proxy Log is Empty. Capture Some Traffic with the Proxy First";
                    ScanBranchStatsPanel.Visible = false;
                    FinalBtn.Enabled             = true;
                    StepFourPreviousBtn.Enabled  = true;
                    return;
                }
                foreach (DataGridViewRow Row in IronUI.UI.ProxyLogGrid.Rows)
                {
                    try
                    {
                        if (ScanBranch.CanScan(Row, "Proxy"))
                        {
                            ScanBranch.ProxyLogIDs.Add((int)Row.Cells[0].Value);
                        }
                    }
                    catch (Exception Exp)
                    {
                        IronException.Report("ScanBranch Error reading ProxyLogGrid Message", Exp.Message, Exp.StackTrace);
                    }
                }
                if (ScanBranch.ProxyLogIDs.Count == 0 && !ScanBranch.PickFromProbeLog)
                {
                    ScanBranchErrorTB.Text       = "No Requests were Selected. Try Changing the Filter or Capture More Traffic With the Proxy";
                    ScanBranchStatsPanel.Visible = false;
                    FinalBtn.Enabled             = true;
                    StepFourPreviousBtn.Enabled  = true;
                    return;
                }
            }
            if (ScanBranch.PickFromProbeLog)
            {
                if (IronUI.UI.ProbeLogGrid.Rows.Count == 0 && !ScanBranch.PickFromProxyLog)
                {
                    ScanBranchErrorTB.Text       = "Probe Log is Empty. Crawl a website to populate the Probe Log";
                    ScanBranchStatsPanel.Visible = false;
                    FinalBtn.Enabled             = true;
                    StepFourPreviousBtn.Enabled  = true;
                    return;
                }
                foreach (DataGridViewRow Row in IronUI.UI.ProbeLogGrid.Rows)
                {
                    try
                    {
                        if (ScanBranch.CanScan(Row, "Probe"))
                        {
                            ScanBranch.ProbeLogIDs.Add((int)Row.Cells[0].Value);
                        }
                    }
                    catch (Exception Exp)
                    {
                        IronException.Report("ScanBranch Error reading ProbeLogGrid Message", Exp.Message, Exp.StackTrace);
                    }
                }
                if (ScanBranch.ProbeLogIDs.Count == 0 && !ScanBranch.PickFromProxyLog)
                {
                    ScanBranchErrorTB.Text       = "No Requests were Selected. Try Changing the Filter or Crawl more of the site.";
                    ScanBranchStatsPanel.Visible = false;
                    FinalBtn.Enabled             = true;
                    StepFourPreviousBtn.Enabled  = true;
                    return;
                }
            }
            if (ScanBranch.ProxyLogIDs.Count == 0 && ScanBranch.ProbeLogIDs.Count == 0)
            {
                ScanBranchErrorTB.Text       = "No Requests were Selected. Try Changing the Filter or make sure there are Requests in the Proxy/Probe Logs";
                ScanBranchStatsPanel.Visible = false;
                FinalBtn.Enabled             = true;
                StepFourPreviousBtn.Enabled  = true;
                return;
            }
            ScanBranchProgressBar.Minimum = 0;
            ScanBranchProgressBar.Maximum = ScanBranch.ProxyLogIDs.Count + ScanBranch.ProbeLogIDs.Count;
            ScanBranchProgressBar.Step    = 1;
            ScanBranchProgressBar.Value   = 0;
            ScanBranchProgressLbl.Text    = ScanBranch.ProxyLogIDs.Count.ToString() + " Requests Selected";
            IronUI.UI.ASMainTabs.SelectTab(0);
            if (!IronUI.UI.main_tab.SelectedTab.Name.Equals("mt_auto"))
            {
                IronUI.UI.main_tab.SelectTab("mt_auto");
            }
            ScanBranch.Start();
        }