Exemple #1
0
        public MainForm()
        {
            InitializeComponent();
            StatusText.Text = STATUS_IDEAL;
            int maxChecks = (int)ThreadsAmount.Maximum;

            proxyCheckThreads = new Thread[maxChecks];
            proxyCheckObjects = new ProxyChecker[maxChecks];
            for (int i = 0; i < maxChecks; i++)
            {
                proxyCheckObjects[i] = new ProxyChecker();
                proxyCheckObjects[i].HTTPCheckResult = new Action <ProxyCheckResult>(this.OnProxyResult);
            }
            checkingProxies = false;
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.WriteLine(DateTime.Now.ToString());

            using (var proxyChecker = new ProxyChecker())
            {
                var task = proxyChecker.StartCheck();

                HidemynaParser.Action <ProxyInfo> action = proxyChecker.AddProxy;

                HidemynaParser hidemynaParser = new HidemynaParser(action);
                var            count          = hidemynaParser.DoParse();

                //Console.WriteLine($"parsing: {count}");

                Task.WaitAll(task);
            }

            /*Regex regex = new Regex(@"\[\s*([0-9]+)\s*\]");
             * string[] checks = new[] {"[1234]", "[ 1234]", "[ 1234 ]","[ 1234   ]", "[ s1234 ]" };
             *
             * foreach (var check in checks)
             * {
             *      Console.WriteLine(ClearAfterTranslate(check));
             *
             * }
             * string[] checks2 = new[] { "[/1234]", "[ / 1234]", "[   /     1234 ]", "[ /1234   ]", "[ /s1234 ]", "[/      1234            ]" };
             * Regex regex2 = new Regex(@"\[\s*\/\s*([0-9]+)\s*\]");
             * Console.WriteLine("================");
             * foreach (var check in checks2)
             * {
             *  Console.WriteLine(ClearAfterTranslate(check));
             * /*                if (regex2.IsMatch(check))
             *  {
             *      Console.WriteLine("OK");
             *      var s = regex2.Replace(check, "[/$1]");
             *      Console.WriteLine(s);
             *  }
             *  else
             *      Console.WriteLine("Failed");
             *
             * }*/
        }
 public ActionResult <string> ProxyCheck(string host, string port)
 {
     try
     {
         ProxyChecker proxyChecker = new ProxyChecker(host, port);
         return(proxyChecker.Check());
     }
     catch (Exception e)
     {
         if (e.InnerException != null)
         {
             FileHelper.WriteToLog(e.Message + " " + e.InnerException.Message, "");
         }
         else
         {
             FileHelper.WriteToLog(e.Message, "");
         }
     }
     return("Proxy is not available!");
 }
Exemple #4
0
        public void ThreadPoolCheckProxies(object parameters)
        {
            try
            {
                Array paramsArray = new object[2];

                paramsArray = (Array)parameters;

                DataRow dr = (DataRow)paramsArray.GetValue(0);

                clsDBQueryManager db = new clsDBQueryManager();

                string proxyAddress = dr[0].ToString();
                string proxyPort = dr[1].ToString();
                string proxyUsername = string.Empty;
                string proxyPassword = string.Empty;
                int IsPublic = 0;
                int Working = 0;

                ProxyChecker pc = new ProxyChecker(proxyAddress, proxyPort, proxyUsername, proxyPassword, 0);
                bool RunningProxy = pc.CheckProxy();

                if (!RunningProxy)
                {
                    DataBaseHandler Db = new DataBaseHandler();
                    DataBaseHandler.DeleteQuery("DELETE FROM tb_Proxies WHERE ProxyAddress ='" + proxyAddress + "' AND ProxyPort ='" + proxyPort + "'", "tb_Proxies");
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ThreadPoolCheckProxies()  --> " + ex.Message, Globals.Path_ProxySettingErroLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ThreadPoolCheckProxies() --> " + ex.Message, Globals.Path_TwtErrorLogs);
            }
        }
Exemple #5
0
        /// <summary>
        /// Thread pool Private Proxies
        /// </summary>
        /// <param name="objProxy"></param>
        private void ThreadPoolMethod_PvtProxies(object objProxy)
        {
            try
            {
                LstAssignPrivateProxy.Add(Thread.CurrentThread);
                LstAssignPrivateProxy = LstAssignPrivateProxy.Distinct().ToList();
                Thread.CurrentThread.IsBackground = true;

                countParsePvtProxiesThreads++;

                string item = (string)objProxy;
                int IsPublic = 1;
                int Working = 0;
                string LoggedInIp = string.Empty;

                string proxyAddress = string.Empty;
                string proxyPort = string.Empty;
                string proxyUserName = string.Empty;
                string proxyPassword = string.Empty;

                string account = item;

                int DataCount = account.Split(':').Length;

                if (DataCount == 4)
                {
                    proxyAddress = account.Split(':')[0];
                    proxyPort = account.Split(':')[1];
                    proxyUserName = account.Split(':')[2];
                    proxyPassword = account.Split(':')[3];
                    //AddToProxysLogs(account);
                }
                else
                {
                    AddToProxysLogs("[ " + DateTime.Now + " ] => [ Proxy Not In correct Format ]");
                    return;
                }

                try
                {
                    dictionary_Threads.Add("proxy_" + proxyAddress, Thread.CurrentThread);
                }
                catch { };

                ProxyChecker proxyChecker = new ProxyChecker(proxyAddress, proxyPort, proxyUserName, proxyPassword, IsPublic);
                if (proxyChecker.CheckPvtProxy())
                {
                    workingproxiesCount++;
                    lock (proxyListLockr)
                    {
                        queWorkingPvtProxies.Enqueue(item);
                        Monitor.Pulse(proxyListLockr);
                    }
                    AddToProxysLogs("[ " + DateTime.Now + " ] => [ Added " + item + " to working proxies list ]");

                    lock (LstRunningPvtProxy_ProxyModule)
                    {
                        LstRunningPvtProxy_ProxyModule.Add(item);
                    }
                }
                else
                {
                    AddToProxysLogs("[ " + DateTime.Now + " ] => [ Non Working Proxy: " + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword + " ]");
                    GlobusFileHelper.AppendStringToTextfileNewLine(item, Globals.Path_Non_ExistingProxies);
                }
            }
            catch (Exception ex)
            {

            }
            finally
            {
                lock (pvtProxiesThreadLockr)
                {
                    countParsePvtProxiesThreads--;
                    Monitor.Pulse(pvtProxiesThreadLockr);
                }

                threadcountForFinishMsgPvt--;

                if (countParsePvtProxiesThreads == 0)
                {
                    AddToProxysLogs("[ " + DateTime.Now + " ] => [ Process of Proxy testing is finished. ]");
                    AddToProxysLogs("-----------------------------------------------------------------------------------------------------------------------");
                }
            }
        }
Exemple #6
0
        private void ThreadPoolMethod_Proxies(object objProxy)
        {
            try
            {
                LstPublicProxy.Add(Thread.CurrentThread);
                LstPublicProxy = LstPublicProxy.Distinct().ToList();
                Thread.CurrentThread.IsBackground = true;

                Interlocked.Increment(ref countParseProxiesThreads);
                //countParseProxiesThreads++;

                string item = (string)objProxy;
                int IsPublic = 0;
                int Working = 0;
                string LoggedInIp = string.Empty;

                string proxyAddress = string.Empty;
                string proxyPort = string.Empty;
                string proxyUserName = string.Empty;
                string proxyPassword = string.Empty;

                string account = item;

                int DataCount = account.Split(':').Length;

                if (DataCount == 1)
                {
                    proxyAddress = account.Split(':')[0];
                    AddToProxysLogs("[ " + DateTime.Now + " ] => [ Proxy Not In correct Format ]");
                    AddToProxysLogs("[ " + DateTime.Now + " ] => [ " + account + " ]");
                    return;
                }
                if (DataCount == 2)
                {
                    proxyAddress = account.Split(':')[0];
                    proxyPort = account.Split(':')[1];
                }
                else if (DataCount > 2)
                {
                    proxyAddress = account.Split(':')[0];
                    proxyPort = account.Split(':')[1];
                    proxyUserName = account.Split(':')[2];
                    proxyPassword = account.Split(':')[3];
                    //AddToProxysLogs("Proxy Not In correct Format");
                    AddToProxysLogs("[ " + DateTime.Now + " ] => [ " + account + " ]");
                    return;
                }

                try
                {
                    dictionary_Threads.Add("proxy_" + proxyAddress, Thread.CurrentThread);
                }
                catch { };

                ProxyChecker proxyChecker = new ProxyChecker(proxyAddress, proxyPort, proxyUserName, proxyPassword, IsPublic);
                if (proxyChecker.CheckProxy())
                {
                    //lock (((System.Collections.ICollection)listWorkingProxies).SyncRoot)
                    {
                        //if (!listWorkingProxies.Contains(proxy))
                        {
                            workingproxiesCount++;
                            //listWorkingProxies.Add(proxy);
                            lock (proxyListLockr)
                            {
                                queWorkingProxies.Enqueue(item);
                                Monitor.Pulse(proxyListLockr);
                            }
                            AddToProxysLogs("[ " + DateTime.Now + " ] => [ Added " + item + " to working proxies list ]");

                            lock (Locker_LstRunningProxy_ProxyModule)
                            {
                                LstRunningProxy_ProxyModule.Add(item);
                            }

                            Globals.EnquequeWorkingProxiesForSignUp(item);

                            //Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(item, Globals.FilePathWorkingProxies);
                        }
                    }
                }
                else
                {
                    AddToProxysLogs("[ " + DateTime.Now + " ] => [ Non Working Proxy: " + proxyAddress + ":" + proxyPort + " ]");
                    GlobusFileHelper.AppendStringToTextfileNewLine(item, Globals.Path_Non_ExistingProxies);
                }

                #region Commented code
                //string pageSource = string.Empty;
                //try
                //{
                //    GlobusHttpHelper httpHelper = new GlobusHttpHelper();
                //    pageSource = httpHelper.getHtmlfromUrlProxy(new Uri("https://twitter.com/"), "", proxyAddress, proxyPort, proxyUserName, proxyPassword);
                //}
                //catch (Exception ex)
                //{
                //    GlobusFileHelper.AppendStringToTextfileNewLine(item, Globals.Path_Non_ExsistingProxies);
                //}
                //if (pageSource.Contains("class=\"signin\"") && pageSource.Contains("class=\"signup\"") && pageSource.Contains("Twitter"))
                //{
                //    using (SQLiteConnection con = new SQLiteConnection(DataBaseHandler.CONstr))
                //    {
                //        //using (SQLiteDataAdapter ad = new SQLiteDataAdapter("SELECT * FROM tb_FBAccount WHERE ProxyAddress = '" + proxyAddress + "'", con))
                //        using (SQLiteDataAdapter ad = new SQLiteDataAdapter())
                //        {
                //            if (DataCount >= 2)
                //            {
                //                //0 is true
                //                IsPublic = 0;
                //            }
                //            else
                //            {
                //                //1 is false
                //                IsPublic = 1;
                //            }
                //            Working = 1;
                //            string InsertQuery = "Insert into tb_Proxies values('" + proxyAddress + "','" + proxyPort + "','" + proxyUserName + "','" + proxyPassword + "', " + Working + "," + IsPublic + " , '" + LoggedInIp + "')";
                //            DataBaseHandler.InsertQuery(InsertQuery, "tb_Proxies");
                //        }
                //    }
                //    ValidPublicProxies.Add(item);
                //}

                #endregion
            }
            catch (Exception ex)
            {
                //AddToProxysLogs(ex.Message);
            }
            finally
            {
                lock (proxiesThreadLockr)
                {
                    //countParseProxiesThreads--;
                    Interlocked.Decrement(ref countParseProxiesThreads);
                    Monitor.Pulse(proxiesThreadLockr);
                }

                threadcountForFinishMSG--;

                if (threadcountForFinishMSG == 0)
                {

                    AddToProxysLogs("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]");
                    AddToProxysLogs("-----------------------------------------------------------------------------------------------------------------------");
                }

            }
        }
Exemple #7
0
        private void CheckAndFillProxyInQueue()
        {
            try
            {
                string proxyAddress = string.Empty;
                string proxyPort = string.Empty;
                string proxyUsername = string.Empty;
                string proxyPassword = string.Empty;

                int isPublic = 0;

                if (frmMain_NewUI.LstRunningProxy_ProxyModule.Count > 0)
                {
                    List<string> lstTemp = frmMain_NewUI.LstRunningProxy_ProxyModule.Distinct().ToList();

                    AddToMobileLogs("[ " + DateTime.Now + " ] => [ " + lstTemp.Count + " Proxy Loaded ! ]");

                    foreach (string item in lstTemp)
                    {
                        try
                        {
                            proxyAddress = item.Split(':')[0];
                            proxyPort = item.Split(':')[1];
                            proxyUsername = item.Split(':')[2];
                            proxyPassword = item.Split(':')[3];

                            ProxyChecker obj_ProxyChecker = new ProxyChecker(proxyAddress, proxyPort, proxyUsername, proxyPassword, isPublic);

                            if (obj_ProxyChecker.CheckProxy())
                            {
                                qRunningProxy_Mobile.Enqueue(item);
                            }

                            lock (frmMain_NewUI.Locker_LstRunningProxy_ProxyModule)
                            {
                                frmMain_NewUI.LstRunningProxy_ProxyModule.Remove(item);
                            }

                            AddToMobileLogs("[ " + DateTime.Now + " ] => [ Not Running Proxy >>> " + item + " ]");
                        }
                        catch
                        {
                        }
                    }
                }
                else
                {
                    AddToMobileLogs("[ " + DateTime.Now + " ] => [ There Is No Running Proxy. So Please Upload The New Proxy And Start Process Aggain ! ]");
                    // return;
                }
            }
            catch
            {
            }
        }