Ejemplo n.º 1
0
        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 { }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        // 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=&amp;"))
                {
                    try
                    {
                        csrfToken = pageSource.Substring(pageSource.IndexOf("session_full_logout=&amp;"), 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 { }
        }
Ejemplo n.º 4
0
        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)
            {
            }
        }
Ejemplo n.º 5
0
        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)
            {

            }
        }
Ejemplo n.º 6
0
        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 { }
        }
Ejemplo n.º 7
0
        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;
        }