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 IPAddress = dr[0].ToString(); string IPPort = dr[1].ToString(); string IPUsername = string.Empty; string IPpassword = string.Empty; int IsPublic = 0; int Working = 0; IPChecker pc = new IPChecker(IPAddress, IPPort, IPUsername, IPpassword, 0); bool RunningIP = pc.CheckIP(); if (!RunningIP) { DataBaseHandler Db = new DataBaseHandler(); DataBaseHandler.DeleteQuery("DELETE FROM tb_IP WHERE IPAddress ='" + IPAddress + "' AND IPPort ='" + IPPort + "'", "tb_IP"); } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ThreadPoolCheckProxies() --> " + ex.Message, Globals.Path_IPSettingErroLog); GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ThreadPoolCheckProxies() --> " + ex.Message, Globals.Path_TwtErrorLogs); } }
/// <summary> /// Thread pool Private Proxies /// </summary> /// <param name="objIP"></param> private void ThreadPoolMethod_PvtProxies(object objIP) { try { LstAssignPrivateIP.Add(Thread.CurrentThread); LstAssignPrivateIP = LstAssignPrivateIP.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; countParsePvtProxiesThreads++; string item = (string)objIP; int IsPublic = 1; int Working = 0; string LoggedInIp = string.Empty; string IPAddress = string.Empty; string IPPort = string.Empty; string IPUsername = string.Empty; string IPpassword = string.Empty; string account = item; int DataCount = account.Split(':').Length; if (DataCount == 4) { IPAddress = account.Split(':')[0]; IPPort = account.Split(':')[1]; IPUsername = account.Split(':')[2]; IPpassword = account.Split(':')[3]; //AddToIPsLogs(account); } else { AddToIPsLogs("[ " + DateTime.Now + " ] => [ IP Not In correct Format ]"); return; } try { dictionary_Threads.Add("IP_" + IPAddress, Thread.CurrentThread); } catch { }; IPChecker IPChecker = new IPChecker(IPAddress, IPPort, IPUsername, IPpassword, IsPublic); if (IPChecker.CheckPvtIP()) { workingproxiesCount++; lock (IPListLockr) { queWorkingPvtProxies.Enqueue(item); Monitor.Pulse(IPListLockr); } AddToIPsLogs("[ " + DateTime.Now + " ] => [ Added " + item + " to working proxies list ]"); lock (LstRunningPvtIP_IPModule) { LstRunningPvtIP_IPModule.Add(item); } } else { AddToIPsLogs("[ " + DateTime.Now + " ] => [ Non Working IP: " + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(item, Globals.Path_Non_ExistingProxies); } } catch (Exception ex) { } finally { lock (pvtProxiesThreadLockr) { countParsePvtProxiesThreads--; Monitor.Pulse(pvtProxiesThreadLockr); } threadcountForFinishMsgPvt--; if (countParsePvtProxiesThreads == 0) { AddToIPsLogs("[ " + DateTime.Now + " ] => [ Process of IP testing is finished. ]"); AddToIPsLogs("-----------------------------------------------------------------------------------------------------------------------"); } } }
private void ThreadPoolMethod_Proxies(object objIP) { try { LstPublicIP.Add(Thread.CurrentThread); LstPublicIP = LstPublicIP.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; Interlocked.Increment(ref countParseProxiesThreads); //countParseProxiesThreads++; string item = (string)objIP; int IsPublic = 0; int Working = 0; string LoggedInIp = string.Empty; string IPAddress = string.Empty; string IPPort = string.Empty; string IPUsername = string.Empty; string IPpassword = string.Empty; string account = item; int DataCount = account.Split(':').Length; if (DataCount == 1) { IPAddress = account.Split(':')[0]; AddToIPsLogs("[ " + DateTime.Now + " ] => [ IP Not In correct Format ]"); AddToIPsLogs("[ " + DateTime.Now + " ] => [ " + account + " ]"); return; } if (DataCount == 2) { IPAddress = account.Split(':')[0]; IPPort = account.Split(':')[1]; } else if (DataCount > 2) { IPAddress = account.Split(':')[0]; IPPort = account.Split(':')[1]; IPUsername = account.Split(':')[2]; IPpassword = account.Split(':')[3]; //AddToIPsLogs("IP Not In correct Format"); AddToIPsLogs("[ " + DateTime.Now + " ] => [ " + account + " ]"); return; } try { dictionary_Threads.Add("IP_" + IPAddress, Thread.CurrentThread); } catch { }; IPChecker IPChecker = new IPChecker(IPAddress, IPPort, IPUsername, IPpassword, IsPublic); if (IPChecker.CheckIP()) { //lock (((System.Collections.ICollection)listWorkingProxies).SyncRoot) { //if (!listWorkingProxies.Contains(IP)) { workingproxiesCount++; //listWorkingProxies.Add(IP); lock (IPListLockr) { queWorkingProxies.Enqueue(item); Monitor.Pulse(IPListLockr); } AddToIPsLogs("[ " + DateTime.Now + " ] => [ Added " + item + " to working proxies list ]"); lock (Locker_LstRunningIP_IPModule) { LstRunningIP_IPModule.Add(item); } Globals.EnquequeWorkingProxiesForSignUp(item); //Globussoft.GlobusFileHelper.AppendStringToTextfileNewLine(item, Globals.FilePathWorkingProxies); } } } else { AddToIPsLogs("[ " + DateTime.Now + " ] => [ Non Working IP: " + IPAddress + ":" + IPPort + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(item, Globals.Path_Non_ExistingProxies); } #region Commented code //string pageSource = string.Empty; //try //{ // GlobusHttpHelper httpHelper = new GlobusHttpHelper(); // pageSource = httpHelper.getHtmlfromUrlIP(new Uri("https://twitter.com/"), "", IPAddress, IPPort, IPUsername, IPpassword); //} //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 IPAddress = '" + IPAddress + "'", 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_IP values('" + IPAddress + "','" + IPPort + "','" + IPUsername + "','" + IPpassword + "', " + Working + "," + IsPublic + " , '" + LoggedInIp + "')"; // DataBaseHandler.InsertQuery(InsertQuery, "tb_IP"); // } // } // ValidPublicProxies.Add(item); //} #endregion } catch (Exception ex) { //AddToIPsLogs(ex.Message); } finally { lock (proxiesThreadLockr) { //countParseProxiesThreads--; Interlocked.Decrement(ref countParseProxiesThreads); Monitor.Pulse(proxiesThreadLockr); } threadcountForFinishMSG--; if (threadcountForFinishMSG == 0) { AddToIPsLogs("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED ]"); AddToIPsLogs("-----------------------------------------------------------------------------------------------------------------------"); } } }
private void CheckAndFillIPInQueue() { try { string IPAddress = string.Empty; string IPPort = string.Empty; string IPUsername = string.Empty; string IPpassword = string.Empty; int isPublic = 0; if (frmMain_NewUI.LstRunningIP_IPModule.Count > 0) { List<string> lstTemp = frmMain_NewUI.LstRunningIP_IPModule.Distinct().ToList(); AddToMobileLogs("[ " + DateTime.Now + " ] => [ " + lstTemp.Count + " IP Loaded ! ]"); foreach (string item in lstTemp) { try { IPAddress = item.Split(':')[0]; IPPort = item.Split(':')[1]; IPUsername = item.Split(':')[2]; IPpassword = item.Split(':')[3]; IPChecker obj_IPChecker = new IPChecker(IPAddress, IPPort, IPUsername, IPpassword, isPublic); if (obj_IPChecker.CheckIP()) { qRunningIP_Mobile.Enqueue(item); } lock (frmMain_NewUI.Locker_LstRunningIP_IPModule) { frmMain_NewUI.LstRunningIP_IPModule.Remove(item); } AddToMobileLogs("[ " + DateTime.Now + " ] => [ Not Running IP >>> " + item + " ]"); } catch { } } } else { AddToMobileLogs("[ " + DateTime.Now + " ] => [ There Is No Running IP. So Please Upload The New IP And Start Process Aggain ! ]"); // return; } } catch { } }