Exemple #1
0
        private void bckWorkerGetLinks_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                __RunningWorker = true;
                using (HTTP hTTP = new HTTP(__ScannerConf_.TimeOut, false))
                {
                    HTTP              arg_4A_0 = hTTP;
                    string            arg_4A_1 = __ScannerConf_.Url;
                    enHTTPMethod      arg_4A_2 = __ScannerConf_.Method;
                    string            text     = "";
                    object            arg_4A_4 = null;
                    NetworkCredential arg_4A_5 = null;
                    bool              arg_4A_6 = false;
                    string            text2    = "";
                    string            hTML     = arg_4A_0.GetHTML(arg_4A_1, arg_4A_2, ref text, arg_4A_4, arg_4A_5, arg_4A_6, ref text2);

                    if (!string.IsNullOrEmpty(hTML))
                    {
                        new List <ListViewItem>();
                        using (RegExp regExp = new RegExp())
                        {
                            try
                            {
                                IEnumerator enumerator = regExp.GetLinks(__ScannerConf_.Url, hTML, __ScannerConf_.RegExp).Values.GetEnumerator();
                                while (enumerator.MoveNext())
                                {
                                    Link link = (Link)enumerator.Current;
                                    if (string.IsNullOrEmpty(__ScannerConf_.Domain) || !Globals.G_Utilities.IsUrlValid(link.Url) || Strings.InStr(link.Url, __ScannerConf_.Domain, CompareMethod.Binary) != 0)
                                    {
                                        AddURL(link.Url, new string[0]);
                                    }
                                }
                            }
                            finally
                            {
                                IEnumerator enumerator = null;
                                if (enumerator is IDisposable)
                                {
                                    (enumerator as IDisposable).Dispose();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception expr_11F)
            {
                ProjectData.SetProjectError(expr_11F);
                Exception ex = expr_11F;
                MessageBox.Show(ex.Message, "Please report this bug!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                ProjectData.ClearProjectError();
            }
            finally
            {
            }
        }
Exemple #2
0
    public bool TestOK(WebProxy oProxy, ref string sServer, ref string sCode)
    {
        string value = "";
        string text  = "";

        try
        {
            if (oProxy != null)
            {
                this.__Enable = true;
                using (HTTP hTTP = new HTTP(5000, false))
                {
                    HTTP         arg_3A_0 = hTTP;
                    string       arg_3A_1 = "http://www.google.com/";
                    enHTTPMethod arg_3A_2 = enHTTPMethod.GET;
                    string       text2    = "";
                    value = arg_3A_0.GetHTML(arg_3A_1, arg_3A_2, ref text2, null, null, false, ref text);
                    if (hTTP.WebResponse != null && hTTP.WebResponse.HTTPResponse != null)
                    {
                        sServer = hTTP.WebResponse.HTTPResponse.Server;
                        sCode   = Conversions.ToString((int)hTTP.WebResponse.HTTPResponse.StatusCode) + " - " + hTTP.WebResponse.HTTPResponse.StatusDescription;
                    }
                }
                this.__Enable = false;
                if (!string.IsNullOrEmpty(text))
                {
                    MessageBox.Show(text, "Proxy Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
        catch (WebException expr_C4)
        {
            ProjectData.SetProjectError(expr_C4);
            WebException ex = expr_C4;
            throw ex;
        }
        return(!string.IsNullOrEmpty(value));
    }