Пример #1
0
        public static void RefreshIESettings(string strProxy)
        {
            WCRSetting.Struct_INTERNET_PROXY_INFO t_internet_proxy_info;
            if (string.IsNullOrEmpty(strProxy))
            {
                t_internet_proxy_info.dwAccessType = 1;
            }
            else
            {
                t_internet_proxy_info.dwAccessType = 3;
            }
            t_internet_proxy_info.proxy       = Marshal.StringToHGlobalAnsi(strProxy);
            t_internet_proxy_info.proxyBypass = Marshal.StringToHGlobalAnsi("local");
            IntPtr ptr = Marshal.AllocCoTaskMem(Marshal.SizeOf(t_internet_proxy_info));

            Marshal.StructureToPtr(t_internet_proxy_info, ptr, true);
            WCRSetting.InternetSetOption(IntPtr.Zero, 38, ptr, Marshal.SizeOf(t_internet_proxy_info));
        }
Пример #2
0
 private void ButtonSaveSetting_Click(object sender, EventArgs e)
 {
     try
     {
         WCRSetting.UseProxy                    = this.chkUseProxy.Checked;
         WebCruiserWVS.Default.UseProxy         = WCRSetting.UseProxy;
         WCRSetting.ProxyAddress                = this.txtProxyAddr.Text;
         WebCruiserWVS.Default.ProxyAddress     = WCRSetting.ProxyAddress;
         WCRSetting.ProxyPort                   = int.Parse(this.txtProxyPort.Text);
         WebCruiserWVS.Default.ProxyPort        = WCRSetting.ProxyPort;
         WCRSetting.ProxyUsername               = this.txtProxyUsername.Text;
         WebCruiserWVS.Default.ProxyUsername    = WCRSetting.ProxyUsername;
         WCRSetting.ProxyPassword               = this.txtProxyPassword.Text;
         WebCruiserWVS.Default.ProxyPassword    = WCRSetting.ProxyPassword;
         WCRSetting.chkReplace1                 = this.chkReplace1.Checked;
         WebCruiserWVS.Default.chkReplace1      = WCRSetting.chkReplace1;
         WCRSetting.FiltExpr1                   = this.txtFiltExpr1.Text;
         WebCruiserWVS.Default.FiltExpr1        = WCRSetting.FiltExpr1;
         WCRSetting.RepExpr1                    = this.txtRepExpr1.Text;
         WebCruiserWVS.Default.RepExpr1         = WCRSetting.RepExpr1;
         WCRSetting.chkReplace2                 = this.chkReplace2.Checked;
         WebCruiserWVS.Default.chkReplace2      = WCRSetting.chkReplace2;
         WCRSetting.FiltExpr2                   = this.txtFiltExpr2.Text;
         WebCruiserWVS.Default.FiltExpr2        = WCRSetting.FiltExpr2;
         WCRSetting.RepExpr2                    = this.txtRepExpr2.Text;
         WebCruiserWVS.Default.RepExpr2         = WCRSetting.RepExpr2;
         WCRSetting.chkReplace3                 = this.chkReplace3.Checked;
         WebCruiserWVS.Default.chkReplace3      = WCRSetting.chkReplace3;
         WCRSetting.FiltExpr3                   = this.txtFiltExpr3.Text;
         WebCruiserWVS.Default.FiltExpr3        = WCRSetting.FiltExpr3;
         WCRSetting.RepExpr3                    = this.txtRepExpr3.Text;
         WebCruiserWVS.Default.RepExpr3         = WCRSetting.RepExpr3;
         WCRSetting.UserAgent                   = this.txtUserAgent.Text;
         WebCruiserWVS.Default.UserAgent        = WCRSetting.UserAgent;
         WCRSetting.MaxHTTPThreadNum            = int.Parse(this.txtMaxThread.Text);
         WebCruiserWVS.Default.MaxHTTPThread    = WCRSetting.MaxHTTPThreadNum;
         WCRSetting.SecondsDelay                = int.Parse(this.txtDelay.Text);
         WebCruiserWVS.Default.SecondsDelay     = WCRSetting.SecondsDelay;
         WCRSetting.ScanDepth                   = int.Parse(this.txtScanDepth.Text);
         WebCruiserWVS.Default.ScanDepth        = WCRSetting.ScanDepth;
         WCRSetting.CrawlableExt                = this.txtCrawlableExt.Text;
         WCRSetting.CrawlableExt                = WCRSetting.CrawlableExt.Replace(" ", "").Trim();
         WebCruiserWVS.Default.CrawlableExt     = WCRSetting.CrawlableExt;
         WCRSetting.MultiSitesNum               = int.Parse(this.txtMultiSitesNum.Text);
         WebCruiserWVS.Default.MultiSitesNum    = WCRSetting.MultiSitesNum;
         WCRSetting.ScanSQLInjection            = this.CheckBoxSQLInjection.Checked;
         WebCruiserWVS.Default.ScanSQLInjection = WCRSetting.ScanSQLInjection;
         if (WCRSetting.ScanSQLInjection)
         {
             WCRSetting.ScanURLSQL               = this.CheckBoxScanURLSQL.Checked;
             WebCruiserWVS.Default.ScanURLSQL    = WCRSetting.ScanURLSQL;
             WCRSetting.ScanPostSQL              = this.CheckBoxScanPostSQL.Checked;
             WebCruiserWVS.Default.ScanPostSQL   = WCRSetting.ScanPostSQL;
             WCRSetting.ScanCookieSQL            = this.CheckBoxScanCookieSQL.Checked;
             WebCruiserWVS.Default.ScanCookieSQL = WCRSetting.ScanCookieSQL;
         }
         else
         {
             WCRSetting.ScanURLSQL               = false;
             WebCruiserWVS.Default.ScanURLSQL    = false;
             WCRSetting.ScanPostSQL              = false;
             WebCruiserWVS.Default.ScanPostSQL   = false;
             WCRSetting.ScanCookieSQL            = false;
             WebCruiserWVS.Default.ScanCookieSQL = false;
         }
         WCRSetting.ScanXSS                       = this.CheckBoxXSS.Checked;
         WebCruiserWVS.Default.ScanXSS            = WCRSetting.ScanXSS;
         WCRSetting.ScanXPathInjection            = this.CheckBoxXPath.Checked;
         WebCruiserWVS.Default.ScanXPathInjection = WCRSetting.ScanXPathInjection;
         string str = this.txtAccessTables.Text.Trim().Replace("\r\n", ":").Replace(" ", "");
         WebCruiserWVS.Default.AccessTables = str;
         string str2 = this.txtAccessColumns.Text.Trim().Replace("\r\n", ":").Replace(" ", "");
         WebCruiserWVS.Default.AccessColumns = str2;
         string str3 = this.txtAdminPath.Text.Trim().Replace("\r\n", ":").Replace(" ", "");
         WebCruiserWVS.Default.AdminPath = str3;
         string str4 = this.txtAdminPage.Text.Trim().Replace("\r\n", ":").Replace(" ", "");
         WebCruiserWVS.Default.AdminPage = str4;
         string str5 = this.txtXSInjURL.Text.Trim();
         WCRSetting.CrossSiteURL            = str5;
         WebCruiserWVS.Default.CrossSiteURL = str5;
         string str6 = this.txtXSRecord.Text.Trim();
         WCRSetting.CrossSiteRecord            = str6;
         WebCruiserWVS.Default.CrossSiteRecord = str6;
         WebCruiserWVS.Default.Save();
         if (WCRSetting.UseProxy)
         {
             WCRSetting.RefreshIESettings(WCRSetting.ProxyAddress + ":" + WCRSetting.ProxyPort.ToString());
         }
         else
         {
             WCRSetting.RefreshIESettings("");
         }
         MessageBox.Show("Save/Apply OK!", "Done", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
     catch (Exception exception)
     {
         MessageBox.Show("Please Check your Input!\r\n" + exception.ToString());
     }
 }