Exemplo n.º 1
0
        private void ScanBranchWizard_FormClosing(object sender, FormClosingEventArgs e)
        {
            ScanBranch.Abort();

            /*
             * if (IronUI.UI.CanShutdown) return;
             * if (!CanClose)
             * {
             *  if (this.CurrentStep == 0)
             *  {
             *      this.CanClose = true;
             *  }
             *  else if (this.CurrentStep == 4)
             *  {
             *      e.Cancel = true;
             *      if (StepFourPreviousBtn.Enabled)
             *      {
             *          MessageBox.Show("This window can only be closed from the first step.\r\nUse the '<- Previous Step' button on the bottom left corner to go to the first step and then press the 'Cancel' button on the bottom left corner.");
             *      }
             *      else
             *      {
             *          MessageBox.Show("This window cannot be closed by the user now.\r\nAfter all scan jobs are created the window will automatically close.");
             *      }
             *  }
             *  else
             *  {
             *      e.Cancel = true;
             *      MessageBox.Show("This window can only be closed from the first step.\r\nUse the '<- Previous Step' button on the bottom left corner to go to the first step and then press the 'Cancel' button on the bottom left corner.");
             *  }
             * }
             */
        }
Exemplo n.º 2
0
        private void FinalBtn_Click(object sender, EventArgs e)
        {
            if (FinalBtn.Text.Equals("Start Scan"))
            {
                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";
                FinalBtn.Text    = "Cancel";
                FinalBtn.Enabled = true;

                /*
                 * 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");
                }
                this.Activate();
                ScanBranch.Start();
            }
            else
            {
                ScanBranch.Abort();
                this.Close();
            }
        }