public bool CheckProxy() { try { int Working = 0; string LoggedInIp = string.Empty; //BaseLib.ChilkatHttpHelpr HttpHelper = new BaseLib.ChilkatHttpHelpr(); //string pageSource = HttpHelper.GetHtmlProxy("http://www.linkedin.com/", proxyAddress, proxyPort, proxyUsername, proxyPassword); GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); string pageSource = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/"), proxyAddress, int.Parse(proxyPort), proxyUsername, proxyPassword); if (string.IsNullOrEmpty(pageSource))//(string.IsNullOrEmpty(pageSource) && string.IsNullOrEmpty(PgSrcHome)) { Thread.Sleep(500); pageSource = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/"), proxyAddress, int.Parse(proxyPort), proxyUsername, proxyPassword); if (string.IsNullOrEmpty(pageSource)) { return(false); } } ///Logic to check... if (pageSource.Contains("LinkedIn") && (pageSource.Contains("Sign Up"))) { try { using (SQLiteConnection con = new SQLiteConnection(DataBaseHandler.CONstr)) { using (SQLiteDataAdapter ad = new SQLiteDataAdapter()) { Working = 1; string InsertQuery = "Insert into tb_Proxies values('" + proxyAddress + "','" + proxyPort + "','" + proxyUsername + "','" + proxyPassword + "', " + Working + "," + IsPublic + " , '" + LoggedInIp + "')"; DataBaseHandler.InsertQuery(InsertQuery, "tb_Proxies"); GlobusFileHelper.AppendStringToTextfileNewLine(proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.Path_ExsistingProxies); } } } catch { } return(true); } return(false); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(false); } }
public bool CheckProxy() { try { int Working = 0; string LoggedInIp = string.Empty; //BaseLib.ChilkatHttpHelpr HttpHelper = new BaseLib.ChilkatHttpHelpr(); //string pageSource = HttpHelper.GetHtmlProxy("http://www.linkedin.com/", proxyAddress, proxyPort, proxyUsername, proxyPassword); GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); string pageSource = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/"), proxyAddress, int.Parse(proxyPort), proxyUsername, proxyPassword); if (string.IsNullOrEmpty(pageSource))//(string.IsNullOrEmpty(pageSource) && string.IsNullOrEmpty(PgSrcHome)) { Thread.Sleep(500); pageSource = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/"), proxyAddress, int.Parse(proxyPort), proxyUsername, proxyPassword); if (string.IsNullOrEmpty(pageSource)) { return false; } } ///Logic to check... if (pageSource.Contains("LinkedIn") && (pageSource.Contains("Sign Up"))) { try { using (SQLiteConnection con = new SQLiteConnection(DataBaseHandler.CONstr)) { using (SQLiteDataAdapter ad = new SQLiteDataAdapter()) { Working = 1; string InsertQuery = "Insert into tb_Proxies values('" + proxyAddress + "','" + proxyPort + "','" + proxyUsername + "','" + proxyPassword + "', " + Working + "," + IsPublic + " , '" + LoggedInIp + "')"; DataBaseHandler.InsertQuery(InsertQuery, "tb_Proxies"); GlobusFileHelper.AppendStringToTextfileNewLine(proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.Path_ExsistingProxies); } } } catch { } return true; } return false; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return false; } }
private bool LoginAccount(string Username, string Password, string proxyAddress, string proxyPort, string proxyUserName, string proxyPassword) { bool IsLoggedIn = false; string _Username = string.Empty; string _Password = string.Empty; string _ProxyAddress = string.Empty; string _ProxyPort = string.Empty; string _ProxyUsername = string.Empty; string _ProxyPassword = string.Empty; try { _Username = Username; _Password = Password; _ProxyAddress = proxyAddress; _ProxyPort = proxyPort; _ProxyUsername = proxyUserName; _ProxyPassword = proxyPassword; if (string.IsNullOrEmpty(proxyPort) && !NumberHelper.ValidateNumber(proxyPort)) { _ProxyPort = "80"; } Log("[ " + DateTime.Now + " ] => [ Logging in with : " + _Username + " ]"); string Url = "https://www.linkedin.com/"; string pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyAddress, Convert.ToInt32(_ProxyPort), _ProxyUsername, _ProxyPassword); string postdata = string.Empty; string postUrl = string.Empty; string ResLogin = string.Empty; string csrfToken = string.Empty; string sourceAlias = string.Empty; string regCsrfParam = string.Empty; if (pageSrcLogin.Contains("csrfToken")) { try { int startIndex = pageSrcLogin.IndexOf("name=\"csrfToken\""); string start = pageSrcLogin.Substring(startIndex).Replace("name=\"csrfToken\"", ""); int endIndex = start.IndexOf("\" "); string end = start.Substring(0, endIndex).Replace("value=\"", "").Trim(); csrfToken = end; csrfToken = csrfToken.Replace("ajax:", ""); } catch (Exception ex) { } } try { if (csrfToken.Contains("&")) { string[] Arr = csrfToken.Split('&'); csrfToken = Arr[0].Replace("\"", string.Empty); } } catch { } SearchCriteria.CsrToken = csrfToken; if (pageSrcLogin.Contains("sourceAlias")) { try { sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100); string[] Arr = sourceAlias.Split('"'); sourceAlias = Arr[2].Replace("\\", string.Empty); } catch { } } try { int SourceAliasStart = pageSrcLogin.IndexOf("regCsrfParam"); if (SourceAliasStart > 0) { try { regCsrfParam = pageSrcLogin.Substring(pageSrcLogin.IndexOf("regCsrfParam"), 100); string[] Arr = regCsrfParam.Split('"'); regCsrfParam = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty); } catch { } } } catch { } //postUrl = "https://www.linkedin.com/uas/login-submit"; //postdata = "session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; //ResLogin = HttpHelper.postFormData(new Uri(postUrl), postdata); postUrl = "https://www.linkedin.com/uas/login-submit"; postdata = "isJsEnabled=true&source_app=&tryCount=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&loginCsrfParam=" + regCsrfParam + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; try { ResLogin = HttpHelper.postFormDataProxy(new Uri(postUrl), postdata, _ProxyPassword, Convert.ToInt32(_ProxyPort), _ProxyUsername, _ProxyPassword);//HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "http://www.linkedin.com/uas/login?goback=&trk=hb_signin", "", ""); } catch { } if (ResLogin.Contains("Your LinkedIn account has been temporarily restricted") || ResLogin.Contains("Change your password") || ResLogin.Contains("Please confirm your email address")) { if (ResLogin.Contains("Your LinkedIn account has been temporarily restricted")) { try { Log("[ " + DateTime.Now + " ] => [ Your LinkedIn account has been temporarily restricted : " + _Username + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(_Username, Globals.Path_TemporarilyRestrictedAccount_AccountChecker); } catch { } } if (ResLogin.Contains("Change your password")) { try { Log("[ " + DateTime.Now + " ] => [ Change your password : "******" ]"); GlobusFileHelper.AppendStringToTextfileNewLine(_Username, Globals.Path_ChangeYourPassword_AccountChecker); } catch { } } if (ResLogin.Contains("Please confirm your email address")) { try { Log("[ " + DateTime.Now + " ] => [ Please confirm your email address : " + _Username + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(_Username, Globals.Path_ConfirmYourEmailAddress_AccountChecker); } catch { } } } if (ResLogin.Contains("The email address or password you provided does not match our records")) { try { Log("[ " + DateTime.Now + " ] => [ The email address or password you provided does not match our records : " + _Username + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(_Username, Globals.Path_EmailAddressOrPasswordDoesNotMatch_AccountChecker); } catch { } } if (ResLogin.Contains("Security Verification")) { try { Log("[ " + DateTime.Now + " ] => [ Security Verification : " + _Username + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(_Username, Globals.Path_SecurityVerification_AccountChecker); } catch { } } if (ResLogin.Contains("One or more of your email addresses needs confirmation")) { try { Log("[ " + DateTime.Now + " ] => [ One or more of your email addresses needs confirmation : " + _Username + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(_Username, Globals.Path_ConfirmYourEmailAddress_AccountChecker); } catch { } } if (ResLogin.Contains("Sign Out") && !ResLogin.Contains("Your LinkedIn account has been temporarily restricted") && !ResLogin.Contains("Please confirm your email address")) { IsLoggedIn = true; } string CheckedAccount = _Username + ":" + _Password; if (IsLoggedIn) { try { Log("[ " + DateTime.Now + " ] => [ Successfully Logged In with : " + _Username + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(CheckedAccount, Globals.Path_WorkingAccount_AccountChecker); } catch { } } else { try { Log("[ " + DateTime.Now + " ] => [ Failed to Login with : " + _Username + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(CheckedAccount, Globals.Path_NonWorkingAccount_AccountChecker); } catch { } } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("Module Name >>> AccountChecker, UserName >>> " + _Email + " , ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " , ex.StackTrace >>> " + ex.StackTrace + " , Date Time >>> " + DateTime.Now, Globals.Path_ErrorFile_AccountChecker); } return(IsLoggedIn); }
public void LoginHttpHelper(ref GlobusHttpHelper HttpHelper) { try { Log("[ " + DateTime.Now + " ] => [ Logging In With : " + _Username + " ]"); Log("[ " + DateTime.Now + " ] => [ Login Process is Running... ]"); //Check Login if (IsLoggedIn) { try { string homePage = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/home"), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword); if (homePage.Contains("Sign Out") && homePage.Contains("class=\"signout\"") && !homePage.Contains("Your LinkedIn account has been temporarily restricted")) { Log("[ " + DateTime.Now + " ] => [ Already Logged In With : " + _Username + " ]"); return; } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } string Url = "https://www.linkedin.com/"; ////string pageSrcLogin = HttpChilkat.GetHtmlProxy(Url, proxyAddress, proxyPort, proxyUserName, proxyPassword); string pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword); if (string.IsNullOrEmpty(pageSrcLogin)) { try { System.Threading.Thread.Sleep(1000); pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword, ""); } catch { } } if (string.IsNullOrEmpty(pageSrcLogin)) { Log("[ " + DateTime.Now + " ] => [ Couldn't Login In With : " + _Username + " ]"); return; } string postdata = string.Empty; string postUrl = string.Empty; string ResLogin = string.Empty; string csrfToken = string.Empty; string sourceAlias = string.Empty; string regCsrfParam = string.Empty; if (pageSrcLogin.Contains("csrfToken")) { try { int startindex = pageSrcLogin.IndexOf("name=\"csrfToken\""); if (startindex > 0) { string start = pageSrcLogin.Substring(startindex).Replace("name=\"csrfToken\"", ""); int endindex = start.IndexOf("\" "); string end = start.Substring(0, endindex); csrfToken = end.Replace("value=\"", "").Replace("\\", "").Replace(" ", ""); //csrfToken = Uri.EscapeDataString(csrfToken); if (csrfToken.Contains("https://www.linkedin.com")) { csrfToken = Utils.getBetween("@@@@@@@" + csrfToken, "@@@@@@@", "\"/></form>"); } } else { string[] Arr = csrfToken.Split('"'); csrfToken = Arr[2].Replace("\\", string.Empty); } } catch { try { csrfToken = pageSrcLogin.Substring(pageSrcLogin.IndexOf("csrfToken"), 100); if (csrfToken.Contains("&")) { string[] Arr = csrfToken.Split('&'); csrfToken = Arr[0]; } else if (csrfToken.Contains(",")) { string[] Arr = csrfToken.Split(','); csrfToken = Arr[0].Replace("\\", string.Empty); } else { string[] Arr = csrfToken.Split(','); csrfToken = Arr[0].Replace("\\", string.Empty).Replace("csrfToken=", "").Replace("\n", "").Replace("\">", ""); } } catch { } } } try { if (csrfToken.Contains("&")) { string[] Arr1 = csrfToken.Split('&'); csrfToken = Arr1[0].Replace("\"", string.Empty); } } catch { } SearchCriteria.CsrToken = csrfToken.Replace("\n", "").Replace("//", "").Replace("\">", "").Replace("csrfToken=", ""); if (pageSrcLogin.Contains("sourceAlias")) { try { sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100); string[] Arr = sourceAlias.Split('"'); sourceAlias = Arr[2].Replace("\\", string.Empty); } catch { } } try { int SourceAliasStart = pageSrcLogin.IndexOf("regCsrfParam"); if (SourceAliasStart > 0) { try { regCsrfParam = pageSrcLogin.Substring(pageSrcLogin.IndexOf("regCsrfParam"), 100); string[] Arr = regCsrfParam.Split('"'); regCsrfParam = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty); } catch { } } if (string.IsNullOrEmpty(regCsrfParam)) { regCsrfParam = Utils.getBetween(pageSrcLogin, "loginCsrfParam", "/>"); regCsrfParam = Utils.getBetween(regCsrfParam, "value=\"", "\""); } } catch { } postUrl = "https://www.linkedin.com/uas/login-submit"; //postdata = "isJsEnabled=true&source_app=&tryCount=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&loginCsrfParam=" + regCsrfParam + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; postdata = "isJsEnabled=true&source_app=&tryCount=&clickedSuggestion=false&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&trk=hb_signin&loginCsrfParam=" + regCsrfParam + "&fromEmail=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; // postdata = "isJsEnabled=true&source_app=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign+In&session_redirect=&trk=&loginCsrfParam=7462d247-6d54-47de-8f22-29723ea15f9d&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; try { ResLogin = HttpHelper.postFormDataProxy(new Uri(postUrl), postdata, _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword);//HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "http://www.linkedin.com/uas/login?goback=&trk=hb_signin", "", ""); } catch { } //postUrl = "https://www.linkedin.com/uas/login-submit"; //isJsEnabled=true&source_app=&tryCount=&session_key=gargimishra%40globussoft.com&session_password=globussoft&signin=Sign%20In&session_redirect=&csrfToken=ajax%3A7066152446927176852&sourceAlias=0_7r5yezRXCiA_H0CRD8sf6DhOjTKUNps5xGTqeX8EEoi //postdata = "isJsEnabled=true&source_app=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; // postdata = "session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; //ResLogin = HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "https://www.linkedin.com/uas/login?goback=&trk=hb_signin", "true", ""); string dts = string.Empty; string captchachallengeid = string.Empty; string origActionAlias = string.Empty; string origSourceAlias = string.Empty; string irhf = string.Empty; string captchaText = string.Empty; string ImageUrl = string.Empty; // if (ResLogin.Contains("Your LinkedIn account has been temporarily restricted") || ResLogin.Contains("Change your password") || ResLogin.Contains("Please confirm your email address") && !ResLogin.Contains("Sign Out")) { SearchCriteria.loginREsponce = ResLogin; } else if (ResLogin.Contains("Security Verification")) { string dataforcapctha = HttpHelper.getHtmlfromUrl1(new Uri("https://www.google.com/recaptcha/api/noscript?k=6LcnacMSAAAAADoIuYvLUHSNLXdgUcq-jjqjBo5n")); if (!string.IsNullOrEmpty(dataforcapctha)) { int startindex = dataforcapctha.IndexOf("id=\"recaptcha_challenge_field\""); if (startindex > 0) { string start = dataforcapctha.Substring(startindex).Replace("id=\"recaptcha_challenge_field\"", ""); int endindex = start.IndexOf("\">"); string end = start.Substring(0, endindex).Replace("value=", "").Replace("\"", ""); ImageUrl = "https://www.google.com/recaptcha/api/image?c=" + end; WebClient webclient = new WebClient(); byte[] args = webclient.DownloadData(ImageUrl); string[] arr1 = new string[] { Globals.CapchaLoginID, Globals.CapchaLoginPassword, "" }; captchaText = DecodeDBC(arr1, args); } if (ResLogin.Contains("name=\"security-challenge-id\"")) { int startindexnew = ResLogin.IndexOf("name=\"security-challenge-id\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"security-challenge-id\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); captchachallengeid = end.Replace("\"", ""); } } if (ResLogin.Contains("name=\"dts\"")) { int startindexnew = ResLogin.IndexOf("name=\"dts\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"dts\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); dts = end.Replace("\"", ""); } } if (ResLogin.Contains("name=\"origActionAlias\"")) { int startindexnew = ResLogin.IndexOf("name=\"origActionAlias\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"origActionAlias\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); origActionAlias = end.Replace("\"", ""); } } if (ResLogin.Contains("name=\"origSourceAlias\"")) { int startindexnew = ResLogin.IndexOf("name=\"origSourceAlias\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"origSourceAlias\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); origSourceAlias = end.Replace("\"", ""); } } if (ResLogin.Contains("name=\"irhf\"")) { int startindexnew = ResLogin.IndexOf("name=\"irhf\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"irhf\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); irhf = end.Replace("\"", ""); } } //postdata = "dts=" + dts + "&security-challenge-id=" + captchachallengeid + "&hr=&source_app=&csrfToken=" + csrfToken + "&trk=guest_home&isJsEnabled=true&session_redirect=&session_password="******"&session_key=" + _Username + "&origSourceAlias=" + origSourceAlias + "&origActionAlias=" + origActionAlias + "&irhf=" + irhf +"&sourceAlias=" + sourceAlias; if (!string.IsNullOrEmpty(ImageUrl) && !string.IsNullOrEmpty(captchaText)) { postdata = "recaptcha_challenge_field=" + ImageUrl.Replace("https://www.google.com/recaptcha/api/image?c=", "") + "&recaptcha_response_field=" + captchaText.Replace(" ", "+") + "&dts=" + dts + "&security-challenge-id=" + captchachallengeid + "&hr=&source_app=&csrfToken=" + csrfToken + "&isJsEnabled=true&session_redirect=&session_password="******"&session_key=" + Uri.EscapeDataString(_Username) + "&origSourceAlias=" + origSourceAlias + "&origActionAlias=" + origActionAlias + "&irhf=" + irhf + "&sourceAlias=" + sourceAlias; postdata = postdata.Replace(" ", ""); ResLogin = HttpHelper.postFormDataRef(new Uri("https://www.linkedin.com/uas/captcha-submit"), postdata, "https://www.linkedin.com/uas/login-submit", "", "", "", "", ""); } else { ResLogin = ""; } if (ResLogin.Contains("The text you entered does not match the characters in the security image. Please try again with this new image") || string.IsNullOrEmpty(ResLogin)) { Log("[ " + DateTime.Now + " ] => [ " + _Username + " Cannot Login because of Capctcha ]"); GlobusFileHelper.WriteStringToTextfile(_Username + ":" + _Password + ":" + _ProxyAddress + ":" + _ProxyPort + ":" + _ProxyUsername + ":" + _ProxyPassword, Globals.pathCapcthaLogin); SearchCriteria.loginREsponce = string.Empty; } } } //ResLogin.Contains("Sign Out") && ResLogin.Contains("class=\"signout\"") && !ResLogin.Contains("Your LinkedIn account has been temporarily restricted") if (ResLogin.Contains("Sign Out") && !ResLogin.Contains("Your LinkedIn account has been temporarily restricted")) { SearchCriteria.loginREsponce = string.Empty; IsLoggedIn = true; string Search = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search?trk=advsrch")); SearchCriteria.loginREsponce = Search; } else if (ResLogin.Contains("logout?session_full_logout")) { SearchCriteria.loginREsponce = string.Empty; IsLoggedIn = true; string Search = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search?trk=advsrch")); SearchCriteria.loginREsponce = Search; } else { //There was an unexpected problem that prevented us from completing your request. SearchCriteria.loginREsponce = string.Empty; IsLoggedIn = false; } //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top"; //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, 888, proxyUserName, proxyPassword); //LogoutHttpHelper(ref HttpHelper); //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top"; //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, 888, proxyUserName, proxyPassword); } catch { } }
// public void PostStatusMsg(ref GlobusHttpHelper HttpHelper, Boolean Statuswithurl, int mindelay, int maxdelay) public void PostStatusMsg(ref GlobusHttpHelper HttpHelper, Boolean Statuswithurl, int mindelay, int maxdelay, string spinnedStatus, Boolean isSpinTrue) { try { string csrfToken = string.Empty; string sourceAlias = string.Empty; string ImgCount = string.Empty; string LogoUrl = string.Empty; string EntityId = string.Empty; string contentTitle = string.Empty; string contentSummary = string.Empty; int port = 0; if (NumberHelper.ValidateNumber(proxyPort)) { port = Convert.ToInt32(proxyPort); } string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top")); if (pageSource.Contains("session_full_logout=&")) { try { csrfToken = pageSource.Substring(pageSource.IndexOf("session_full_logout=&"), 500); string[] Arr = csrfToken.Split('&'); csrfToken = Arr[1]; csrfToken = csrfToken.Replace("csrfToken=", ""); csrfToken = csrfToken.Replace("%3A", ":").Replace("\n", string.Empty).Replace("\"", string.Empty).Replace("amp;",string.Empty).Replace(">", string.Empty).Trim(); } catch (Exception) { } } if (pageSource.Contains("sourceAlias")) { try { sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100); string[] ArrsourceAlias = sourceAlias.Split('"'); sourceAlias = ArrsourceAlias[2]; } catch (Exception) { } } try { string ReqUrl = Post; string GetStatus = string.Empty; //if (Statuswithurl == false) //{ // spinnedStatus = GlobusSpinHelper.spinLargeText(new Random(), spinnedStatus); // Post = spinnedStatus; //} if (isSpinTrue == true) { spinnedStatus = GlobusSpinHelper.spinLargeText(new Random(), spinnedStatus); Post = spinnedStatus; } if (Post.Contains("//") || Post.Contains("www") || Post.Contains(".com") || Post.Contains("http://") || Post.Contains("https://")) { ReqUrl = ReqUrl.Replace(":", "%3A").Replace("//", "%2F%2F"); ReqUrl = ReqUrl.Replace(":", "%3A").Replace("/", "%2F"); GetStatus = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/share?getPreview=&url=" + ReqUrl)); } if (!(GetStatus.Contains("<WSResponse>"))) { try { int StartinImgCnt = GetStatus.IndexOf("current"); string startImgCnt = GetStatus.Substring(StartinImgCnt); int EndIndexImgCnt = startImgCnt.IndexOf("</span>"); string EndImgCnt = startImgCnt.Substring(0, EndIndexImgCnt).Replace("value\":", "").Replace("\"", ""); ImgCount = EndImgCnt.Replace("current", string.Empty).Replace(">", string.Empty); } catch { ImgCount = "0"; } try { //int StartinImgUrl = GetStatus.IndexOf("url"); //string startImgUrl = GetStatus.Substring(StartinImgUrl).Replace("url=\"", ""); //int EndIndexImgUrl = startImgUrl.IndexOf("\""); //string EndImgUrl = startImgUrl.Substring(0, EndIndexImgUrl).Replace("value\":", "").Replace("\"", ""); //LogoUrl = EndImgUrl.Replace("url=", string.Empty); int startindexImgurl = GetStatus.IndexOf("origImages:"); string startImgurl = GetStatus.Substring(startindexImgurl).Replace("origImages:", string.Empty); int endindexImgurl = startImgurl.IndexOf("]"); string endImgUrl = startImgurl.Substring(0, endindexImgurl).Replace("\\", string.Empty).Replace("[", string.Empty).Replace("\"", string.Empty).Trim(); LogoUrl = endImgUrl; LogoUrl = LogoUrl.Replace(":", "%3A").Replace("/", "%2F"); } catch { } try { int StartinEntityId = GetStatus.IndexOf("data-entity-id"); string startEntityId = GetStatus.Substring(StartinEntityId); int EndIndexEntityId = startEntityId.IndexOf("data-entity-url"); string EndEntityId = startEntityId.Substring(0, EndIndexEntityId).Replace("value\":", "").Replace("\"", ""); EntityId = EndEntityId.Replace("\"", string.Empty).Replace("data-entity-id", string.Empty).Replace("=", string.Empty); } catch { } try { int StartinContent = GetStatus.IndexOf("share-view-title"); string startContent = GetStatus.Substring(StartinContent); int EndIndexContent = startContent.IndexOf("<p id"); string EndContent = startContent.Substring(0, EndIndexContent).Replace("value\":", "").Replace("\"", ""); contentTitle = EndContent.Replace("\"", string.Empty).Replace("\n", string.Empty).Replace("share-view-title", string.Empty).Replace("id=", string.Empty).Replace(">", string.Empty).Replace("</h4", string.Empty); } catch { } try { int StartinConSumm = GetStatus.IndexOf("share-view-summary\">"); string startConSumm = GetStatus.Substring(StartinConSumm); int EndIndexConSumm = startConSumm.IndexOf("<"); string EndConSumm = startConSumm.Substring(0, EndIndexConSumm).Replace("value\":", "").Replace("\"", ""); contentSummary = EndConSumm.Replace("\"", string.Empty).Replace("\n", string.Empty).Replace("share-view-summary", string.Empty).Replace("id=", string.Empty).Replace(">", string.Empty).Replace("</span<a href=#", string.Empty).Trim(); contentSummary = contentSummary.Replace(",", "%2C").Replace(" ", "%20"); } catch { } string PostStatusData = string.Empty; if (EntityId == string.Empty) { PostStatusData = "ajax=true&contentImageCount=0&contentImageIndex=-1&contentImage=&contentEntityID=&contentUrl=&postText=" + Uri.EscapeDataString(Post) + "&contentTitle=&contentSummary=&contentImageIncluded=true&%23=&postVisibility2=EVERYONE&submitPost=&tetherAccountID=&tweetThisOn=false&postToMFeedDefaultPublic=true&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + ""; } else { PostStatusData = "ajax=true&contentImageCount=" + ImgCount + "&contentImageIndex=0&contentImage=" + LogoUrl + "&contentEntityID=" + EntityId + "&contentUrl=" + ReqUrl + "&postText=" + Uri.EscapeDataString(Post) + "&contentTitle=" + contentTitle + "&contentSummary=" + contentSummary + "&contentImageIncluded=true&%23=&postVisibility2=EVERYONE&submitPost=&tetherAccountID=&tweetThisOn=false&postToMFeedDefaultPublic=true&csrfToken=" + Uri.EscapeDataString(csrfToken) + "&sourceAlias=" + sourceAlias + ""; // PostStatusData = "ajax=true&contentImageCount=" + ImgCount + "&contentImageIndex=0&contentImage=http%3A%2F%2Ftimesofindia.indiatimes.com%2Fphoto%2F37174983.cms&contentEntityID=" + EntityId + "&contentUrl=http%3A%2F%2Ftimesofindia.indiatimes.com%2Ftech%2Ftech-news%2FGoogles-Skybox-deal-raises-regulatory-concern%2Farticleshow%2F37174862.cms&mentions=%5B%5D&postText=" + Uri.EscapeDataString(Post) + "&contentTitle=" + contentTitle + "&contentSummary=" + contentSummary + "&contentImageIncluded=true&%23=&postVisibility2=EVERYONE&submitPost=&tetherAccountID=&tweetThisOn=false&postToMFeedDefaultPublic=true&csrfToken=" + Uri.EscapeDataString(csrfToken) + "&sourceAlias=" + sourceAlias + ""; //PostStatusData = "ajax=true&contentImageCount=1&contentImageIndex=0&contentImage=http%3A%2F%2Ftimesofindia.indiatimes.com%2Fphoto%2F37174983.cms&contentEntityID=ARTC_8537949489495079643&contentUrl=http%3A%2F%2Ftimesofindia.indiatimes.com%2Ftech%2Ftech-news%2FGoogles-Skybox-deal-raises-regulatory-concern%2Farticleshow%2F37174862.cms&mentions=%5B%5D&postText=http%3A%2F%2Ftimesofindia.indiatimes.com%2Ftech%2Ftech-news%2FGoogles-Skybox-deal-raises-regulatory-concern%2Farticleshow%2F37174862.cms&share-entity-typeahead=&contentUrl=http%3A%2F%2Ftimesofindia.indiatimes.com%2Ftech%2Ftech-news%2FGoogles-Skybox-deal-raises-regulatory-concern%2Farticleshow%2F37174862.cms&contentImageIncluded=true&contentTitle=Google's%20Skybox%20deal%20raises%20regulatory%20concern%20-%20The%20Times%20of%20India&contentSummary=Consumer%20watchdog%20Public%20Citizen%20has%20called%20on%20US%20regulators%20to%20conduct%20a%20review%20of%20Google%20Inc's%20recent%20acquisition%20of%20aerospace%20startup%20Skybox%20Imaging.&postVisibility2=EVERYONE&tetherAccountID=139016702&submitPost=&isDark=false&tweetThisOn=false&postToMFeedDefaultPublic=true&csrfToken=ajax%3A5539773821497530765&sourceAlias=0_0aUs533-gpztrJxp65YSDh&pageKey=member-home"; } PostStatusData = PostStatusData.Replace(" ", ""); string ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/nhome/submit-post"), PostStatusData); Thread.Sleep(2000); if (ResponseStatusMsg.Contains("There was a problem performing this action, please try again later.")) { string firstRepsonse = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/share?getPreview=&url=" + Uri.EscapeDataString(Post)), proxyAddress, port, proxyUserName, proxyPassword); string posturldata = "ajax=true&contentImageCount=0&contentImageIndex=0&contentImage=false&contentEntityID=" + EntityId + "&contentUrl=" + ReqUrl + "&postText=" + Uri.EscapeDataString(Post) + "&contentUrl=" + Uri.EscapeDataString(Post) + "&contentTitle=" + contentTitle + "&contentSummary=" + contentSummary + "&postVisibility2=EVERYONE&submitPost=&tetherAccountID=&tweetThisOn=false&postToMFeedDefaultPublic=true&csrfToken=" + Uri.EscapeDataString(csrfToken) + "&sourceAlias=" + sourceAlias; ResponseStatusMsg = HttpHelper.postFormDataProxy(new Uri("http://www.linkedin.com/nhome/submit-post"), posturldata, proxyAddress, port, proxyUserName, proxyPassword); } if (ResponseStatusMsg.Contains("Your update has been posted") || ResponseStatusMsg.Contains("success")) { if (Statuswithurl == true) { Log("[ " + DateTime.Now + " ] => [ URL Status Updated With: " + accountUser + " ]"); Log("[ " + DateTime.Now + " ] => [ URL Status Posted: " + Post + " ]"); Log("[ " + DateTime.Now + " ] => [ URL Status : Updated Successfully. ]"); } else { Log("[ " + DateTime.Now + " ] => [ Status Updated With: " + accountUser + " ]"); Log("[ " + DateTime.Now + " ] => [ Status Posted: " + Post + " ]"); Log("[ " + DateTime.Now + " ] => [ Status : Updated Successfully. ]"); } GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + Post, Globals.path_PostStatus); } else if (ResponseStatusMsg.Contains("You have exceeded the maximum length by 965 character(s).")) { Log("[ " + DateTime.Now + " ] => [ " + accountUser + " You have exceeded the maximum length by 965 character(s). ]"); GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + Post, Globals.path_NonPostStatus); } else if (ResponseStatusMsg.Contains("We were unable to post your update since it is a duplicate of your most recent update")) { Log("[ " + DateTime.Now + " ] => [ " + accountUser + " We were unable to post your update since it is a duplicate of your most recent update ]"); GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + Post, Globals.path_NonPostStatus); } else { if (Statuswithurl == true) { Log("[ " + DateTime.Now + " ] => [ " + accountUser + " URL Status Not Posted ]"); } else { Log("[ " + DateTime.Now + " ] => [ " + accountUser + " Status Not Posted ]"); } GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + Post, Globals.path_NonPostStatus); } int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]"); Thread.Sleep(delay * 1000); } else { Log("[ " + DateTime.Now + " ] => [ " + accountUser + " Error in status update. Please try again ]"); } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + Post, Globals.path_NonPostStatus); } finally { } } catch { } }
public void LoginHttpHelper_Checker(ref GlobusHttpHelper HttpHelper) { try { this.HttpHelper = HttpHelper; //Log("[ " + DateTime.Now + " ] => [ Logging In With Account : " + SearchCriteria.LoginID + " ]"); Log("[ " + DateTime.Now + " ] => [ Logging In With Account : " + accountUser + " ]"); Log("[ " + DateTime.Now + " ] => [ Login Process is Running... ]"); Url = "https://www.linkedin.com/"; string pageSrcLogin = string.Empty; int ProxyPort = 0; if (!string.IsNullOrEmpty(proxyPort) && NumberHelper.ValidateNumber(proxyPort)) { ProxyPort = int.Parse(proxyPort); } pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, ProxyPort, proxyUserName, proxyPassword); string postdata = string.Empty; string postUrl = string.Empty; string ResLogin = string.Empty; string csrfToken = string.Empty; string regCsrfParam = string.Empty; string sourceAlias = string.Empty; if (pageSrcLogin.Contains("csrfToken")) { try { int startIndex = pageSrcLogin.IndexOf("name=\"csrfToken\""); string start = pageSrcLogin.Substring(startIndex).Replace("name=\"csrfToken\"", ""); int endIndex = start.IndexOf("\" "); string end = start.Substring(0, endIndex).Replace("value=\"", "").Trim(); csrfToken = end; //csrfToken = csrfToken; } catch (Exception ex) { } } try { if (csrfToken.Contains("&")) { string[] Arr = csrfToken.Split('&'); csrfToken = Arr[0].Replace("\"", string.Empty); } } catch { } if (pageSrcLogin.Contains("sourceAlias")) { sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100); string[] Arr = sourceAlias.Split('"'); sourceAlias = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty).Trim(); } try { int SourceAliasStart = pageSrcLogin.IndexOf("regCsrfParam"); if (SourceAliasStart > 0) { try { regCsrfParam = pageSrcLogin.Substring(pageSrcLogin.IndexOf("regCsrfParam"), 100); string[] Arr = regCsrfParam.Split('"'); regCsrfParam = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty); } catch { } } } catch { } postUrl = "https://www.linkedin.com/uas/login-submit"; postdata = "isJsEnabled=true&source_app=&tryCount=&session_key=" + Uri.EscapeDataString(accountUser) + "&session_password="******"&signin=Sign%20In&session_redirect=&loginCsrfParam=" + regCsrfParam + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; try { ResLogin = HttpHelper.postFormDataProxy(new Uri(postUrl), postdata, proxyAddress, ProxyPort, proxyUserName, proxyPassword);//HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "http://www.linkedin.com/uas/login?goback=&trk=hb_signin", "", ""); } catch { } //if (GroupStatus.GrouppageSourcewithProxy == string.Empty) //{ // GroupStatus.GrouppageSourcewithProxy = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/grp/")); //} string ImageUrl = string.Empty; string captchaText = string.Empty; string captchachallengeid = string.Empty; string dts = string.Empty; string origActionAlias = string.Empty; string origSourceAlias = string.Empty; string irhf = string.Empty; string submissionID = string.Empty; string CAPTCHAfwdcsrftoken = string.Empty; string CAPTCHAfwdsignin = string.Empty; string CAPTCHAfwdsession_password = string.Empty; string CAPTCHAfwdsession_key = string.Empty; string CAPTCHAfwdisJsEnabled = string.Empty; string CAPTCHAfwdloginCsrfParam = string.Empty; if (ResLogin.Contains("Security Verification")) { string dataforcapctha = HttpHelper.getHtmlfromUrl1(new Uri("https://www.google.com/recaptcha/api/noscript?k=6LcnacMSAAAAADoIuYvLUHSNLXdgUcq-jjqjBo5n")); if (!string.IsNullOrEmpty(dataforcapctha)) { int startindex = dataforcapctha.IndexOf("id=\"recaptcha_challenge_field\""); if (startindex > 0) { string start = dataforcapctha.Substring(startindex).Replace("id=\"recaptcha_challenge_field\"", ""); int endindex = start.IndexOf("\">"); string end = start.Substring(0, endindex).Replace("value=", string.Empty).Replace("\"", string.Empty).Trim(); ImageUrl = "https://www.google.com/recaptcha/api/image?c=" + end; System.Net.WebClient webclient = new System.Net.WebClient(); byte[] args = webclient.DownloadData(ImageUrl); string[] arr1 = new string[] { Globals.CapchaLoginID, Globals.CapchaLoginPassword, "" }; captchaText = DecodeDBC(arr1, args); } if (ResLogin.Contains("name=\"security-challenge-id\"")) { int startindexnew = ResLogin.IndexOf("name=\"security-challenge-id\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"security-challenge-id\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); captchachallengeid = end.Replace("\"", string.Empty).Trim(); } } if (ResLogin.Contains("name=\"dts\"")) { int startindexnew = ResLogin.IndexOf("name=\"dts\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"dts\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); dts = end.Replace("\"", string.Empty).Trim(); } } if (ResLogin.Contains("name=\"origActionAlias\"")) { int startindexnew = ResLogin.IndexOf("name=\"origActionAlias\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"origActionAlias\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); origActionAlias = end.Replace("\"", string.Empty).Trim(); } } if (ResLogin.Contains("name=\"submissionId\"")) { int startindexnew = ResLogin.IndexOf("name=\"submissionId\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"submissionId\"", string.Empty).Replace("value=\"", string.Empty); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); submissionID = end.Replace("\"", string.Empty).Trim(); } } if (ResLogin.Contains("name=\"CAPTCHA-fwd-csrfToken\"")) { int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-csrfToken\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-csrfToken\"", string.Empty).Replace("value=\"", string.Empty); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); CAPTCHAfwdcsrftoken = end.Replace("\"", string.Empty).Trim(); } } if (ResLogin.Contains("name=\"CAPTCHA-fwd-signin\"")) { int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-signin\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-signin\"", string.Empty).Replace("value=\"", string.Empty); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); CAPTCHAfwdsignin = end.Replace("\"", string.Empty).Trim(); } } if (ResLogin.Contains("name=\"CAPTCHA-fwd-session_password\"")) { int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-session_password\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-session_password\"", string.Empty).Replace("value=\"", string.Empty); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); CAPTCHAfwdsession_password = end.Replace("\"", string.Empty).Trim(); } } if (ResLogin.Contains("name=\"CAPTCHA-fwd-session_key\"")) { int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-session_key\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-session_key\"", string.Empty).Replace("value=\"", string.Empty); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); CAPTCHAfwdsession_key = end.Replace("\"", string.Empty).Trim(); } } if (ResLogin.Contains("name=\"CAPTCHA-fwd-isJsEnabled\"")) { int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-isJsEnabled\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-isJsEnabled\"", string.Empty).Replace("value=\"", string.Empty); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); CAPTCHAfwdisJsEnabled = end.Replace("\"", string.Empty).Trim(); } } if (ResLogin.Contains("name=\"CAPTCHA-fwd-loginCsrfParam\"")) { int startindexnew = ResLogin.IndexOf("name=\"CAPTCHA-fwd-loginCsrfParam\""); if (startindexnew > 0) ; { string start = ResLogin.Substring(startindexnew).Replace("name=\"CAPTCHA-fwd-loginCsrfParam\"", string.Empty).Replace("value=\"", string.Empty); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); CAPTCHAfwdloginCsrfParam = end.Replace("\"", string.Empty).Trim(); } } if (ResLogin.Contains("name=\"origSourceAlias\"")) { int startindexnew = ResLogin.IndexOf("name=\"origSourceAlias\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"origSourceAlias\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); origSourceAlias = end.Replace("\"", string.Empty).Trim(); } } if (ResLogin.Contains("name=\"irhf\"")) { int startindexnew = ResLogin.IndexOf("name=\"irhf\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"irhf\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); irhf = end.Replace("\"", string.Empty).Trim(); } } if (!string.IsNullOrEmpty(ImageUrl) && !string.IsNullOrEmpty(captchaText)) { postdata = "recaptcha_challenge_field=" + ImageUrl.Replace("https://www.google.com/recaptcha/api/image?c=", string.Empty) + "&recaptcha_response_field=" + captchaText.Replace(" ", "+") + "&irhf=" + irhf + "&dts=" + dts + "&security-challenge-id=" + captchachallengeid + "&submissionId=" + submissionID + "&CAPTCHA-fwd-csrfToken=" + CAPTCHAfwdcsrftoken + "&CAPTCHA-fwd-isJsEnabled=" + CAPTCHAfwdisJsEnabled + "&CAPTCHA-fwd-signin=" + CAPTCHAfwdsignin + "&CAPTCHA-fwd-loginCsrfParam=" + CAPTCHAfwdloginCsrfParam + "&CAPTCHA-fwd-session_password="******"&CAPTCHAfwd-session_key=" + CAPTCHAfwdsession_key + "&session_password="******"&session_key=" + Uri.EscapeDataString(accountUser) + "&origSourceAlias=" + origSourceAlias + "&origActionAlias=" + origActionAlias + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; postdata = postdata.Replace(" ", string.Empty); ResLogin = HttpHelper.postFormDataRef(new Uri("https://www.linkedin.com/uas/captcha-submit"), postdata, "https://www.linkedin.com/uas/login-submit", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty); } else { ResLogin = string.Empty; } if (ResLogin.Contains("The text you entered does not match the characters in the security image. Please try again with this new image") || string.IsNullOrEmpty(ResLogin)) { Log("[ " + DateTime.Now + " ] => [ " + accountUser + " Cannot Login because of Capctcha ]"); GlobusFileHelper.WriteStringToTextfile(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.pathCapcthaLogin); SearchCriteria.loginREsponce = string.Empty; //FrmScrapGroupMember.ChangeToNextAccount = true; } } } string CheckedAccount = accountUser + ":" + accountPass; if (ResLogin.Contains("Sign Out") || ResLogin.Contains("class=\"signout\"") || ResLogin.Contains("Cerrar sesión")) { IsLoggedIn = true; Log("[ " + DateTime.Now + " ] => [ Logged In With Account : " + accountUser + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(CheckedAccount, Globals.Path_WorkingAccount_AccountChecker); } else if (ResLogin.Contains("logout?session_full_logout")) { SearchCriteria.loginREsponce = string.Empty; IsLoggedIn = true; string Search = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/search?trk=advsrch")); SearchCriteria.loginREsponce = Search; } else if (ResLogin.Contains("Sign-In Verification")) { Log("[ " + DateTime.Now + " ] => [ Verification required : " + accountUser + " ]"); } else if (ResLogin.Contains("Your LinkedIn account has been temporarily restricted")) { Log("[ " + DateTime.Now + " ] => [ Your LinkedIn account : " + accountUser + " has been temporarily restricted ]"); //FrmScrapGroupMember.ChangeToNextAccount = true; } else { Log("[ " + DateTime.Now + " ] => [ NotLogged In With Account : " + accountUser + " ]"); //FrmScrapGroupMember.ChangeToNextAccount = true; GlobusFileHelper.AppendStringToTextfileNewLine(CheckedAccount, Globals.Path_NonWorkingAccount_AccountChecker); } } catch (Exception ex) { } }
public void LoginHttpHelper(ref GlobusHttpHelper HttpHelper, string userName, string password, string Proxyaddress, string ProxyUserName, string ProxyPass, string port) { try { this.accountUser = userName; this.accountPass = password; this.proxyAddress = Proxyaddress; this.proxyPassword = ProxyPass; this.proxyUserName = ProxyUserName; this.proxyPort = port; Log("[ " + DateTime.Now + " ] => [ Logging In With : " + accountUser + " ]"); Log("[ " + DateTime.Now + " ] => [ Login Process is Running... ]"); Url = "https://www.linkedin.com/"; string pageSrcLogin = string.Empty; if (string.IsNullOrEmpty(proxyPort)) { proxyPort = (0).ToString(); } pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, Convert.ToInt32(proxyPort), proxyUserName, proxyPassword); string postdata = string.Empty; string postUrl = string.Empty; string ResLogin = string.Empty; string csrfToken = string.Empty; string sourceAlias = string.Empty; if (pageSrcLogin.Contains("csrfToken")) { int startCsrfToken = pageSrcLogin.IndexOf("name=\"csrfToken\""); if (startCsrfToken > 0) { string startcsrfToken = pageSrcLogin.Substring(startCsrfToken).Replace("name=\"csrfToken\"", "").Replace("value=\"", ""); int endCsrfToken = startcsrfToken.IndexOf("\""); string endcsrftoken = startcsrfToken.Substring(0, endCsrfToken); csrfToken = endcsrftoken.Replace(@"\", string.Empty).Replace("//", string.Empty).Replace(" ", ""); } } if (pageSrcLogin.Contains("sourceAlias")) { sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100); string[] Arr = sourceAlias.Split('"'); sourceAlias = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty); } postUrl = "https://www.linkedin.com/uas/login-submit"; postdata = "session_key=" + accountUser + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; //ResLogin = HttpHelper.postFormData(new Uri(postUrl), postdata); ResLogin = HttpHelper.postFormDataProxy(new Uri(postUrl), postdata, proxyAddress, int.Parse(proxyPort), proxyUserName, proxyPassword); if (ResLogin.Contains("Sign Out") && ResLogin.Contains("class=\"signout\"")) { IsLoggedIn = true; Log("[ " + DateTime.Now + " ] => [ Logged In With Account : " + accountUser + " ]"); string Search = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search?trk=advsrch")); SearchCriteria.loginREsponce = Search; } #region MyRegion //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top"; //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, 888, proxyUserName, proxyPassword); //LogoutHttpHelper(ref HttpHelper); //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top"; //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, 888, proxyUserName, proxyPassword); #endregion } catch (Exception ex) { } }
public void ResendConfirmation(ref GlobusHttpHelper HttpHelper) { string postdata = string.Empty; string postUrl = string.Empty; string ResLogin = string.Empty; string csrfToken = string.Empty; string emailid = string.Empty; try { Log("[ " + DateTime.Now + " ] => [ Starting Sending Invitation To Account : " + accountUser + " ]"); if (!NumberHelper.ValidateNumber(proxyPort)) { proxyPort = "0"; } string GetHomePageSOurce = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/settings/manage-email?goback=%2Enas_*1_*1_*1%2Enas_profile_nsettings*5manage*5email_*1"), proxyAddress, int.Parse(proxyPort), proxyUserName, proxyPassword); string LinkToVerfiy = string.Empty; if (GetHomePageSOurce.Contains(accountUser) && !GetHomePageSOurce.Contains("Primary address")) //if (GetHomePageSOurce.Contains(accountUser)) { try { if (GetHomePageSOurce.Contains("csrfToken")) { csrfToken = GetHomePageSOurce.Substring(GetHomePageSOurce.IndexOf("csrfToken"), 100); string[] Arr = csrfToken.Split('"'); try { csrfToken = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty); } catch (Exception ex) { csrfToken = Arr[0].Replace("csrfToken=", "").Replace("\\", ""); } try { if (csrfToken.Contains("&")) { string[] Arr1 = csrfToken.Split('&'); csrfToken = Arr1[0].Replace("\"", string.Empty); } } catch { } } if (GetHomePageSOurce.Contains("entry primary") || GetHomePageSOurce.Contains("CHOOSE YOUR PRIMARY EMAIL ADDRESS")) { try { emailid = GetHomePageSOurce.Substring(GetHomePageSOurce.IndexOf("truncated-"), (GetHomePageSOurce.IndexOf("callout-content") - GetHomePageSOurce.IndexOf("truncated-"))); emailid = emailid.Replace("truncated-", string.Empty).Replace(">",string.Empty).Replace("class=",string.Empty).Replace("callout-container",string.Empty).Replace("email",string.Empty).Replace("style=",string.Empty).Replace("display: none",string.Empty).Replace("\"",string.Empty).Replace("\n",string.Empty).Replace("<div",string.Empty).Trim(); } catch { } } postdata = "https://www.linkedin.com/settings/manageEmailConfirmation-submit?emailID=" + emailid.Replace(" ", "") + "&csrfToken=" + csrfToken + "&goback=%2Enas_*1_*1_*1%2Enas_*1_*1_*1%2Enas_profile_nsettings*5manage*5email_*1"; ResLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(postdata), proxyAddress, int.Parse(proxyPort), proxyUserName, proxyPassword); if (ResLogin.Contains("We've sent a confirmation email to") || ResLogin.Contains("\"status\":\"ok\"}") || ResLogin.Contains("find the email from LinkedIn, and click the confirm button")) { Log("[ " + DateTime.Now + " ] => [ Resent Confirmation To Account : " + accountUser + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_ResentVerfication); } else { Log("[ " + DateTime.Now + " ] => [ Confirmation Not Sent To Account : " + accountUser + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NonResentVerfication); } } catch (Exception ex) { Log("[ " + DateTime.Now + " ] => [ Error in Sending Confirmation , Not Sent To Account : " + accountUser + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NonResentVerfication); } } else { Log("[ " + DateTime.Now + " ] => [ Email Already Verfied For Account : " + accountUser + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NonResentVerfication); } } catch (Exception ex) { Log("[ " + DateTime.Now + " ] => [ Error in Sending Confirmation , Not Sent To Account : " + accountUser + " ]"); GlobusFileHelper.AppendStringToTextfileNewLine(accountUser + ":" + accountPass + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUserName + ":" + proxyPassword, Globals.path_NonResentVerfication); } Log("[ " + DateTime.Now + " ] => [ PROCESS COMPLETED With Account : " + accountUser + " ]"); Log("-----------------------------------------------------------------------------------------------------------------------------------"); }
private string GetCaptch(string TempCreatingAccountPageSource) { string captcha = string.Empty; try { string GetURLforcaptcha = string.Empty; string CaptchaChallenge = string.Empty; string proxyAddress = string.Empty; string ProxyPort = "0"; string proxyUsername = string.Empty; string proxyPassword = string.Empty; GlobusHttpHelper GlobusHttpHelper = new GlobusHttpHelper(); #region GetURLCapcha if (TempCreatingAccountPageSource.Contains("https://www.google.com/recaptcha/api/challenge")) { try { string CaptchaReq = TempCreatingAccountPageSource.Substring(TempCreatingAccountPageSource.IndexOf("https://www.google.com/recaptcha/api/challenge"), 120); string[] CaptchaReqIDArrry = CaptchaReq.Split('"'); GetURLforcaptcha = CaptchaReqIDArrry[0]; } catch { } } #endregion #region CapchaChallenge if (!string.IsNullOrEmpty(GetURLforcaptcha)) { string PagesourceForCapchafterGetreq = GlobusHttpHelper.getHtmlfromUrlProxy(new Uri(GetURLforcaptcha), proxyAddress, Convert.ToInt32(ProxyPort), proxyUsername, proxyPassword); if (PagesourceForCapchafterGetreq.Contains("challenge :")) { try { int startIndx = PagesourceForCapchafterGetreq.IndexOf("challenge :") + "challenge :".Length; int endIndx = PagesourceForCapchafterGetreq.IndexOf("'", startIndx + 10); CaptchaChallenge = PagesourceForCapchafterGetreq.Substring(startIndx, endIndx - startIndx).Replace("'", "").Trim(); //string CaptchaSecondReq = PagesourceForCapchafterGetreq.Substring(PagesourceForCapchafterGetreq.IndexOf("challenge :"), PagesourceForCapchafterGetreq.IndexOf("'", PagesourceForCapchafterGetreq.IndexOf("challenge :") + 10)); ////string[] CaptchaSecondReqIDArrry = CaptchaSecondReq.Split(','); //CaptchaChallenge = CaptchaSecondReq.Replace("challenge : ", "").Replace("'", ""); } catch { } } } #endregion if (!string.IsNullOrEmpty(GetURLforcaptcha)) { #region For With Capcha Account Creation try { string abc = "https://www.google.com/recaptcha/api/image?c=" + CaptchaChallenge; //string TepGetCapcha = GlobusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.google.com/recaptcha/api/image?c="+CaptchaChallenge), proxyAddress, ProxyPort, proxyUsername, proxyPassword); //for decaptcha.. int count_refreshcaptcha = 0; WebClient webclient = new WebClient(); byte[] args = webclient.DownloadData(abc); string captchaText = string.Empty; string[] arr1 = new string[] { Globals.CapchaLoginID, Globals.CapchaLoginPassword, "" }; captchaText = DecodeDBC(arr1, args); captcha = captchaText; } catch { } #endregion } } catch { } return captcha; }
//New method added by Lijo John 16/10/2014 public bool CheckProxy(string IPAddress, int Port, string Username, string Password, string URL) { GlobusHttpHelper objGlobusHttpHelper = new GlobusHttpHelper(); bool status = false; try { System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch(); string ResponseTime = string.Empty; timer.Start(); string Response = objGlobusHttpHelper.getHtmlfromUrlProxy(new Uri(URL),IPAddress,Port,Username,Password); timer.Stop(); TimeSpan timeTaken = timer.Elapsed; ResponseTime = timeTaken.ToString(); if (string.IsNullOrEmpty(Response)) { timeTaken = new TimeSpan(); timer.Start(); Response = objGlobusHttpHelper.getHtmlfromUrlProxy(new Uri(URL), IPAddress, Port, Username, Password); timer.Stop(); timeTaken = timer.Elapsed; ResponseTime = timeTaken.ToString(); } if (!string.IsNullOrEmpty(Response) && !Response.Contains("Internet Explorer cannot display the webpage")) { status = true; } else { status = false; } } catch (Exception ex) { GlobusLogHelper.log.Error(ex.StackTrace); } return status; }
public void LoginHttpHelper(ref GlobusHttpHelper HttpHelper) { try { Log("[ " + DateTime.Now + " ] => [ Logging In With : " + _Username + " ]"); Log("[ " + DateTime.Now + " ] => [ Login Process is Running... ]"); //Check Login if (IsLoggedIn) { try { string homePage = HttpHelper.getHtmlfromUrlProxy(new Uri("http://www.linkedin.com/home"), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword); if (homePage.Contains("Sign Out") && homePage.Contains("class=\"signout\"") && !homePage.Contains("Your LinkedIn account has been temporarily restricted")) { Log("[ " + DateTime.Now + " ] => [ Already Logged In With : " + _Username + " ]"); return; } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } string Url = "https://www.linkedin.com/"; ////string pageSrcLogin = HttpChilkat.GetHtmlProxy(Url, proxyAddress, proxyPort, proxyUserName, proxyPassword); string pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword); if (string.IsNullOrEmpty(pageSrcLogin)) { try { System.Threading.Thread.Sleep(1000); pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyAddress, int.Parse(_ProxyPort), _ProxyUsername, _ProxyPassword, ""); } catch { } } if (string.IsNullOrEmpty(pageSrcLogin)) { Log("[ " + DateTime.Now + " ] => [ Couldn't Login In With : " + _Username + " ]"); return; } string postdata = string.Empty; string postUrl = string.Empty; string ResLogin = string.Empty; string csrfToken = string.Empty; string sourceAlias = string.Empty; string regCsrfParam = string.Empty; if (pageSrcLogin.Contains("csrfToken")) { try { int startindex = pageSrcLogin.IndexOf("name=\"csrfToken\""); if (startindex > 0) { string start = pageSrcLogin.Substring(startindex).Replace("name=\"csrfToken\"", ""); int endindex = start.IndexOf("\" "); string end = start.Substring(0, endindex); csrfToken = end.Replace("value=\"", "").Replace("\\", "").Replace(" ", ""); csrfToken = Uri.EscapeDataString(csrfToken); } else { string[] Arr = csrfToken.Split('"'); csrfToken = Arr[2].Replace("\\", string.Empty); } } catch { try { csrfToken = pageSrcLogin.Substring(pageSrcLogin.IndexOf("csrfToken"), 100); if (csrfToken.Contains("&")) { string[] Arr = csrfToken.Split('&'); csrfToken = Arr[0]; } else if (csrfToken.Contains(",")) { string[] Arr = csrfToken.Split(','); csrfToken = Arr[0].Replace("\\", string.Empty); } else { string[] Arr = csrfToken.Split(','); csrfToken = Arr[0].Replace("\\", string.Empty).Replace("csrfToken=", "").Replace("\n", "").Replace("\">", ""); } } catch { } } } try { if (csrfToken.Contains("&")) { string[] Arr1 = csrfToken.Split('&'); csrfToken = Arr1[0].Replace("\"", string.Empty); } } catch { } SearchCriteria.CsrToken = csrfToken.Replace("\n", "").Replace("//", "").Replace("\">", "").Replace("csrfToken=", ""); if (pageSrcLogin.Contains("sourceAlias")) { try { sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100); string[] Arr = sourceAlias.Split('"'); sourceAlias = Arr[2].Replace("\\", string.Empty); } catch { } } try { int SourceAliasStart = pageSrcLogin.IndexOf("regCsrfParam"); if (SourceAliasStart > 0) { try { regCsrfParam = pageSrcLogin.Substring(pageSrcLogin.IndexOf("regCsrfParam"), 100); string[] Arr = regCsrfParam.Split('"'); regCsrfParam = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty); } catch { } } } catch { } postUrl = "https://www.linkedin.com/uas/login-submit"; //postdata = "isJsEnabled=true&source_app=&tryCount=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&loginCsrfParam=" + regCsrfParam + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; postdata = "isJsEnabled=true&source_app=&tryCount=&clickedSuggestion=false&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&trk=hb_signin&loginCsrfParam=" + regCsrfParam + "&fromEmail=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; // postdata = "isJsEnabled=true&source_app=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign+In&session_redirect=&trk=&loginCsrfParam=7462d247-6d54-47de-8f22-29723ea15f9d&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; try { ResLogin = HttpHelper.postFormDataProxy(new Uri(postUrl), postdata,_ProxyAddress,int.Parse(_ProxyPort),_ProxyUsername,_ProxyPassword);//HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "http://www.linkedin.com/uas/login?goback=&trk=hb_signin", "", ""); } catch { } //postUrl = "https://www.linkedin.com/uas/login-submit"; //isJsEnabled=true&source_app=&tryCount=&session_key=gargimishra%40globussoft.com&session_password=globussoft&signin=Sign%20In&session_redirect=&csrfToken=ajax%3A7066152446927176852&sourceAlias=0_7r5yezRXCiA_H0CRD8sf6DhOjTKUNps5xGTqeX8EEoi //postdata = "isJsEnabled=true&source_app=&session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&signin=Sign%20In&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; // postdata = "session_key=" + Uri.EscapeDataString(_Username) + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; //ResLogin = HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "https://www.linkedin.com/uas/login?goback=&trk=hb_signin", "true", ""); string dts = string.Empty; string captchachallengeid = string.Empty; string origActionAlias = string.Empty; string origSourceAlias = string.Empty; string irhf = string.Empty; string captchaText = string.Empty; string ImageUrl = string.Empty; // if (ResLogin.Contains("Your LinkedIn account has been temporarily restricted") || ResLogin.Contains("Change your password") || ResLogin.Contains("Please confirm your email address") && !ResLogin.Contains("Sign Out")) { SearchCriteria.loginREsponce = ResLogin; } else if (ResLogin.Contains("Security Verification")) { string dataforcapctha = HttpHelper.getHtmlfromUrl1(new Uri("https://www.google.com/recaptcha/api/noscript?k=6LcnacMSAAAAADoIuYvLUHSNLXdgUcq-jjqjBo5n")); if (!string.IsNullOrEmpty(dataforcapctha)) { int startindex = dataforcapctha.IndexOf("id=\"recaptcha_challenge_field\""); if (startindex > 0) { string start = dataforcapctha.Substring(startindex).Replace("id=\"recaptcha_challenge_field\"", ""); int endindex = start.IndexOf("\">"); string end = start.Substring(0, endindex).Replace("value=", "").Replace("\"", ""); ImageUrl = "https://www.google.com/recaptcha/api/image?c=" + end; WebClient webclient = new WebClient(); byte[] args = webclient.DownloadData(ImageUrl); string[] arr1 = new string[] { Globals.CapchaLoginID, Globals.CapchaLoginPassword, "" }; captchaText = DecodeDBC(arr1, args); } if (ResLogin.Contains("name=\"security-challenge-id\"")) { int startindexnew = ResLogin.IndexOf("name=\"security-challenge-id\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"security-challenge-id\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); captchachallengeid = end.Replace("\"", ""); } } if (ResLogin.Contains("name=\"dts\"")) { int startindexnew = ResLogin.IndexOf("name=\"dts\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"dts\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); dts = end.Replace("\"", ""); } } if (ResLogin.Contains("name=\"origActionAlias\"")) { int startindexnew = ResLogin.IndexOf("name=\"origActionAlias\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"origActionAlias\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); origActionAlias = end.Replace("\"", ""); } } if (ResLogin.Contains("name=\"origSourceAlias\"")) { int startindexnew = ResLogin.IndexOf("name=\"origSourceAlias\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"origSourceAlias\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); origSourceAlias = end.Replace("\"", ""); } } if (ResLogin.Contains("name=\"irhf\"")) { int startindexnew = ResLogin.IndexOf("name=\"irhf\""); if (startindexnew > 0) { string start = ResLogin.Substring(startindexnew).Replace("name=\"irhf\"", "").Replace("value=\"", ""); int endindex = start.IndexOf("\""); string end = start.Substring(0, endindex); irhf = end.Replace("\"", ""); } } //postdata = "dts=" + dts + "&security-challenge-id=" + captchachallengeid + "&hr=&source_app=&csrfToken=" + csrfToken + "&trk=guest_home&isJsEnabled=true&session_redirect=&session_password="******"&session_key=" + _Username + "&origSourceAlias=" + origSourceAlias + "&origActionAlias=" + origActionAlias + "&irhf=" + irhf +"&sourceAlias=" + sourceAlias; if (!string.IsNullOrEmpty(ImageUrl) && !string.IsNullOrEmpty(captchaText)) { postdata = "recaptcha_challenge_field=" + ImageUrl.Replace("https://www.google.com/recaptcha/api/image?c=", "") + "&recaptcha_response_field=" + captchaText.Replace(" ", "+") + "&dts=" + dts + "&security-challenge-id=" + captchachallengeid + "&hr=&source_app=&csrfToken=" + csrfToken + "&isJsEnabled=true&session_redirect=&session_password="******"&session_key=" + Uri.EscapeDataString(_Username) + "&origSourceAlias=" + origSourceAlias + "&origActionAlias=" + origActionAlias + "&irhf=" + irhf + "&sourceAlias=" + sourceAlias; postdata = postdata.Replace(" ", ""); ResLogin = HttpHelper.postFormDataRef(new Uri("https://www.linkedin.com/uas/captcha-submit"), postdata, "https://www.linkedin.com/uas/login-submit", "", "", "", "", ""); } else { ResLogin = ""; } if (ResLogin.Contains("The text you entered does not match the characters in the security image. Please try again with this new image") || string.IsNullOrEmpty(ResLogin)) { Log("[ " + DateTime.Now + " ] => [ " + _Username + " Cannot Login because of Capctcha ]"); GlobusFileHelper.WriteStringToTextfile(_Username + ":" + _Password + ":" + _ProxyAddress + ":" + _ProxyPort + ":" + _ProxyUsername + ":" + _ProxyPassword, Globals.pathCapcthaLogin); SearchCriteria.loginREsponce = string.Empty; } } } //ResLogin.Contains("Sign Out") && ResLogin.Contains("class=\"signout\"") && !ResLogin.Contains("Your LinkedIn account has been temporarily restricted") if (ResLogin.Contains("Sign Out") && !ResLogin.Contains("Your LinkedIn account has been temporarily restricted")) { SearchCriteria.loginREsponce = string.Empty; IsLoggedIn = true; string Search = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search?trk=advsrch")); SearchCriteria.loginREsponce = Search; } else if (ResLogin.Contains("logout?session_full_logout")) { SearchCriteria.loginREsponce = string.Empty; IsLoggedIn = true; string Search = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/search?trk=advsrch")); SearchCriteria.loginREsponce = Search; } else { //There was an unexpected problem that prevented us from completing your request. SearchCriteria.loginREsponce = string.Empty; IsLoggedIn = false; } //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top"; //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, 888, proxyUserName, proxyPassword); //LogoutHttpHelper(ref HttpHelper); //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top"; //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, 888, proxyUserName, proxyPassword); } catch { } }
public bool LoginHttpHelper(string username, string password, string proxyaddress, string proxyport, string proxyusername, string proxypassword, ref GlobusHttpHelper HttpHelper, ref string Message) { bool isLoggin = false; try { // LoggerLoginLogout("Logging Block............."); string Url = string.Empty; int port = 888; Regex PortCheck = new Regex("^[0-9]*$"); _AccountUser = username; _AccountPass = password; _ProxyAddress = proxyaddress; _ProxyPort = proxyport; _ProxyUserName = proxyusername; _ProxyPassword = proxypassword; if (PortCheck.IsMatch(_ProxyPort) && !string.IsNullOrEmpty(_ProxyPort)) { port = int.Parse(_ProxyPort); } if (string.IsNullOrEmpty(_ProxyPort)) { _ProxyPort = "0"; } Url = "https://www.linkedin.com/"; // string pageSrcLogin = HttpChilkat.GetHtmlProxy(Url, proxyAddress, proxyPort, proxyUserName, proxyPassword); string pageSrcLogin = string.Empty; try { pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyAddress, (port), _ProxyUserName, _ProxyPassword);//HttpHelper.getHtmlfromUrl(new Uri(Url)); } catch { } string postdata = string.Empty; string postUrl = string.Empty; string ResLogin = string.Empty; string csrfToken = string.Empty; string sourceAlias = string.Empty; string regCsrfParam = string.Empty; #region commented //if (pageSrcLogin.Contains("csrfToken")) //{ // try // { // csrfToken = pageSrcLogin.Substring(pageSrcLogin.IndexOf("csrfToken"), 100); // string[] Arr = csrfToken.Split('"'); // csrfToken = Arr[2].Replace("\\",string.Empty).Replace("\"",string.Empty).Trim(); // } // catch // { // try // { // csrfToken = pageSrcLogin.Substring(pageSrcLogin.IndexOf("csrfToken"), 100); // string[] Arr = csrfToken.Split('&'); // csrfToken = Arr[0].Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("csrfToken=", "").Replace(">",string.Empty).Trim(); // } // catch // { // try // { // csrfToken = pageSrcLogin.Substring(pageSrcLogin.IndexOf("csrfToken"), 100); // string[] Arr = csrfToken.Split(','); // csrfToken = Arr[0].Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("csrfToken=", "").Replace(">", string.Empty).Trim(); // } // catch { } // } // } //} //if (csrfToken.Contains(">") && csrfToken.Contains("csrfToken=")) //{ // try // { // csrfToken = csrfToken.Substring(csrfToken.IndexOf("ajax"), csrfToken.IndexOf(">") - csrfToken.IndexOf("ajax")).Replace("csrfToken=", "").Trim(); // } // catch { } //} //if (pageSrcLogin.Contains("sourceAlias")) //{ // try // { // sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100); // string[] Arr = sourceAlias.Split('"'); // sourceAlias = Arr[2].Replace("\\", string.Empty).Replace("\"", string.Empty).Trim(); // } // catch { } //} ////_AccountUser = "******"; ////_AccountPass = "******"; ////_AccountUser = "******"; // _AccountUser = Uri.EscapeDataString(_AccountUser); //postUrl = "https://www.linkedin.com/uas/login-submit"; ////postdata = "session_key=" + _AccountUser + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; //postdata = "session_key=" + _AccountUser + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; #endregion if (pageSrcLogin.Contains("csrfToken")) { try { int startIndex = pageSrcLogin.IndexOf("name=\"csrfToken\""); string start = pageSrcLogin.Substring(startIndex).Replace("name=\"csrfToken\"", ""); int endIndex = start.IndexOf("\" "); string end = start.Substring(0, endIndex).Replace("value=\"", "").Trim(); csrfToken = end; } catch (Exception ex) { } } try { if (csrfToken.Contains("&")) { string[] Arr = csrfToken.Split('&'); csrfToken = Arr[0].Replace("\"", string.Empty); } } catch { } if (pageSrcLogin.Contains("sourceAlias")) { sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100); string[] Arr = sourceAlias.Split('"'); sourceAlias = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty).Trim(); } try { int SourceAliasStart = pageSrcLogin.IndexOf("regCsrfParam"); if (SourceAliasStart > 0) { try { regCsrfParam = pageSrcLogin.Substring(pageSrcLogin.IndexOf("regCsrfParam"), 100); string[] Arr = regCsrfParam.Split('"'); regCsrfParam = Arr[2].Replace(@"\", string.Empty).Replace("//", string.Empty); } catch { } } } catch { } postUrl = "https://www.linkedin.com/uas/login-submit"; postdata = "isJsEnabled=true&source_app=&tryCount=&session_key=" + Uri.EscapeDataString(_AccountUser) + "&session_password="******"&signin=Sign%20In&session_redirect=&loginCsrfParam=" + regCsrfParam + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias; try { ResLogin = HttpHelper.postFormDataProxy(new Uri(postUrl), postdata, _ProxyAddress, int.Parse(_ProxyPort), _ProxyUserName, _ProxyPassword);//HttpHelper.postFormDataRef(new Uri(postUrl), postdata, "http://www.linkedin.com/uas/login?goback=&trk=hb_signin", "", ""); } catch { } if (ResLogin.Contains("The email address or password you provided does not match our records")) { GlobusFileHelper.WriteStringToTextfile(_AccountUser + ":" + _AccountPass + ":" + _ProxyAddress + ":" + _ProxyPort + ":" + _ProxyUserName + ":" + _ProxyPassword, Globals.path_FailLogin); Message = "The email address or password does not match our records"; return false; } else if (ResLogin.Contains("Sign Out") && ResLogin.Contains("Profiles")) { Message = "Logged in"; return true; } else if (ResLogin.Contains("Your LinkedIn account has been temporarily restricted")) { Message = "Your LinkedIn account has been temporarily restricted"; return false; } else if (ResLogin.Contains("Sign Out")) { Message = "Logged in"; return true; } else if (ResLogin.Contains("This login attempt seems suspicious") || ResLogin.Contains("Please enter the verification code sent to the email")) { GlobusFileHelper.WriteStringToTextfile(_AccountUser + ":" + _AccountPass + ":" + _ProxyAddress + ":" + _ProxyPort + ":" + _ProxyUserName + ":" + _ProxyPassword, Globals.path_FailLogin); Message = "This login attempt seems suspicious.Please enter the verification code sent to the email."; return false; } else { Message = "Couldn't Login"; GlobusFileHelper.WriteStringToTextfile(_AccountUser + ":" + _AccountPass + ":" + _ProxyAddress + ":" + _ProxyPort + ":" + _ProxyUserName + ":" + _ProxyPassword, Globals.path_FailLogin); return false; } //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top"; //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyPassword, port, _ProxyUserName, _ProxyPassword); //LogoutHttpHelper(ref HttpHelper); //Url = "http://www.linkedin.com/home?trk=hb_tab_home_top"; //pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), _ProxyPassword, 888, _ProxyUserName, _ProxyPassword); //return true; } catch { } return isLoggin; }
public void EndorsingPeople(ref GlobusHttpHelper HttpHelper, string UserId) { try { int count = 0; int ProxyPort = 0; if (!string.IsNullOrEmpty(proxyPort) && NumberHelper.ValidateNumber(proxyPort)) { ProxyPort = Convert.ToInt32(proxyPort); } string EndorseLink = string.Empty; string modelNo = string.Empty; string csrfToken = string.Empty; string postdata = string.Empty; string _ed = string.Empty; string endorseUrl = string.Empty; string Link = string.Empty; string LinkSource = string.Empty; string PageSourceProfile = string.Empty; try { Globals.tempDict.Add(UserId, ""); Log("[ " + DateTime.Now + " ] => [ Starting Getting Member Details For User Id Link - :" + UserId + " With : " + Username + " ]"); } catch { } if (!UserId.Contains("http")) { Link = "http://www.linkedin.com/people/conn-details?i=&contactMemberID=" + UserId; PageSourceProfile = HttpHelper.getHtmlfromUrlProxy(new Uri(Link), proxyAddress, 0, proxyUsername, proxyPassword); try { int startindex = PageSourceProfile.IndexOf("/profile/view?id="); if (startindex > 0) { string start = PageSourceProfile.Substring(startindex); int endIndex = start.IndexOf("\">"); string end = start.Substring(0, endIndex).Replace("\\", "").Replace("&", "&"); if (end.Contains("&trk")) { end = end.Split('&')[0].ToString(); } LinkSource = "http://www.linkedin.com" + end; } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->EndorsingPeople() --> LinkSource >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> EndorsingPeople() --> LinkSource >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_EndorsePeople); } if (string.IsNullOrEmpty(UserId)) { try { Globals.tempDict.Add(UserId, ""); Log("[ " + DateTime.Now + " ] => [ Cannot Find Data For Userid : " + UserId + " From " + Username + " ]"); return; } catch { } } PageSourceProfile = HttpHelper.getHtmlfromUrlProxy(new Uri(LinkSource), proxyAddress, 0, proxyUsername, proxyPassword); } else { Link = UserId; PageSourceProfile = HttpHelper.getHtmlfromUrlProxy(new Uri(Link), proxyAddress, 0, proxyUsername, proxyPassword); } if (PageSourceProfile.Contains("csrfToken")) { csrfToken = PageSourceProfile.Substring(PageSourceProfile.IndexOf("csrfToken"), 100); string[] Arr = csrfToken.Split('&'); try { csrfToken = Arr[0].Replace("csrfToken=", "").Replace("\\", ""); csrfToken = csrfToken.Split('>')[0].Replace(">", string.Empty).Replace("\"",string.Empty); } catch (Exception ex) { csrfToken = Arr[0].Replace("csrfToken=", "").Replace("\\", ""); } //csrfToken if (csrfToken.Contains("updateTagsUrl")) { csrfToken = csrfToken.Split(',')[0].ToString(); } } Dictionary<string, string> lstskilldata = new Dictionary<string, string>(); if (PageSourceProfile.Contains("/profile/unendorse?_ed=")) { _ed = Utils.getBetween(PageSourceProfile, "/profile/unendorse?_ed=", "&"); } if (PageSourceProfile.Contains("endorseURL:")) { endorseUrl = Utils.getBetween(PageSourceProfile, "endorseURL:", ",").Replace("\\","").Replace("'","").Trim(); endorseUrl = "https://www.linkedin.com"+endorseUrl; } try { string[] arr = Regex.Split(PageSourceProfile, "fmt__skill_name\":"); arr = arr.Skip(1).ToArray(); foreach (string item in arr) { string SkillName = string.Empty; string SkillId = string.Empty; if (!item.Contains("viewerEndorsementId\":")) { if (item.Contains("id\":")) { SkillName = Utils.getBetween(item, "", ",").Replace("\\u002d", "-").Replace("\"", "").Replace(",", "").Replace("&", "&").Replace("}", "").Trim(); //SkillId = Utils.getBetween(item, "id\":", ",").Replace("\"", "").Replace(",", "").Replace("&", "&").Replace("}", "").Replace("\u002d", "-").Trim(); lstskilldata.Add(SkillName, SkillName); } } } if (lstskilldata.Count == 0) { arr = Regex.Split(PageSourceProfile, "data-endorsed-item-name=\""); arr = arr.Skip(1).ToArray(); foreach (string item in arr) { if (EndorsePeople.no_of_Skils == lstskilldata.Count) { if (EndorsePeople.no_of_Skils == 0 && lstskilldata.Count == 0) { } else { break; } } string SkillName = string.Empty; string SkillId = string.Empty; if (!item.Contains("endorse-item has-endorsements endorsed-by-viewer")) { //if (item.Contains("id\":")) { SkillName = Utils.getBetween(item, "", "\"").Replace("\\u002d", "-").Replace("\"", "").Replace(",", "").Replace("&", "&").Replace("}", "").Trim(); //SkillId = Utils.getBetween(item, "id\":", ",").Replace("\"", "").Replace(",", "").Replace("&", "&").Replace("}", "").Replace("\u002d", "-").Trim(); lstskilldata.Add(SkillName, SkillName); } } } } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->EndorsingPeople() --> lstskilldata Data >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> EndorsingPeople() --> lstskilldata Data >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_EndorsePeople); } try { string _UserId = string.Empty; if (lstskilldata.Count > 0) { foreach (KeyValuePair<string, string> item in lstskilldata) { if (count > 4) { return; } if (!UserId.Contains("http")) { _UserId = UserId; } else { _UserId = Utils.getBetween(UserId+"@", "&id=", "@"); if (string.IsNullOrEmpty(_UserId)) { _UserId = Utils.getBetween(UserId + "@", "?id=", "@"); } //_UserId = UserId.Substring(UserId.IndexOf("&id=")).Replace("&id=", string.Empty); } postdata = "endorsementCount=1&recipientId-0=" + _UserId + "&recipientType-0=member&endorsedItemName-0=" + Uri.EscapeDataString(item.Key) + "&endorsementId-0=&endorserIds-0="; string PostUrl = "http://www.linkedin.com/profile/endorse?csrfToken=" + csrfToken + "&_ed=" + _ed + "&goback=%2Enpv_" + UserId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_contacts*5contacts*5list*5contact*4name*50_*1"; string PostPageSource = HttpHelper.postFormDataRef(new Uri(endorseUrl), postdata, LinkSource, "", "", "", "", "1"); if (!PostPageSource.Contains("fail") || !PostPageSource.Contains("failure")) { string[] ArrayPostedData = System.Text.RegularExpressions.Regex.Split(PostPageSource, "}"); //ArrayPostedData = ArrayPostedData.Skip(1).ToArray(); foreach (string itemdata in ArrayPostedData) { foreach (KeyValuePair<string, string> item1 in lstskilldata) { if (itemdata.Contains(item1.Key)) { string status = string.Empty; try { //int startindex = itemdata.IndexOf("endorsementStatus\":\""); int startindex = PostPageSource.IndexOf("status"); if (startindex >= 0) { //string start = itemdata.Substring(startindex).Replace("endorsementStatus\":\"", ""); //int endIndex = start.IndexOf("\",\""); //string end = start.Substring(0, endIndex).Replace("&", "&"); //status = end; string start = PostPageSource.Substring(startindex).Replace("status", ""); int endIndex = start.IndexOf("}"); string end = start.Substring(0, endIndex).Replace("\"", string.Empty).Replace(":", string.Empty); status = end; string CSVHeader = "UserID" + "," + "Skill" + "," + "Status" + "," + "EndorseID"; //New Addedd string CSV_Content = Username + "," + item1.Key + "," + status + "," + UserId; //new adde CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_EndorsedPeopleText); Log("[ " + DateTime.Now + " ] => [ Status For Skill : " + item1.Key + " ==> " + status + " ]"); } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->EndorsingPeople() --> PostPageSource posted correct >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> EndorsingPeople() --> PostPageSource posted correct >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_EndorsePeople); } } } } } else { string CSVHeader = "UserID" + "," + "Status" + "," + "EndorseID"; string CSV_Content = Username + "," + "Failure" + "," + UserId; CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_NotEndorsedPeopleText); GlobusFileHelper.AppendStringToTextfileNewLine(Username + ",Failure", Globals.path_NotEndorsedPeopleText); Log("[ " + DateTime.Now + " ] => [ Failure for User id : " + item.Key + " -> " + _UserId + " ]"); } count++; } } else { Log("[ " + DateTime.Now + " ] => [ No skills found for User id " + _UserId + " ]"); } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->EndorsingPeople() --> postdata >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> EndorsingPeople() --> postdata >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_EndorsePeople); } } catch (Exception ex) { GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> EndorsingPeople() --> Full Data >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs); GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> EndorsingPeople() --> Full Data >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_EndorsePeople); } }
private void StartActionVerifyAccount(ref InstagramUser IgUser) { lock (this) { try { if (isStopVerifingAccount) { return; } try { listOfWorkingThread.Add(Thread.CurrentThread); listOfWorkingThread = listOfWorkingThread.Distinct().ToList(); Thread.CurrentThread.IsBackground = true; } catch (Exception ex) { GlobusLogHelper.log.Error("Error ==> " + ex.Message); } if (listOfAccount.Count > 0) { //if (string.IsNullOrEmpty(usernameOfAPI) || string.IsNullOrEmpty(passwordOfAPI)) //{ // // GlobusLogHelper.log.Info("Please Enter Username And Password Of API"); //} //else { if (string.IsNullOrEmpty(IgUser.proxyport)) { IgUser.proxyport = "80"; } /// login to Api /// string homePageResponse = IgUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.instagram.com/"), IgUser.proxyip, int.Parse(IgUser.proxyport), IgUser.proxyusername, IgUser.proxypassword); //https://www.instagram.com/integrity/checkpoint/?next=%2F string securityCheckPagesource = IgUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.instagram.com/integrity/checkpoint/?next=%2F"), IgUser.proxyip, int.Parse(IgUser.proxyport), IgUser.proxyusername, IgUser.proxypassword); if (securityCheckPagesource.Contains("Enter your phone number. We'll text you a security code to make sure it's you.")) { startAgain: GlobusHttpHelper objGlobusshttphelper = new GlobusHttpHelper(); Queue<string> queueOfMobileNo = new Queue<string>(); Queue<string> queueOfMobileNoUrl = new Queue<string>(); string MobileNoHomePageSource = objGlobusshttphelper.getHtmlfromUrlProxy(new Uri("http://www.receive-sms-online.info/"), IgUser.proxyip, int.Parse(IgUser.proxyport), IgUser.proxyusername, IgUser.proxypassword); try { string[] getAllNumberDetails = System.Text.RegularExpressions.Regex.Split(MobileNoHomePageSource, "<a href="); if (getAllNumberDetails.Count() > 0) { foreach (string item in getAllNumberDetails) { if (item.Contains("read-sms.php") && item.Contains("Receive SMS USA")) { string mobileNo = string.Empty; string mobileNourl = string.Empty; mobileNourl = "http://www.receive-sms-online.info/" + Utils.getBetween(item, "\"", "\""); mobileNo = Utils.getBetween(item, "phone=", "\""); queueOfMobileNoUrl.Enqueue(mobileNourl); queueOfMobileNo.Enqueue(mobileNo); } else { continue; } } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.Message); } if (queueOfMobileNoUrl.Count > 0) { foreach (string item in queueOfMobileNoUrl) { try { string phoneNo = queueOfMobileNo.Dequeue(); string getcsrfmiddlewaretoken = Utils.getBetween(securityCheckPagesource, "csrfmiddlewaretoken\" value=\"", "\""); string phoneNoPostData = "csrfmiddlewaretoken=" + getcsrfmiddlewaretoken + "&phone_number=%2B" + phoneNo; string postUrl = "https://www.instagram.com/integrity/checkpoint/?next=%2F"; string smsActivationPagesource = IgUser.globusHttpHelper.postFormDataProxy(new Uri(postUrl), phoneNoPostData, "https://www.instagram.com/integrity/checkpoint/?next=%2F ", "", "https://www.instagram.com", IgUser.proxyip, int.Parse(IgUser.proxyport), IgUser.proxyusername, IgUser.proxypassword); if (smsActivationPagesource.Contains("Sorry, please choose a different phone number")) { continue; } var driverervice = PhantomJSDriverService.CreateDefaultService(); driverervice.HideCommandPromptWindow = true; webDriver = new PhantomJSDriver(driverervice, new PhantomJSOptions()); Thread.Sleep(5000); webDriver.Navigate().GoToUrl(item); string pageSource = webDriver.PageSource; if (string.IsNullOrEmpty(pageSource)) { webDriver.Navigate().GoToUrl(item); } // webDriver.Close(); // webDriver.Dispose(); string verificationCode = string.Empty; try { string[] getsmsData = System.Text.RegularExpressions.Regex.Split(pageSource, "<td>"); bool isgotSms = false; foreach (string msg in getsmsData) { if(msg.Contains("Instagram account")) { string smsCode = Utils.getBetween(msg, "</script>", "</td>"); int count = 0; int countsms = 0; foreach (string data in smsCode.Split(' ')) { string sms = data.Replace(".", "").Replace(",", ""); System.Text.RegularExpressions.Regex IdCheck = new System.Text.RegularExpressions.Regex("^[0-9]*$"); if (IdCheck.IsMatch(sms)) { count++; if(count==1) { verificationCode = data.Replace(".", ""); isgotSms = true; break; } else { verificationCode = verificationCode + " " + sms; isgotSms = true; break; } } } } if(isgotSms) { break; } } } catch(Exception ex) { GlobusLogHelper.log.Error("Error ==> " + ex.StackTrace); } string finalPostData = "csrfmiddlewaretoken=" + getcsrfmiddlewaretoken + "&response_code=" + verificationCode; string finalPostUrl = "https://www.instagram.com/integrity/checkpoint/?next=%2F"; string finalresponse = IgUser.globusHttpHelper.postFormDataProxy(new Uri(finalPostUrl), finalPostData, "https://www.instagram.com/integrity/checkpoint/?next=%2F ", "", "https://www.instagram.com", IgUser.proxyip, int.Parse(IgUser.proxyport), IgUser.proxyusername, IgUser.proxypassword); if (finalresponse.Contains("To verify your account, please enter the security code we texted you")) { continue; // goto startAgain; } if (finalresponse.Contains(IgUser.username) && !(finalresponse.Contains("To verify your account, please enter the security code we texted you"))) { GlobusLogHelper.log.Info(IgUser.username + " Account has been Verified"); break; } string homepage = IgUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri("https://www.instagram.com/"), IgUser.proxyip, int.Parse(IgUser.proxyport), IgUser.proxyusername, IgUser.proxypassword); if (!homepage.Contains("logged-in") && !homepage.Contains(IgUser.username)) { GlobusLogHelper.log.Info(IgUser.username + " Account is disable"); break; } #region Commented to decode Aes Encoded data //string getSMSPageSource = IgUser.globusHttpHelper.getHtmlfromUrlProxy(new Uri(item), IgUser.proxyip, int.Parse(IgUser.proxyport), IgUser.proxyusername, IgUser.proxypassword); //string[] getSMS = System.Text.RegularExpressions.Regex.Split(getSMSPageSource, " <tr>"); //getSMS = getSMS.Take(3).ToArray(); //getSMS = getSMS.Skip(1).ToArray(); //foreach(string smsinfo in getSMS) //{ // try // { // if(smsinfo.Contains("<td>")) // { // string ct = string.Empty; // string iv = string.Empty; // string s = string.Empty; // ct = Utils.getBetween(smsinfo, "ct\":\"", "\""); // iv = Utils.getBetween(smsinfo, "iv\":\"", "\""); // s = Utils.getBetween(smsinfo, "s\":\"", "\""); // string value= DecryptString(ct, "ct"); // // using (Aes aes = new AesManaged())//RijndaelManaged // using (AesManaged aes = new AesManaged()) // { // string text="Happy Propose Day"; // byte[] rowbyte = Encoding.Unicode.GetBytes(text); // byte[] cipherText = null; // byte[] plainText = null; // byte[] IV=new byte[16]; // aes.BlockSize = 128; // cipherText = Convert.FromBase64String(ct); // IV=Convert.FromBase64String(iv); // aes.Padding = PaddingMode.None; //PKCS7 // aes.KeySize = 128; // in bits // aes.Key = cipherText; // 16 bytes for 128 bit encryption // aes.IV = IV; // AES needs a 16-byte IV // // Should set Key and IV here. Good approach: derive them from // // a password via Cryptography.Rfc2898DeriveBytes // using(MemoryStream ms=new MemoryStream()) // { // using(CryptoStream cs=new CryptoStream(ms,aes.CreateEncryptor(),CryptoStreamMode.Write)) // { // } // } // using (MemoryStream ms = new MemoryStream()) // { // using (CryptoStream cs = new CryptoStream(ms, aes.CreateDecryptor(), CryptoStreamMode.Write)) // { // // cs.Write(cipherText, 0, cipherText.Length); // cs.Write(cipherText, 0, cipherText.Length); // } // plainText = ms.ToArray(); // } // string sms = System.Text.Encoding.Unicode.GetString(plainText); // string result = System.Text.Encoding.UTF8.GetString(plainText); // result = Encoding.ASCII.GetString(plainText); // Console.WriteLine(s); // } // string sss=""; // } // else // { // continue; // } // } // catch(Exception ex) // { // GlobusLogHelper.log.Error("Error : " + ex.Message); // } //} #endregion } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.Message); } } } } else if (securityCheckPagesource.Contains(IgUser.username)) { GlobusLogHelper.log.Info("Account : " + IgUser.username + " Is Already Verified"); } } } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.Message); } } }