Exemple #1
0
        private void ConfigureScanStartScanBtn_Click(object sender, EventArgs e)
        {
            ScanManager.Stop(true);
            ScanManager.PrimaryHost = ConfigureScanHostNameTB.Text;
            ScanManager.BaseUrl     = ConfigureScanBaseUrlTB.Text;
            ScanManager.StartingUrl = ConfigureScanStartingUrlTB.Text;
            ScanManager.Mode        = ScanMode.UserConfigured;
            ScanManager.PerformDirAndFileGuessing = ConfigureScanDirAndFileGuessingCB.Checked;
            ScanManager.HTTP              = ConfigureScanHTTPCB.Checked;
            ScanManager.HTTPS             = ConfigureScanHTTPSCB.Checked;
            ScanManager.HostsToInclude    = new List <string>(ConfigureScanHostsToIncludeTB.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries));
            ScanManager.UrlsToAvoid       = new List <string>(ConfigureScanUrlToAvoidTB.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries));
            ScanManager.IncludeSubDomains = ConfigureScanIncludeSubDomainsCB.Checked;
            ScanManager.CrawlAndScan      = ConfigureScanCrawlAndScanRB.Checked;
            if (IronUI.CSF.ConfigureScanSessionPluginsCombo.Text.Length > 0)
            {
                if (SessionPlugin.List().Contains(IronUI.CSF.ConfigureScanSessionPluginsCombo.Text))
                {
                    ScanManager.SessionHandler = SessionPlugin.Get(IronUI.CSF.ConfigureScanSessionPluginsCombo.Text);
                }
                else
                {
                    IronUI.ShowConfiguredScanMessage("Non-existent Session Plugin Selected", true);
                    return;
                }
            }
            string Message = CheckInput();

            if (Message.Length > 0)
            {
                IronUI.ShowConfiguredScanMessage(Message, true);
                return;
            }
            ScanManager.StartScan();
            IronUI.CSF.Close();
            IronUI.UpdateConsoleControlsStatus(true);
        }
        void StartScan()
        {
            ScanManager.Stop(true);
            ScanManager.PrimaryHost = BaseRequest.Host;
            ScanManager.BaseUrl     = BaseUrlTB.Text;
            ScanManager.StartingUrl = StartingUrlTB.Text;
            ScanManager.Mode        = ScanMode.UserConfigured;
            ScanManager.PerformDirAndFileGuessing = ConfigureScanDirAndFileGuessingCB.Checked;
            ScanManager.CanPromptUser             = PromptUserCB.Checked;

            Crawler.MaxCrawlThreads = ConfigCrawlerThreadMaxCountTB.Value;
            Crawler.UserAgent       = ConfigCrawlerUserAgentTB.Text;

            if (UseSpecialHeaderCB.Checked)
            {
                ScanManager.SpecialHeader = new string[] { SpecialHeaderNameTB.Text, SpecialHeaderValueTB.Text };
            }

            if (BaseRequest.SSL)
            {
                ScanManager.HTTPS = true;
                if (CrossProtoYesRB.Checked)
                {
                    ScanManager.HTTP = true;
                }
            }
            else
            {
                ScanManager.HTTP = true;
                if (CrossProtoYesRB.Checked)
                {
                    ScanManager.HTTPS = true;
                }
            }
            ScanManager.Checks.Clear();
            foreach (DataGridViewRow Row in ScanPluginsGrid.Rows)
            {
                if ((bool)Row.Cells[0].Value)
                {
                    ScanManager.Checks.Add(Row.Cells[1].Value.ToString());
                }
            }

            ScanManager.InjectUrlPathParts = InjectUrlPathPartsCB.Checked;
            ScanManager.InjectQuery        = InjectQueryCB.Checked;
            ScanManager.InjectBody         = InjectBodyCB.Checked;
            ScanManager.InjectCookie       = InjectCookieCB.Checked;
            ScanManager.InjectHeaders      = InjectHeadersCB.Checked;

            if (InjectNamesCB.Checked)
            {
                ScanManager.InjectQueryName  = InjectUrlPathPartsCB.Checked;
                ScanManager.InjectBodyName   = InjectBodyCB.Checked;
                ScanManager.InjectCookieName = InjectCookieCB.Checked;
                ScanManager.InjectHeaderName = InjectHeadersCB.Checked;
            }
            else
            {
                ScanManager.InjectQueryName  = false;
                ScanManager.InjectBodyName   = false;
                ScanManager.InjectCookieName = false;
                ScanManager.InjectHeaderName = false;
            }

            ScanManager.QueryWhiteList.Clear();
            ScanManager.QueryBlackList.Clear();

            ScanManager.BodyWhiteList.Clear();
            ScanManager.BodyBlackList.Clear();

            ScanManager.CookieWhiteList.Clear();
            ScanManager.CookieBlackList.Clear();

            ScanManager.HeaderWhiteList.Clear();
            ScanManager.HeaderBlackList.Clear();

            if (QueryParametersFilterCB.Checked)
            {
                if (QueryParametersPlusRB.Checked)
                {
                    foreach (string Name in QueryParametersPlusTB.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        ScanManager.QueryWhiteList.Add(Name.Trim());
                    }
                }
                else
                {
                    foreach (string Name in QueryParametersMinusTB.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        ScanManager.QueryBlackList.Add(Name.Trim());
                    }
                }
            }

            if (BodyParametersFilterCB.Checked)
            {
                if (BodyParametersPlusRB.Checked)
                {
                    foreach (string Name in BodyParametersPlusTB.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        ScanManager.BodyWhiteList.Add(Name.Trim());
                    }
                }
                else
                {
                    foreach (string Name in BodyParametersMinusTB.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        ScanManager.BodyBlackList.Add(Name.Trim());
                    }
                }
            }

            if (CookieParametersFilterCB.Checked)
            {
                if (CookieParametersPlusRB.Checked)
                {
                    foreach (string Name in CookieParametersPlusTB.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        ScanManager.CookieWhiteList.Add(Name.Trim());
                    }
                }
                else
                {
                    foreach (string Name in CookieParametersMinusTB.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        ScanManager.CookieBlackList.Add(Name.Trim());
                    }
                }
            }

            if (HeadersParametersFilterCB.Checked)
            {
                if (HeadersParametersPlusRB.Checked)
                {
                    foreach (string Name in HeadersParametersPlusTB.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        ScanManager.HeaderWhiteList.Add(Name.Trim());
                    }
                }
                else
                {
                    foreach (string Name in HeadersParametersMinusTB.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        ScanManager.HeaderBlackList.Add(Name.Trim());
                    }
                }
            }

            //ScanManager.HostsToInclude = new List<string>(HostsToIncludeTB.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries));
            ScanManager.UrlsToAvoid       = new List <string>(ConfigureScanUrlToAvoidTB.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries));
            ScanManager.IncludeSubDomains = SubdomainYesRB.Checked;
            ScanManager.CrawlAndScan      = CrawlAndScanRB.Checked;

            ScanManager.StartScan();
            IronUI.UpdateConsoleControlsStatus(true);

            IronUI.SSW.CloseWindow();
        }