Example #1
0
        private void ParseProxies(string[] Urls)
        {
            foreach (string s in Urls)
            {
                if (!mIsRun)
                {
                    break;
                }

                string html = "";
                double t;

                if (Web_Client.Get(html_parser.ClearUrl(s), "", out html, out t, mTimeOut))
                {
                    string[] proxies = html_parser.Matches(html, @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{2,5}");
                    if (proxies.Length > 0)
                    {
                        foreach (string p in proxies)
                        {
                            if (p != "")
                            {
                                if (!mPrxsDic.ContainsKey(p))
                                {
                                    Proxy newProxy = new Proxy();
                                    newProxy.adress  = p;
                                    newProxy.latency = -1;
                                    Add(newProxy);
                                }
                            }
                        }
                    }
                }
            }
        }
Example #2
0
 private void Test()
 {
     for (int i = 0; i < mArray.Length && mIsRun; i++)
     {
         string html;
         double t;
         if (Web_Client.Get(mTarget.mAdress, mArray[i].adress, out html, out t, mTimeOut))
         {
             FillProperties(mArray[i], html, t, "http");
         }
         else if (Web_Client.GetViaSocks(true, mTarget.mAdress, mArray[i].adress, out html, out t, mTimeOut))
         {
             FillProperties(mArray[i], html, t, "socks5");
         }
         else if (Web_Client.GetViaSocks(false, mTarget.mAdress, mArray[i].adress, out html, out t, mTimeOut))
         {
             FillProperties(mArray[i], html, t, "socks4");
         }
         else
         {
             lock (mPrxsDic)
             {
                 mPrxsDic.Remove(mArray[i].adress);
                 mPrxsLstUpdated(this, EventArgs.Empty);
             }
         }
     }
     mIsRun = false;
     mTstDead(this, EventArgs.Empty);
 }
Example #3
0
        /// <summary>
        /// Search proxies and then parse them
        /// </summary>
        /// <param name="Prm">Id of thread</param>
        private void ProxyToAssemble()
        {
            StringBuilder txtQuery = new StringBuilder();

            txtQuery.Append(mSearcher.url);
            txtQuery.Append("&");
            txtQuery.Append(mSearcher.srchVar);
            txtQuery.Append("=");
            txtQuery.Append(mSearchPhrase.Replace(" ", mSearcher.spltr));
            txtQuery.Append("&");
            txtQuery.Append(mSearcher.pageVar);
            txtQuery.Append("=");

            while (mPrxsDic.Count < mPrxsCountNeed && mIsRun)
            {
                string html = "";
                string uri  = txtQuery.ToString() + mSender.GetNewPageNumber(mSearcher).ToString();
                double t;
                if (Web_Client.Get(uri, mProxy, out html, out t, mTimeOut))
                {
                    if (html.ToLower().Contains("captcha"))
                    {
                        StopLoading();
                    }
                    ParseProxies(html_parser.Matches(html, mSearcher.regexExpOfResults));
                }

                Thread.Sleep(200);
            }
            mIsRun = false;
            mKilled(this, EventArgs.Empty);
        }