コード例 #1
0
        public void LoginHttpHelper()
        {
            string str           = string.Empty;
            string accountUser   = string.Empty;
            string accountPass   = string.Empty;
            string proxyAddress  = string.Empty;
            string proxyPort     = string.Empty;
            string proxyUserName = string.Empty;
            string proxyPassword = string.Empty;
            string Url           = string.Empty;

            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);


            string postdata    = string.Empty;
            string postUrl     = string.Empty;
            string ResLogin    = string.Empty;
            string csrfToken   = string.Empty;
            string sourceAlias = string.Empty;

            if (pageSrcLogin.Contains("csrfToken"))
            {
                csrfToken = pageSrcLogin.Substring(pageSrcLogin.IndexOf("csrfToken"), 100);
                string[] Arr = csrfToken.Split('"');
                csrfToken = Arr[2];
            }

            if (pageSrcLogin.Contains("sourceAlias"))
            {
                sourceAlias = pageSrcLogin.Substring(pageSrcLogin.IndexOf("sourceAlias"), 100);
                string[] Arr = sourceAlias.Split('"');
                sourceAlias = Arr[2];
            }
            accountUser = "******";
            accountUser = accountUser.Replace("@", "%40");
            accountPass = "******";
            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);

            Url          = "http://www.linkedin.com/home?trk=hb_tab_home_top";
            pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, int.Parse(proxyPort), proxyUserName, proxyPassword);

            LogoutHttpHelper(ref HttpHelper);

            Url          = "http://www.linkedin.com/home?trk=hb_tab_home_top";
            pageSrcLogin = HttpHelper.getHtmlfromUrlProxy(new Uri(Url), proxyAddress, int.Parse(proxyPort), proxyUserName, proxyPassword);
        }
コード例 #2
0
        private void SendInvitation(ref GlobusHttpHelper httpHelper, string pageSource, string key1, string authToken1, string goback1, string firstName_Guest1, string lastName_Guest1)
        {
            try
            {
                Log("[ " + DateTime.Now + " ] => [ Start Sending Invitation With Username >>> " + _UserName + " ]");

                string reason = string.Empty;
                string existingPositionIC = string.Empty;
                string greeting = string.Empty;
                string key = string.Empty;
                string firstName_Guest = string.Empty;
                string lastName_Guest = string.Empty;
                string authToken = string.Empty;
                string subject = string.Empty;
                string defaultText = string.Empty;
                string csrfToken = string.Empty;
                string sourceAlias = string.Empty;
                string goback = string.Empty;
                string userName = string.Empty;
                string userFirstName = string.Empty;
                string userLastName = string.Empty;
                string resultForUserDetails = FindTheUserName(pageSource);

                try
                {
                    resultForUserDetails = resultForUserDetails.Substring(resultForUserDetails.IndexOf("alt="), resultForUserDetails.IndexOf("height") - resultForUserDetails.IndexOf("alt=")).Replace("alt=", string.Empty).Replace("/", string.Empty).Trim();
                    userFirstName = resultForUserDetails.Split(' ')[0].Replace("\"", string.Empty).Replace(",", string.Empty);
                    userLastName = resultForUserDetails.Split(' ')[1].Replace("\"", string.Empty).Replace(",", string.Empty);
                }
                catch { }

                firstName_Guest = GetValue(pageSource, "firstName");

                if (string.IsNullOrEmpty(firstName_Guest))
                {
                    firstName_Guest = firstName_Guest1;
                }

                lastName_Guest = GetValue(pageSource, "lastName");

                if (string.IsNullOrEmpty(lastName_Guest))
                {
                    lastName_Guest = lastName_Guest1;
                }

                reason = GetValue(pageSource, "reason");

                existingPositionIC = GetValue(pageSource, "existingPositionIC");
                firstName_Guest = firstName_Guest.Replace(""", "\"");

                greeting = PersonalNote.Replace("<FIRSTNAME>", firstName_Guest).Replace("<PROFILEFIRSTNAME>", userFirstName).Trim();
                ClsInviteMemberThroughProfileURL.Listgreetmsg = SpinnedListGenerator.GetSpinnedList(new List<string> { greeting });
                string messagebody = string.Empty;
                messagebody = greeting;

                if (spintaxsearch)
                {
                    try
                    {
                        messagebody = Listgreetmsg[RandomNumberGenerator.GenerateRandom(0, Listgreetmsg.Count - 1)];
                    }
                    catch
                    { }

                }

                key = GetValue(pageSource, "key");

                if (string.IsNullOrEmpty(key))
                {
                    key = key1;
                }

                authToken = GetValue(pageSource, "authToken");

                if (string.IsNullOrEmpty(authToken))
                {
                    authToken = authToken1;
                }

                subject = GetValue(pageSource, "subject");

                defaultText = GetValue(pageSource, "defaultText");

                csrfToken = GetValue(pageSource, "csrfToken");

                sourceAlias = GetValue(pageSource, "sourceAlias");

                goback = GetValue(pageSource, "goback").Replace("/", "%2F");

                if (string.IsNullOrEmpty(goback))
                {
                    goback = goback1;
                }

                string postData = "existingPositionIC=&companyName.0=&titleIC.0=&startYearIC.0=&endYearIC.0=&schoolText=&schoolID=&existingPositionIB=&companyName.1=&titleIB.0=&startYearIB.0=&endYearIB.0=&reason=IF&otherEmail=&greeting=" + Uri.EscapeDataString(messagebody) + "&iweReconnectSubmit=Send+Invitation&key=" + key + "&firstName=" + firstName_Guest + "&lastName=" + lastName_Guest + "&authToken=" + authToken + "&authType=name&trk=prof-0-sb-connect-button&iweLimitReached=false&companyID.0=&companyID.1=&schoolID=&schoolcountryCode=&schoolprovinceCode=&javascriptEnabled=false&existingAssociation=Job+Openings%2C+Job+Leads+and+Job+Connections%21&subject=" + subject + "&defaultText=" + defaultText + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + "&goback=" + goback + "";
                string postResponse = httpHelper.postFormData(new Uri("http://www.linkedin.com/people/iweReconnectAction"), postData);

                if (postResponse.Contains("Invitation to") || postResponse.Contains("invitación a"))
                {
                    Log("[ " + DateTime.Now + " ] => [ Invitation Sent successfully To >>> " + firstName_Guest + " With Username >>> " + _UserName + " ]");

                    #region Data Saved In CSV File

                    if (!string.IsNullOrEmpty(firstName_Guest) || !string.IsNullOrEmpty(_UserName))
                    {
                        try

                        {
                            string CSVHeader = "_UserName" + "," + "firstName_Guest" + "," + "lastName_Guest" + "," + "userFirstName" + "," + "userLastName" + ",";
                            string CSV_Content = _UserName + "," + firstName_Guest + "," + lastName_Guest + "," + userFirstName + "," + userLastName + ",";// +TypeOfProfile + ",";
                            CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_LinkedininvitememberResultUrlData);//path_LinkedinSearchSearchByProfileURL);
                            Log("[ " + DateTime.Now + " ] => [ Data Saved In CSV File ! ]");
                        }
                        catch { }

                    }

                    #endregion

                    int delay = new Random().Next(MinDelay, MaxDelay);
                    Log("[ " + DateTime.Now + " ] => [ Delay >>> " + delay + " Seconds With Username >>> " + _UserName + " ]");
                    Log("[ " + DateTime.Now + " ] => [---------------------------------------------------------------------]");
                    Thread.Sleep(delay * 1000);

                }
                else if (postResponse.Contains("Request Error") || postResponse.Contains("Solicitud de error"))
                {
                    Log("[ " + DateTime.Now + " ] => [ Request Error With Username >>> " + _UserName + " ]");

                    if (pageSource.Contains("Sorry, there was a problem processing your request. Please try again"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ Sorry, there was a problem processing your request. Please try again With Username >>> " + _UserName + " ]");
                    }

                    if (pageSource.Contains("You have no confirmed email addresses"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ You have no confirmed email addresses With Username >>> " + _UserName + " ]");
                    }
                }
                else
                {
                    if (pageSource.Contains("Sorry, there was a problem processing your request. Please try again"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ Sorry, there was a problem processing your request. Please try again With Username >>> " + _UserName + " ]");
                    }

                    else if (pageSource.Contains("You have no confirmed email addresses"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ You have no confirmed email addresses With Username >>> " + _UserName + " ]");
                    }
                    else
                    {
                        Log("[ " + DateTime.Now + " ] => [ Error in request With Username >>> " + _UserName + " ]");
                    }
                    int delay = new Random().Next(MinDelay, MaxDelay);
                    Log("[ " + DateTime.Now + " ] => [ Delay >>> " + delay + " Seconds With Username >>> " + _UserName + " ]");
                    Log("[ " + DateTime.Now + " ] => [---------------------------------------------------------------------]");
                    Thread.Sleep(delay * 1000);
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine("Error >>> " + ex.StackTrace);
            }
        }
コード例 #3
0
        private void SendInvitation(ref GlobusHttpHelper httpHelper, string pageSource, string key1, string authToken1, string goback1, string firstName_Guest1, string lastName_Guest1)
        {
            try
            {
                Log("[ " + DateTime.Now + " ] => [ Start Sending Invitation With Username >>> " + _UserName + " ]");

                string reason             = string.Empty;
                string existingPositionIC = string.Empty;
                string greeting           = string.Empty;
                string key                  = string.Empty;
                string firstName_Guest      = string.Empty;
                string lastName_Guest       = string.Empty;
                string authToken            = string.Empty;
                string subject              = string.Empty;
                string defaultText          = string.Empty;
                string csrfToken            = string.Empty;
                string sourceAlias          = string.Empty;
                string goback               = string.Empty;
                string userName             = string.Empty;
                string userFirstName        = string.Empty;
                string userLastName         = string.Empty;
                string resultForUserDetails = FindTheUserName(pageSource);

                try
                {
                    resultForUserDetails = resultForUserDetails.Substring(resultForUserDetails.IndexOf("alt="), resultForUserDetails.IndexOf("height") - resultForUserDetails.IndexOf("alt=")).Replace("alt=", string.Empty).Replace("/", string.Empty).Trim();
                    userFirstName        = resultForUserDetails.Split(' ')[0].Replace("\"", string.Empty).Replace(",", string.Empty);
                    userLastName         = resultForUserDetails.Split(' ')[1].Replace("\"", string.Empty).Replace(",", string.Empty);
                }
                catch { }

                firstName_Guest = GetValue(pageSource, "firstName");

                if (string.IsNullOrEmpty(firstName_Guest))
                {
                    firstName_Guest = firstName_Guest1;
                }

                lastName_Guest = GetValue(pageSource, "lastName");

                if (string.IsNullOrEmpty(lastName_Guest))
                {
                    lastName_Guest = lastName_Guest1;
                }

                reason = GetValue(pageSource, "reason");

                existingPositionIC = GetValue(pageSource, "existingPositionIC");
                firstName_Guest    = firstName_Guest.Replace("&quot;", "\"");

                greeting = PersonalNote.Replace("<FIRSTNAME>", firstName_Guest).Replace("<PROFILEFIRSTNAME>", userFirstName).Trim();
                ClsInviteMemberThroughProfileURL.Listgreetmsg = SpinnedListGenerator.GetSpinnedList(new List <string> {
                    greeting
                });
                string messagebody = string.Empty;
                messagebody = greeting;

                if (spintaxsearch)
                {
                    try
                    {
                        messagebody = Listgreetmsg[RandomNumberGenerator.GenerateRandom(0, Listgreetmsg.Count - 1)];
                    }
                    catch
                    { }
                }

                key = GetValue(pageSource, "key");

                if (string.IsNullOrEmpty(key))
                {
                    key = key1;
                }

                authToken = GetValue(pageSource, "authToken");

                if (string.IsNullOrEmpty(authToken))
                {
                    authToken = authToken1;
                }

                subject = GetValue(pageSource, "subject");

                defaultText = GetValue(pageSource, "defaultText");

                csrfToken = GetValue(pageSource, "csrfToken");

                sourceAlias = GetValue(pageSource, "sourceAlias");

                goback = GetValue(pageSource, "goback").Replace("/", "%2F");

                if (string.IsNullOrEmpty(goback))
                {
                    goback = goback1;
                }

                string postData     = "existingPositionIC=&companyName.0=&titleIC.0=&startYearIC.0=&endYearIC.0=&schoolText=&schoolID=&existingPositionIB=&companyName.1=&titleIB.0=&startYearIB.0=&endYearIB.0=&reason=IF&otherEmail=&greeting=" + Uri.EscapeDataString(messagebody) + "&iweReconnectSubmit=Send+Invitation&key=" + key + "&firstName=" + firstName_Guest + "&lastName=" + lastName_Guest + "&authToken=" + authToken + "&authType=name&trk=prof-0-sb-connect-button&iweLimitReached=false&companyID.0=&companyID.1=&schoolID=&schoolcountryCode=&schoolprovinceCode=&javascriptEnabled=false&existingAssociation=Job+Openings%2C+Job+Leads+and+Job+Connections%21&subject=" + subject + "&defaultText=" + defaultText + "&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias + "&goback=" + goback + "";
                string postResponse = httpHelper.postFormData(new Uri("http://www.linkedin.com/people/iweReconnectAction"), postData);

                if (postResponse.Contains("Invitation to") || postResponse.Contains("invitación a"))
                {
                    Log("[ " + DateTime.Now + " ] => [ Invitation Sent successfully To >>> " + firstName_Guest + " With Username >>> " + _UserName + " ]");

                    #region Data Saved In CSV File

                    if (!string.IsNullOrEmpty(firstName_Guest) || !string.IsNullOrEmpty(_UserName))
                    {
                        try

                        {
                            string CSVHeader   = "_UserName" + "," + "firstName_Guest" + "," + "lastName_Guest" + "," + "userFirstName" + "," + "userLastName" + ",";
                            string CSV_Content = _UserName + "," + firstName_Guest + "," + lastName_Guest + "," + userFirstName + "," + userLastName + ","; // +TypeOfProfile + ",";
                            CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_LinkedininvitememberResultUrlData);                         //path_LinkedinSearchSearchByProfileURL);
                            Log("[ " + DateTime.Now + " ] => [ Data Saved In CSV File ! ]");
                        }
                        catch { }
                    }

                    #endregion

                    int delay = new Random().Next(MinDelay, MaxDelay);
                    Log("[ " + DateTime.Now + " ] => [ Delay >>> " + delay + " Seconds With Username >>> " + _UserName + " ]");
                    Log("[ " + DateTime.Now + " ] => [---------------------------------------------------------------------]");
                    Thread.Sleep(delay * 1000);
                }
                else if (postResponse.Contains("Request Error") || postResponse.Contains("Solicitud de error"))
                {
                    Log("[ " + DateTime.Now + " ] => [ Request Error With Username >>> " + _UserName + " ]");

                    if (pageSource.Contains("Sorry, there was a problem processing your request. Please try again"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ Sorry, there was a problem processing your request. Please try again With Username >>> " + _UserName + " ]");
                    }

                    if (pageSource.Contains("You have no confirmed email addresses"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ You have no confirmed email addresses With Username >>> " + _UserName + " ]");
                    }
                }
                else
                {
                    if (pageSource.Contains("Sorry, there was a problem processing your request. Please try again"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ Sorry, there was a problem processing your request. Please try again With Username >>> " + _UserName + " ]");
                    }

                    else if (pageSource.Contains("You have no confirmed email addresses"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ You have no confirmed email addresses With Username >>> " + _UserName + " ]");
                    }
                    else
                    {
                        Log("[ " + DateTime.Now + " ] => [ Error in request With Username >>> " + _UserName + " ]");
                    }
                    int delay = new Random().Next(MinDelay, MaxDelay);
                    Log("[ " + DateTime.Now + " ] => [ Delay >>> " + delay + " Seconds With Username >>> " + _UserName + " ]");
                    Log("[ " + DateTime.Now + " ] => [---------------------------------------------------------------------]");
                    Thread.Sleep(delay * 1000);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error >>> " + ex.StackTrace);
            }
        }
コード例 #4
0
        public void PostFinalMsgGroupMember_1By1(ref GlobusHttpHelper HttpHelper, Dictionary <string, string> SlectedContacts, List <string> GrpMemSubjectlist, List <string> GrpMemMessagelist, string msg, string body, string UserName, string FromemailId, string FromEmailNam, string SelectedGrpName, string grpId, bool mesg_with_tag, bool msg_spintaxt, int mindelay, int maxdelay, bool preventMsgSameGroup, bool preventMsgWithoutGroup, bool preventMsgGlobal)
        {
            try
            {
                MsgGroupMemDbManager objMsgGroupMemDbMgr = new MsgGroupMemDbManager();

                string postdata       = string.Empty;
                string postUrl        = string.Empty;
                string ResLogin       = string.Empty;
                string csrfToken      = string.Empty;
                string sourceAlias    = string.Empty;
                string ReturnString   = string.Empty;
                string PostMsgSubject = string.Empty;
                string PostMsgBody    = string.Empty;
                string FString        = string.Empty;

                try
                {
                    string MessageText    = string.Empty;
                    string PostedMessage  = string.Empty;
                    string senderEmail    = string.Empty;
                    string getComposeData = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/inbox/compose"));
                    try
                    {
                        int startindex = getComposeData.IndexOf("\"senderEmail\" value=\"");
                        if (startindex < 0)
                        {
                            startindex = getComposeData.IndexOf("\"senderEmail\",\"value\":\"");
                        }
                        string start    = getComposeData.Substring(startindex).Replace("\"senderEmail\" value=\"", string.Empty).Replace("\"senderEmail\",\"value\":\"", string.Empty);
                        int    endindex = start.IndexOf("\"/>");
                        if (endindex < 0)
                        {
                            endindex = start.IndexOf("\",\"");
                        }
                        string end = start.Substring(0, endindex).Replace("\"/>", string.Empty).Replace("\",\"", string.Empty);
                        senderEmail = end.Trim();
                    }
                    catch
                    { }
                    string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));
                    if (pageSource.Contains("csrfToken"))
                    {
                        try
                        {
                            csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50);
                            string[] Arr = csrfToken.Split('<');
                            csrfToken = Arr[0];
                            csrfToken = csrfToken.Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("<script typ", string.Empty);
                            csrfToken = csrfToken.Trim();
                        }
                        catch (Exception ex)
                        {
                        }
                    }

                    if (pageSource.Contains("sourceAlias"))
                    {
                        try
                        {
                            sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                            string[] Arr = sourceAlias.Split('"');
                            sourceAlias = Arr[2];
                        }
                        catch (Exception ex)
                        {
                        }
                    }

                    if (pageSource.Contains("goback="))
                    {
                        try
                        {
                        }
                        catch (Exception ex)
                        {
                        }
                    }

                    foreach (KeyValuePair <string, string> itemChecked in SlectedContacts)
                    {
                        try
                        {
                            DataSet ds          = new DataSet();
                            DataSet ds_bList    = new DataSet();
                            string  ContactName = string.Empty;
                            string  Nstring     = string.Empty;
                            string  connId      = string.Empty;
                            string  FName       = string.Empty;
                            string  Lname       = string.Empty;
                            string  tempBody    = string.Empty;
                            string  tempsubject = string.Empty;
                            string  n_ame1      = string.Empty;

                            //grpId = itemChecked.Key.ToString();

                            try
                            {
                                // FName = itemChecked.Value.Split(' ')[0];
                                // Lname = itemChecked.Value.Split(' ')[1];
                                try
                                {
                                    n_ame1 = itemChecked.Value.Split(']')[1].Trim();;
                                }
                                catch
                                { }
                                if (string.IsNullOrEmpty(n_ame1))
                                {
                                    try
                                    {
                                        n_ame1 = itemChecked.Value;
                                    }
                                    catch
                                    { }
                                }
                                string[] n_ame = Regex.Split(n_ame1, " ");
                                FName = " " + n_ame[0];
                                Lname = n_ame[1];

                                if (!string.IsNullOrEmpty(n_ame[2]))
                                {
                                    Lname = Lname + n_ame[2];
                                }
                                if (!string.IsNullOrEmpty(n_ame[3]))
                                {
                                    Lname = Lname + n_ame[3];
                                }
                                if (!string.IsNullOrEmpty(n_ame[4]))
                                {
                                    Lname = Lname + n_ame[4];
                                }
                                if (!string.IsNullOrEmpty(n_ame[5]))
                                {
                                    Lname = Lname + n_ame[5];
                                }
                            }
                            catch (Exception ex)
                            {
                            }

                            try
                            {
                                ContactName = FName + " " + Lname;
                                ContactName = ContactName.Replace("%20", " ");
                            }
                            catch { }

                            Log("[ " + DateTime.Now + " ] => [ Adding Contact : " + ContactName + " ]");

                            string        ToCd         = itemChecked.Key;
                            List <string> AddAllString = new List <string>();

                            if (FString == string.Empty)
                            {
                                string CompString = "{" + "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                FString = CompString;
                            }
                            else
                            {
                                string CompString = "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                FString = CompString;
                            }

                            if (Nstring == string.Empty)
                            {
                                Nstring = FString;
                                connId  = ToCd;
                            }
                            else
                            {
                                Nstring += "," + FString;
                                connId  += " " + ToCd;
                            }

                            Nstring += "}";

                            try
                            {
                                string PostMessage       = string.Empty;
                                string ResponseStatusMsg = string.Empty;

                                Log("[ " + DateTime.Now + " ] => [ Message Sending Process Running.. ]");


                                if (msg_spintaxt == true)
                                {
                                    try
                                    {
                                        msg  = GrpMemSubjectlist[RandomNumberGenerator.GenerateRandom(0, GrpMemSubjectlist.Count - 1)];
                                        body = GrpMemMessagelist[RandomNumberGenerator.GenerateRandom(0, GrpMemMessagelist.Count - 1)];
                                    }
                                    catch
                                    {
                                    }
                                }
                                try
                                {
                                    tempsubject = msg;
                                    tempBody    = body;
                                }
                                catch
                                { }
                                if (mesg_with_tag == true)
                                {
                                    if (string.IsNullOrEmpty(FName))
                                    {
                                        tempBody = body.Replace("<Insert Name>", ContactName);
                                    }
                                    else
                                    {
                                        tempBody = GlobusSpinHelper.spinLargeText(new Random(), body);

                                        if (lstSubjectReuse.Count == GrpMemSubjectlist.Count)
                                        {
                                            lstSubjectReuse.Clear();
                                        }
                                        foreach (var itemSubject in GrpMemSubjectlist)
                                        {
                                            if (string.IsNullOrEmpty(TemporarySubject))
                                            {
                                                TemporarySubject = itemSubject;
                                                tempsubject      = itemSubject;
                                                lstSubjectReuse.Add(itemSubject);
                                                break;
                                            }
                                            else if (!lstSubjectReuse.Contains(itemSubject))
                                            {
                                                TemporarySubject = itemSubject;
                                                tempsubject      = itemSubject;
                                                lstSubjectReuse.Add(itemSubject);
                                                break;
                                            }
                                            else
                                            {
                                                continue;
                                            }
                                        }

                                        tempBody    = tempBody.Replace("<Insert Name>", FName);
                                        tempsubject = tempsubject.Replace("<Insert Name>", FName);
                                    }
                                }
                                else
                                {
                                    if (string.IsNullOrEmpty(FName))
                                    {
                                        tempBody = body.Replace("<Insert Name>", ContactName);
                                    }
                                    else
                                    {
                                        tempBody = body.Replace("<Insert Name>", FName);
                                    }
                                }

                                if (SelectedGrpName.Contains(":"))
                                {
                                    try
                                    {
                                        string[] arrSelectedGrpName = Regex.Split(SelectedGrpName, ":");
                                        if (arrSelectedGrpName.Length > 1)
                                        {
                                            SelectedGrpName = arrSelectedGrpName[1];
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                }



                                if (mesg_with_tag == true)
                                {
                                    tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName);
                                    tempBody = tempBody.Replace("<Insert From Email>", FromEmailNam);
                                    tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);
                                }
                                else
                                {
                                    tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName);
                                    tempBody = tempBody.Replace("<Insert From Email>", FromEmailNam);
                                    tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);
                                }

                                //Check BlackListed Accounts
                                try
                                {
                                    string Querystring = "Select ProfileID From tb_BlackListAccount Where ProfileID ='" + itemChecked.Key + "'";
                                    ds_bList = DataBaseHandler.SelectQuery(Querystring, "tb_BlackListAccount");
                                }
                                catch { }


                                if (preventMsgSameGroup)
                                {
                                    try
                                    {
                                        string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgGroupId = " + grpId + " and MsgToId = " + connId + "";
                                        ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                    }
                                    catch { }
                                }

                                if (preventMsgWithoutGroup)
                                {
                                    try
                                    {
                                        string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgToId = " + connId + "";
                                        ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                    }
                                    catch { }
                                }
                                if (preventMsgGlobal)
                                {
                                    try
                                    {
                                        string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgToId = " + connId + "";
                                        ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                    }
                                    catch { }
                                }

                                try
                                {
                                    if (ds.Tables.Count > 0)
                                    {
                                        if (ds.Tables[0].Rows.Count > 0)
                                        {
                                            PostMessage       = "";
                                            ResponseStatusMsg = "Already Sent";
                                        }
                                        else
                                        {
                                            if (ds_bList.Tables.Count > 0 && ds_bList.Tables[0].Rows.Count > 0)
                                            {
                                                Log("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]");
                                                ResponseStatusMsg = "BlackListed";
                                            }
                                            else
                                            {
                                                PostMessage       = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (ds_bList.Tables.Count > 0)
                                        {
                                            if (ds_bList.Tables[0].Rows.Count > 0)
                                            {
                                                Log("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]");
                                                ResponseStatusMsg = "BlackListed";
                                            }
                                            else
                                            {
                                                PostMessage       = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage);
                                            }
                                        }
                                    }
                                }
                                catch (Exception)
                                {
                                    //PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeintsfromName=" + Uri.EscapeDataString(FromEmailNam) + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                    //ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage);
                                }

                                if ((!ResponseStatusMsg.Contains("Your message was successfully sent.") && !ResponseStatusMsg.Contains("Already Sent")) && (!ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") && !ResponseStatusMsg.Contains("Ya ha sido enviada") && !ResponseStatusMsg.Contains("Uw bericht is verzonden")))
                                {
                                    if (ResponseStatusMsg.Contains("Already Sent") || (ResponseStatusMsg.Contains("Ya ha sido enviada") || (ResponseStatusMsg.Contains("BlackListed"))))
                                    {
                                        continue;
                                    }

                                    try
                                    {
                                        pageSource = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/groups?viewMembers=&gid=" + grpId));

                                        if (pageSource.Contains("contentType="))
                                        {
                                            try
                                            {
                                                string contentType = pageSource.Substring(pageSource.IndexOf("contentType="), pageSource.IndexOf("&", pageSource.IndexOf("contentType=")) - pageSource.IndexOf("contentType=")).Replace("contentType=", string.Empty).Replace("contentType=", string.Empty).Trim();

                                                string pageSource2 = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/groupMsg?displayCreate=&contentType=" + contentType + "&connId=" + connId + "&groupID=" + grpId + ""));

                                                PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeints&fromName=" + FromEmailNam + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=" + Uri.EscapeUriString(Nstring) + "&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=" + contentType + "&groupID=" + grpId + "";
                                            }
                                            catch (Exception ex)
                                            {
                                            }
                                        }


                                        ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                }

                                if ((ResponseStatusMsg.Contains("Your message was successfully sent.")) || (ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") || (ResponseStatusMsg.Contains("Uw bericht is verzonden"))))
                                {
                                    Log("[ " + DateTime.Now + " ] => [ Subject Posted : " + tempsubject + " ]");
                                    Log("[ " + DateTime.Now + " ] => [ Body Text Posted : " + tempBody.ToString() + " ]");
                                    Log("[ " + DateTime.Now + " ] => [ Message Posted To Account: " + ContactName + " ]");
                                    ReturnString = "Your message was successfully sent.";

                                    #region CSV
                                    string bdy = string.Empty;
                                    try
                                    {
                                        bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                    }
                                    catch { }
                                    if (string.IsNullOrEmpty(bdy))
                                    {
                                        bdy = tempBody.ToString().Replace(",", ":");
                                    }
                                    string CSVHeader   = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                    string CSV_Content = UserName + "," + tempsubject + "," + bdy.ToString() + "," + ContactName;
                                    CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageSentGroupMember);

                                    try
                                    {
                                        objMsgGroupMemDbMgr.InsertMsgGroupMemData(UserName, Convert.ToInt32(connId), ContactName, Convert.ToInt32(grpId), SelectedGrpName, msg, tempBody);
                                    }
                                    catch { }

                                    #endregion
                                }
                                else if (ResponseStatusMsg.Contains("There was an unexpected problem that prevented us from completing your request"))
                                {
                                    Log("[ " + DateTime.Now + " ] => [ There was an unexpected problem that prevented us from completing your request ! ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember);
                                }
                                else if (ResponseStatusMsg.Contains("You are no longer authorized to message this"))
                                {
                                    Log("[ " + DateTime.Now + " ] => [ You are no longer authorized to message this ! ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember);
                                }
                                else if ((ResponseStatusMsg.Contains("Already Sent")) || (ResponseStatusMsg.Contains("Ya ha sido enviada")))
                                {
                                    string bdy = string.Empty;
                                    try
                                    {
                                        bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                    }
                                    catch { }
                                    if (string.IsNullOrEmpty(bdy))
                                    {
                                        bdy = tempBody.ToString().Replace(",", ":");
                                    }
                                    string CSVHeader   = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                    string CSV_Content = UserName + "," + msg + "," + bdy.ToString() + "," + ContactName;
                                    CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageAlreadySentGroupMember);

                                    Log("[ " + DateTime.Now + " ] => [ Message Not Posted To Account: " + ContactName + " because it has sent the same message]");
                                }
                                else
                                {
                                    Log("[ " + DateTime.Now + " ] => [ Error In Message Posting ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember);
                                }

                                int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                                Thread.Sleep(delay * 1000);
                            }
                            catch (Exception ex)
                            {
                                //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember);
                            }
                        }
                        catch (Exception ex)
                        {
                            //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace);
                            GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember);
                        }
                    }
                }
                catch (Exception ex)
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->  PostFinalMsgGroupMember() --> 1 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 1 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember);
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->  PostFinalMsgGroupMember() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinComposeMessageErrorLogs);
            }
        }
コード例 #5
0
ファイル: CreateGroup.cs プロジェクト: ondrocks/inboard
        public void SendInvitation(ref GlobusHttpHelper HttpHelper, string grpURL, string grpId)
        {
            try
            {
                string FString     = string.Empty;
                string Nstring     = string.Empty;
                string connId      = string.Empty;
                string FullName    = string.Empty;
                string ToMsg       = string.Empty;
                string ContactName = string.Empty;

                string URL = "http://www.linkedin.com/manageGroup?dispAddMbrs=&gid=" + grpId + "&invtActn=im-invite&cntactSrc=cs-connections";

                string grpPageSource = HttpHelper.getHtmlfromUrl1(new Uri(URL));

                //string csrfToken = GetCsrfToken(grpPageSource);
                try
                {
                    int    startindex = grpPageSource.IndexOf("csrfToken=");
                    string start      = grpPageSource.Substring(startindex).Replace("csrfToken=", string.Empty);
                    int    endindex   = start.IndexOf("\"");
                    string end        = start.Substring(0, endindex).Replace("\"", string.Empty);
                    csrfToken = end.Trim();
                }
                catch
                { }
                ClsLinkedinMain             clsLinkedinMain = new ClsLinkedinMain();
                Dictionary <string, string> dTotalFriends   = clsLinkedinMain.PostAddMembers(ref HttpHelper, accountUser);

                // To manage the code for friends in which invitation already sent

                // SucessfullySendInvitationToFriend();

                //int counter = 1;

                foreach (KeyValuePair <string, string> itemChecked in dTotalFriends)
                {
                    try
                    {
                        //if (!IsAllAccounts)
                        //{
                        //    if (counter > 50)
                        //    {
                        //        break;
                        //    }
                        //}

                        //counter++;

                        string FName = string.Empty;
                        string Lname = string.Empty;

                        FName = itemChecked.Value.Split(' ')[0];
                        Lname = itemChecked.Value.Split(' ')[1];

                        FullName = FName + " " + Lname;
                        try
                        {
                            ContactName = ContactName + "  :  " + FullName;
                        }
                        catch { }
                        if (ToMsg == string.Empty)
                        {
                            ToMsg += FullName;
                        }
                        else
                        {
                            ToMsg += ";" + FullName;
                        }

                        Log("[ " + DateTime.Now + " ] => [ Adding Contact : " + FullName + " ]");


                        string ToCd = itemChecked.Key;

                        if (ToCd.Contains(":"))
                        {
                            try
                            {
                                ToCd = ToCd.Substring(ToCd.IndexOf(":"), ToCd.Length - ToCd.IndexOf(":")).Replace(":", string.Empty).Trim();
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("Error >>> " + ex.StackTrace);
                            }
                        }

                        List <string> AddAllString = new List <string>();

                        if (FString == string.Empty)
                        {
                            string CompString = "{" + "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                            FString = CompString;
                        }
                        else
                        {
                            string CompString = "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                            FString = CompString;
                        }

                        if (Nstring == string.Empty)
                        {
                            Nstring = FString;
                            connId  = ToCd;
                        }
                        else
                        {
                            Nstring += "," + FString;
                            connId  += " " + ToCd;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("ex.Message >>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "  ex.Stack Trace >>> " + ex.StackTrace);
                    }

                    //}
                    Nstring += "}";


                    string postData = "csrfToken=" + csrfToken + "&emailRecipients=&subAddMbrs=Send+Invitations&gid=" + grpId + "&invtActn=im-invite&cntactSrc=cs-connections&remIntives=999&connectionIds=" + connId + "&connectionNames=" + Uri.EscapeUriString(Nstring) + "&contactIDs=&newGroup=false";

                    string response = HttpHelper.postFormData(new Uri("http://www.linkedin.com/manageGroup"), postData);

                    //if (response.Contains("You have successfully sent invitations to this group") || response.Contains("Upgrade Your Account"))
                    if (response.Contains("You have successfully sent invitations to this group"))
                    {
                        Log("[ " + DateTime.Now + " ] => [ You have successfully sent invitations to Group : " + grpURL + " With Username : "******"Invite user : "******" ]");
                        string CSVHeader  = "GroupUrl" + "," + "UserName" + "," + "Invite User";
                        string CSVContent = grpURL + "," + accountUser + "," + FullName;
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSVContent, Globals.path_SentInvitationGroup);
                        // GlobusFileHelper.AppendStringToTextfileNewLine(content, Globals.path_SentInvitationGroup);
                    }
                    else
                    {
                        Log("[ " + DateTime.Now + " ] => [ Couldn't Send Invitation With Username : "******" ]");
                        string CSVHeader  = "GroupUrl" + "," + "UserName";
                        string CSVContent = grpURL + "," + accountUser;
                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSVContent, Globals.path_NotSentInvitationGroup);
                        //GlobusFileHelper.AppendStringToTextfileNewLine(content, Globals.path_NotSentInvitationGroup);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error >>> " + ex.StackTrace);
            }
        }
コード例 #6
0
ファイル: EventManager.cs プロジェクト: shah8701/faceboard
        public void CreateEvent(ref FacebookUser fbUser)
        {
            try
            {
                GlobusLogHelper.log.Info("Start Event Creaton With Username : "******"Start Event Creaton With Username : "******"user");
                if (string.IsNullOrEmpty(userid))
                {
                    userid = GlobusHttpHelper.ParseJson(homePageSource, "user");
                }

                if (string.IsNullOrEmpty(userid) || userid == "0" || userid.Length < 3)
                {
                    GlobusLogHelper.log.Info("Please Check The Account : " + fbUser.username);
                    GlobusLogHelper.log.Debug("Please Check The Account : " + fbUser.username);

                    return;
                }

                fbdtsg = GlobusHttpHelper.Get_fb_dtsg(homePageSource);


                foreach (string item in LstEventDetailsEventCreator)
                {
                    try
                    {
                        string[] eventDetailsArr = Regex.Split(item, "<:>");

                        for (int i = 0; i < eventDetailsArr.Length; i++)
                        {
                            try
                            {
                                string EventDetails = eventDetailsArr[i];

                                if (EventDetails.Contains("Name") || EventDetails.Contains("name"))
                                {
                                    try
                                    {
                                        //title = Uri.EscapeDataString(EventDetails.Replace("Name", string.Empty).Replace("name", string.Empty).Trim());
                                        title = Uri.EscapeDataString(EventDetails.Replace("Name", string.Empty).Replace("name", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Trim());
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }
                                if (EventDetails.Contains("Details") || EventDetails.Contains("details"))
                                {
                                    try
                                    {
                                        //detailstext = Uri.EscapeDataString(EventDetails.Replace("Details", string.Empty).Replace("details", string.Empty).Trim());
                                        detailstext = Uri.EscapeDataString(EventDetails.Replace("Details", string.Empty).Replace("details", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Trim());
                                        details     = detailstext;
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }
                                if (EventDetails.Contains("Where") || EventDetails.Contains("where"))
                                {
                                    try
                                    {
                                        //location = Uri.EscapeDataString(EventDetails.Replace("Where", string.Empty).Replace("where", string.Empty).Trim());
                                        location = Uri.EscapeDataString(EventDetails.Replace("Where", string.Empty).Replace("where", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Trim());
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }
                                if (EventDetails.Contains("When") || EventDetails.Contains("when"))
                                {
                                    try
                                    {
                                        //whendateIntlDisplay = Uri.EscapeDataString(EventDetails.Replace("When", string.Empty).Replace("when", string.Empty).Trim());
                                        whendateIntlDisplay = Uri.EscapeDataString(EventDetails.Replace("When", string.Empty).Replace("when", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Trim());
                                        whendate            = whendateIntlDisplay;
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }
                                if (EventDetails.Contains("Add a time") || EventDetails.Contains("add a time"))
                                {
                                    try
                                    {
                                        //whentimedisplaytime = Uri.EscapeDataString(EventDetails.Replace("Add a time", string.Empty).Replace("add a time", string.Empty).Trim());
                                        whentime            = EventDetails.Replace("Add a time", string.Empty).Replace("add a time", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Trim();
                                        whentimedisplaytime = Uri.EscapeDataString(EventDetails.Replace("Add a time", string.Empty).Replace("add a time", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Trim());
                                        //whentime = whentimedisplaytime;
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }
                                if (EventDetails.Contains("Privacy") || EventDetails.Contains("privacy"))
                                {
                                    try
                                    {
                                        //audiencevalue = ("40").Replace("whentimedisplaytime", string.Empty).Replace("whentimedisplaytime", string.Empty).Trim();
                                        audiencevalue = ("40").Replace("whentimedisplaytime", string.Empty).Replace("whentimedisplaytime", string.Empty).Replace("<", string.Empty).Replace(">", string.Empty).Trim();
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }
                        }

                        try
                        {
                            string getlocationpage             = "https://www.facebook.com/ajax/places/typeahead?value=" + location + "&include_address=2&include_subtext=true&exact_match=false&use_unicorn=true&allow_places=true&allow_cities=true&render_map=true&limit=15&new_js_ranking=0&include_source=plan_edit&city_bias=false&map_height=150&map_width=348&ref=xhp_fb__events__create__location_input%3A%3Arender&sid=771836702690&city_id=1019627&city_set=false&request_id=0.6745269983075559&__user="******"&__a=1&__dyn=7n8ahyj35zoSt2u6aWizG85oCiq78hyWgSmEVFLFwxBxCbzGxa48jhHw&__req=1q&__rev=1353801%20HTTP/1.1";
                            string pageresponseGetlocationpage = gHttpHelper.getHtmlfromUrl(new Uri(getlocationpage));
                            int    startindex = pageresponseGetlocationpage.IndexOf("uid\":");
                            string start      = pageresponseGetlocationpage.Substring(startindex).Replace("uid\":", string.Empty);
                            int    endindex   = start.IndexOf(",");
                            string end        = start.Substring(0, endindex).Replace(",", string.Empty);
                            locationid = end.Trim();
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }

                        try
                        {
                            if (whentime.StartsWith("0"))
                            {
                                int startindex2 = whentime.IndexOf("0");
                                whentime = whentime.Substring(startindex2).Replace("0", string.Empty);
                            }
                            string gettimepage             = "https://www.facebook.com/ajax/typeahead/time_bootstrap.php?request_id=0.8878094537649304&__user="******"&__a=1&__dyn=7n8ahyj2qm9udDgDxyKAEWy6zECiq78hACF3qGEVFLFwxBxCbzGxa49UJ6K&__req=25&__rev=1353801%20HTTP/1.1";
                            string pageresponseGetTimePage = gHttpHelper.getHtmlfromUrl(new Uri(gettimepage));
                            int    startindex  = pageresponseGetTimePage.IndexOf(whentime);
                            string start       = pageresponseGetTimePage.Substring(startindex).Replace(whentime, string.Empty);
                            int    startindex1 = start.IndexOf("uid\":");
                            string start1      = start.Substring(startindex1).Replace("uid\":", string.Empty);
                            int    endindex1   = start1.IndexOf(",");
                            string end         = start1.Substring(0, endindex1).Replace(",", string.Empty).Replace("\"", string.Empty);
                            timeid = end.Trim();
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                        try
                        {
                            string timezonedata = "place_id=" + locationid + "&date_str=" + whendateIntlDisplay + "&__user="******"&ttstamp=" + Utils.GenerateTimeStamp() + "";
                            string url          = "https://www.facebook.com/ajax/plans/create/timezone.phpHTTP/1.1";
                            string pgresponse   = gHttpHelper.postFormData(new Uri(url), timezonedata);
                            int    startindex   = pgresponse.IndexOf("tz_identifier\":\"");
                            string start        = pgresponse.Substring(startindex).Replace("tz_identifier\":\"", string.Empty);
                            int    endindex     = start.IndexOf("}");
                            string end          = start.Substring(0, endindex).Replace("}", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty);
                            timezone = Uri.EscapeDataString(end.Trim());
                        }
                        catch
                        { }

                        string createEventPS = gHttpHelper.getHtmlfromUrl(new Uri(FBGlobals.Instance.EventCreatorGetCreateEventUrl));

                        string createEventDialogPS = gHttpHelper.getHtmlfromUrl(new Uri(FBGlobals.Instance.EventCreatorGetAjaxCreateEventDialogUrl + userid + "&__a=1&__dyn=7n8apij35zpVpQ9UmAEKU&__req=g"));

                        string createEventPostSaveUrl = FBGlobals.Instance.EventCreatorPostAjaxCreateEventSaveUrl;

                        //string savePostData = "fb_dtsg=" + fbdtsg + "&title=" + title + "&details_text=" + detailstext + "&details=" + details + "&pre_details=&location_id="+ locationid + "&location=" + location + "&isplacetexttag=&pre_location=&pre_location_id=&when_dateIntlDisplay=" + whendateIntlDisplay + "&when_date=" + whendate + "&when_time="+ timeid +"&when_time_display_time=" + whentimedisplaytime+"&audience[0][value]=" + audiencevalue + "&guest_invite=on&pre_guest_invite=&parent_id=&source=10&who=&__user="******"&__a=1&__dyn=7n8apij35zpVpQ9UmAEKU&__req=1f&phstamp=" + Utils.GenerateTimeStamp() + "";
                        string savePostData           = "fb_dtsg=" + fbdtsg + "&title=" + title + "&details_text=" + detailstext + "&details=" + details + "&pre_details=&location_id=" + locationid + "&location=" + location + "&isplacetexttag=&pre_location=&pre_location_id=&when_dateIntlDisplay=" + whendateIntlDisplay + "&when_date=" + whendate + "&when_time=" + timeid + "&when_time_display_time=" + whentimedisplaytime + "&when_timezone=" + timezone + "&privacyx=1439959856260766&extra_data=&who=&__user="******"&__a=1&__dyn=7n8apij35zpVpQ9UmAEKU&__req=g&ttstamp=" + Utils.GenerateTimeStamp() + "";
                        string createEventPostSaveRes = gHttpHelper.postFormData(new Uri(createEventPostSaveUrl), savePostData);

                        if (createEventPostSaveRes.Contains("?context=create"))
                        {
                            string eventCreatedURL = string.Empty;

                            try
                            {
                                eventCreatedURL = createEventPostSaveRes.Substring(createEventPostSaveRes.IndexOf("goURI("), createEventPostSaveRes.IndexOf("?context=create", createEventPostSaveRes.IndexOf("goURI(")) - createEventPostSaveRes.IndexOf("goURI(")).Replace("\"", string.Empty).Replace("goURI(", string.Empty).Replace("events", string.Empty).Replace("\\", string.Empty).Replace(@"\\\/", string.Empty).Replace(@"//", string.Empty).Replace(@"/", string.Empty).Trim();
                                eventCreatedURL = FBGlobals.Instance.fbeventsUrl + eventCreatedURL;
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }

                            GlobusLogHelper.log.Info("Event Created URL :" + eventCreatedURL + " With Username : "******"Event Created URL :" + eventCreatedURL + " With Username : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"errorSummary"))
                        {
                            string errorSummary = FBUtils.GetErrorSummary(createEventPostSaveRes);

                            GlobusLogHelper.log.Info("Event Creation Error  :" + errorSummary + " With Username : "******"Event Creation Error  :" + errorSummary + " With Username : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Error In Event Creation With Username : "******"Error In Event Creation With Username : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Error : " + ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }

            GlobusLogHelper.log.Info("Process Completed Of Event Creaton With Username : "******"Process Completed Of Event Creaton With Username : " + fbUser.username);
        }
コード例 #7
0
ファイル: TwitterSignUp.cs プロジェクト: prog-moh/twtboard
        public void SignupMultiThreaded(object parameters)
        {
            try
            {

                Thread.CurrentThread.IsBackground = true;

                string DBCUsername = BaseLib.Globals.DBCUsername;
                string DBCPAssword = BaseLib.Globals.DBCPassword;
                GlobusHttpHelper globusHelper = new GlobusHttpHelper();
                int CaptchaCounter = 0;
                int counter_AuthToken = 0;
                string ImageURL = string.Empty;
                string authenticitytoken = string.Empty;
                string capcthavalue = string.Empty;

                Array paramsArray = new object[4];
                paramsArray = (Array)parameters;

                string Email = string.Empty;//"*****@*****.**";
                string Password = string.Empty;//"1JESUS11";

                string IPAddress = string.Empty;
                string IPPort = string.Empty;
                string IPUsername = string.Empty;
                string IPpassword = string.Empty;

                string emailData = (string)paramsArray.GetValue(0);
                string username = (string)paramsArray.GetValue(1);
                string name = (string)paramsArray.GetValue(2);
                string IP = (string)paramsArray.GetValue(3);
                try
                {
                    //Log("test - " + emailData + " :: " + name);

                    #region Emails & IP Settings
                    try
                    {
                        int Count = emailData.Split(':').Length;
                        if (Count == 1)
                        {
                            Log("[ " + DateTime.Now + " ] => [ Uploaded Emails Not In correct Format ]");
                            Log(emailData);
                            return;
                        }
                        if (Count == 2)
                        {
                            Email = emailData.Split(':')[0].Replace("\0", "");
                            Password = emailData.Split(':')[1].Replace("\0", "");
                        }
                        else if (Count == 4)
                        {
                            Email = emailData.Split(':')[0].Replace("\0", "");
                            Password = emailData.Split(':')[1].Replace("\0", "");
                            IPAddress = emailData.Split(':')[2];
                            IPPort = emailData.Split(':')[3];
                        }
                        else if (Count == 6)
                        {
                            Email = emailData.Split(':')[0].Replace("\0", "");
                            Password = emailData.Split(':')[1].Replace("\0", "");
                            IPAddress = emailData.Split(':')[2];
                            IPPort = emailData.Split(':')[3];
                            IPUsername = emailData.Split(':')[4];
                            IPpassword = emailData.Split(':')[5];
                        }
                        else
                        {
                            Log("[ " + DateTime.Now + " ] => [ Uploaded Emails Not In correct Format ]");
                            Log(emailData);
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        //Console.WriteLine("8 :" + ex.StackTrace);
                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- Email Pass --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                        GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- Email Pass >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
                    }

                    try
                    {
                        RaiseEvent_AddToDictionary(Email);
                        dictionary_Threads.Add("AccountCreator_" + Email, Thread.CurrentThread);
                    }
                    catch (Exception ex) { Console.WriteLine(ex.StackTrace); }

                    try
                    {
                        if (IP.Split(':').Length == 4)
                        {
                            IPAddress = IP.Split(':')[0];
                            IPPort = IP.Split(':')[1];
                            IPUsername = IP.Split(':')[2];
                            IPpassword = IP.Split(':')[3];
                        }
                    }
                    catch (Exception ex)
                    {
                        //Console.WriteLine("7 :" + ex.StackTrace);
                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- IP Split --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                        GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- IP Split >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
                    }

                    #endregion

                    try
                    {
                        username = username.Replace("\0", "");
                        Password = Password.Replace("\0", "");
                        if (!(username.Count() < 15 || Password.Count() > 6))
                        {
                            if (username.Count() > 15)
                            {
                                Log("[ " + DateTime.Now + " ] => [ Username Must Not be greater than 15 character ]");
                                username = username.Remove(13); //Removes the extra characters
                            }
                            else if (Password.Count() < 6)
                            {
                                Log("[ " + DateTime.Now + " ] => [ Password Must Not be less than 6 character ]");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        //Console.WriteLine("6 :" + ex.StackTrace);
                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- Check Username --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                        GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- Check Username >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
                    }

                StartAgain:

                    Random randm = new Random();
                    double cachestop = randm.NextDouble();
                    string pagesourceGoogleCaptcha = string.Empty;
                    string signUpPage = string.Empty;
                    try
                    {
                        try
                        {
                            signUpPage = globusHelper.getHtmlfromUrlIP(new Uri("https://twitter.com/signup"), IPAddress, IPPort, IPUsername, IPpassword, "", "");
                        }
                        catch (Exception ex)
                        {
                            Log("[ " + DateTime.Now + " ] => [ Error in Loading sign up page  " + IPAddress + " Exception" + ex.Message + " ]");
                        }
                        if (string.IsNullOrEmpty(signUpPage))
                        {
                            Thread.Sleep(500);
                            signUpPage = globusHelper.getHtmlfromUrlIP(new Uri("https://twitter.com/signup"), IPAddress, IPPort, IPUsername, IPpassword, "", "");
                        }

                        //Check if captchaAvailable, if yes, hit google captcha url
                        if (!string.IsNullOrEmpty(signUpPage) && signUpPage.Contains("captchaAvailable&quot;:true"))
                        {
                            try
                            {
                                string pagesource1 = globusHelper.getHtmlfromUrlIP(new Uri("https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"), IPAddress, IPPort, IPUsername, IPpassword, "", "");
                            }
                            catch { }
                            try
                            {
                                pagesourceGoogleCaptcha = globusHelper.getHtmlfromUrlIP(new Uri("https://www.google.com/recaptcha/api/challenge?k=6LfbTAAAAAAAAE0hk8Vnfd1THHnn9lJuow6fgulO&ajax=1&cachestop=" + cachestop + "&lang=en"), IPAddress, IPPort, IPUsername, IPpassword, "", "");
                            }
                            catch { }
                            if (string.IsNullOrEmpty(pagesourceGoogleCaptcha))
                            {
                                Thread.Sleep(500);
                                pagesourceGoogleCaptcha = globusHelper.getHtmlfromUrlIP(new Uri("https://www.google.com/recaptcha/api/challenge?k=6LfbTAAAAAAAAE0hk8Vnfd1THHnn9lJuow6fgulO&ajax=1&cachestop=" + cachestop + "&lang=en"), IPAddress, IPPort, IPUsername, IPpassword, "", "");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        pagesourceGoogleCaptcha = string.Empty;
                        Log("[ " + DateTime.Now + " ] => [ Error in Loading sign up page  " + IPAddress + " Exception" + ex.Message + " ]");
                    }

                    if (string.IsNullOrEmpty(signUpPage))
                    {
                        NoOfNonCreatedAccounts++;
                        NoOfNonCreatedAccountsIP++;
                        Log("[ " + DateTime.Now + " ] => [ Couldn't load Sign Up Page: " + Email + " ]");
                        lock (Lock_notCreatedaccounts)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_FailedCreatedAccounts);
                            GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password, Globals.path_FailedCreatedAccountsOnlyEmailPass);
                            GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password, Globals.path_FailedCreatedAccountsOnlyEmailPass);
                        }

                        Globals.EnquequeDataForSignUp(new object[] { emailData, username, name, IP });

                        return;
                    }

                    //if captchaAvailable on signup but google captcha page source is null, retry getting captcha page source
                    if (string.IsNullOrEmpty(pagesourceGoogleCaptcha) && signUpPage.Contains("captchaAvailable&quot;:true"))
                    {
                        try
                        {
                            Thread.Sleep(500);
                            //textUrl = globusHelper.getHtmlfromUrlIP(new Uri("https://twitter.com/signup"), IPAddress, IPPort, IPUsername, IPpassword, "", "");
                            string pagesource1 = globusHelper.getHtmlfromUrlIP(new Uri("https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"), IPAddress, IPPort, IPUsername, IPpassword, "", "");
                            pagesourceGoogleCaptcha = globusHelper.getHtmlfromUrlIP(new Uri("https://www.google.com/recaptcha/api/challenge?k=6LfbTAAAAAAAAE0hk8Vnfd1THHnn9lJuow6fgulO&ajax=1&cachestop=" + cachestop + "&lang=en"), IPAddress, IPPort, IPUsername, IPpassword, "", "");
                        }
                        catch (Exception ex)
                        {
                            if (CaptchaCounter == 0)//retry getting captcha page source only once
                            {
                                Log("[ " + DateTime.Now + " ] => [ Finding CAPTCHA Again For " + Email + " ]");
                                CaptchaCounter++;
                                goto StartAgain;
                            }
                            Console.WriteLine("Captcha Not Found For Email : " + Email + " : Error :" + ex.StackTrace);
                            GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- Getting Signup PageSource --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                            GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- Getting Signup PageSource >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
                        }
                    }


                    try
                    {
                        int IndexStart = pagesourceGoogleCaptcha.IndexOf("challenge :");
                        if (IndexStart > 0)
                        {
                            string Start = pagesourceGoogleCaptcha.Substring(IndexStart);
                            int IndexEnd = Start.IndexOf("',");
                            string End = Start.Substring(0, IndexEnd).Replace("challenge :", "").Replace("'", "").Replace(" ", "");
                            capcthavalue = End;
                            ImageURL = "https://www.google.com/recaptcha/api/image?c=" + End;
                        }
                        else
                        {
                            if (signUpPage.Contains("captchaAvailable&quot;:true"))
                            {
                                if (CaptchaCounter == 0)
                                {
                                    Log("[ " + DateTime.Now + " ] => [ Finding Capctha Again For " + Email + " ]");
                                    CaptchaCounter++;
                                    goto StartAgain;
                                }
                                Log("[ " + DateTime.Now + " ] => [ Cannot Find challenge Captcha on Page. Email : Password --> " + Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword + " ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.Path_CaptchaRequired);
                                //return;
                            }
                           
                        }
                    }
                    catch (Exception ex)
                    {
                        //Console.WriteLine("1 :" + ex.StackTrace);
                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- Getting Image Url --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                        GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- Getting Image Url >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
                    }

                    WebClient webclient = new WebClient();
                    try
                    {
                        int intIPPort = 80;
                        if (!string.IsNullOrEmpty(IPPort) && GlobusRegex.ValidateNumber(IPPort))
                        {
                            intIPPort = int.Parse(IPPort);
                        }
                        ChangeIP_WebClient(IPAddress, intIPPort, IPUsername, IPpassword, ref webclient);
                    }
                    catch (Exception ex)
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- ChangeIP_WebClient() --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                        GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- ChangeIP_WebClient() >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
                    }

                    try
                    {
                        int StartIndex = signUpPage.IndexOf("phx-signup-form");
                        if (StartIndex > 0)
                        {
                            string Start = signUpPage.Substring(StartIndex);
                            int EndIndex = Start.IndexOf("name=\"authenticity_token");
                            string End = Start.Substring(0, EndIndex).Replace("phx-signup-form", "").Replace("method=\"POST\"", "").Replace("action=\"https://twitter.com/account/create\"", "");
                            authenticitytoken = End.Replace("class=\"\">", "").Replace("<input type=\"hidden\"", "").Replace("class=\"\">", "").Replace("value=\"", "").Replace("\n", "").Replace("\"", "").Replace(" ", "");
                        }
                        else
                        {
                            //Log("Cannot find Authenticity Token On Page for : " + Email);
                            if (counter_AuthToken == 0)
                            {
                                Log("[ " + DateTime.Now + " ] => [ Retrying for Authenticity Token for : " + Email + " ]");
                                goto StartAgain;
                            }
                            else
                            {
                                Log("[ " + DateTime.Now + " ] => [ Cannot find Authenticity Token On Page, Exiting for : " + Email + " ]");
                                //Log("Couldn't create Account with : " + Email);
                                lock (Lock_notCreatedaccounts)
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_FailedCreatedAccounts);
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password, Globals.path_FailedCreatedAccountsOnlyEmailPass);
                                }

                                Globals.EnquequeDataForSignUp(new object[] { emailData, username, name, IP });

                                return;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        //Console.WriteLine("2 :" + ex.StackTrace);
                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- Getting Authenticity --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                        GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- Getting Authenticity >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
                    }
                    ////Posting data
                    try
                    {
                        //Sign Up
                        string postData_SignUp = "user%5Bname%5D=" + username + "&user%5Bemail%5D=" + Uri.EscapeDataString(Email) + "&user%5Buser_password%5D=" + Password + "&context=front&authenticity_token=" + authenticitytoken + "";
                        string res_PostSignUp = globusHelper.postFormData(new Uri("https://twitter.com/signup"), postData_SignUp, "", "", "", "", "");

                        int tempCount_usernameCheckLoop = 0;
                    usernameCheckLoop:
                        int tempCount_passwordCheckLoop = 0;

                        bool Created = true;
                        string url = "https://twitter.com/users/email_available?suggest=1&username=&full_name=&email=" + Uri.EscapeDataString(Email.Replace(" ", "")) + "&suggest_on_username=true&context=signup";
                        string EmailCheck = globusHelper.getHtmlfromUrlIP(new Uri(url), IPAddress, IPPort, IPUsername, IPpassword, "https://twitter.com/signup", "");
                        string Usernamecheck = globusHelper.getHtmlfromUrlIP(new Uri("https://twitter.com/users/username_available?suggest=1&username="******"&full_name=" + name + "&email=&suggest_on_username=true&context=signup"), IPAddress, IPPort, IPUsername, IPpassword, "https://twitter.com/signup", "");

                        if (EmailCheck.Contains("Email has already been taken. An email can only be used on one Twitter account at a time")
                            || (res_PostSignUp.Contains("You already have an account with this username and password")))
                        {
                            Log("[ " + DateTime.Now + " ] => [ Email : " + Email + " has already been taken. An email can only be used on one Twitter account at a time ]");
                            GlobusFileHelper.AppendStringToTextfileNewLine(emailData.Replace("\0", ""), Globals.path_EmailAlreadyTaken);
                            Created = false;
                        }
                        else if (Usernamecheck.Contains("Username has already been taken"))
                        {
                            //Created = false;
                            Log("[ " + DateTime.Now + " ] => [ Username : "******" has already been taken ]");
                            if (username.Count() > 12)
                            {
                                username = username.Remove(8); //Removes the extra characters
                            }

                            if (UsernameType == "String")
                            {
                                Log("[ " + DateTime.Now + " ] => [ Adding String To Username ]");
                                username = username + RandomStringGenerator.RandomString(5);
                            }
                            else if (UsernameType == "Numbers")
                            {
                                Log("[ " + DateTime.Now + " ] => [ Adding Numbers To Username ]");
                                username = username + RandomStringGenerator.RandomNumber(5);
                            }
                            else
                            {
                                Log("[ " + DateTime.Now + " ] => [ Adding Strings & Numbers To Username ]");
                                username = username + RandomStringGenerator.RandomStringAndNumber(5);
                            }

                            if (username.Count() > 15)
                            {
                                username = username.Remove(13); //Removes the extra characters
                            }
                            tempCount_usernameCheckLoop++;
                            if (tempCount_usernameCheckLoop < 5)
                            {
                                goto usernameCheckLoop;
                            }
                        }
                        else if (EmailCheck.Contains("You cannot have a blank email address"))
                        {
                            //Log("You cannot have a blank email address");
                            Created = false;
                            Globals.EnquequeDataForSignUp(new object[] { emailData, username, name, IP });
                        }

                        if (Created)
                        {
                            string AccountCreatePageSource = string.Empty;

                            string EscapeDataString_name = Uri.EscapeDataString(name);

                            //Replace Space (which unicode value is %20) in Pluse ....

                            EscapeDataString_name = EscapeDataString_name.Replace("%20", "+");

                            if (!string.IsNullOrEmpty(ImageURL))
                            {
                                try
                                {
                                    byte[] args = webclient.DownloadData(ImageURL);

                                    string captchaText = string.Empty;

                                    if (manualcaptch)
                                    {

                                    }
                                    else
                                    {
                                        string[] arr1 = new string[] { DBCUsername, DBCPAssword, "" };

                                        captchaText = DecodeDBC(arr1, args);
                                    }
                                    //string postdata = "authenticity_token=" + authenticitytoken + "&user%5Bname%5D=" + EscapeDataString_name + "&user%5Bemail%5D=" + Uri.EscapeDataString(Email.Replace(" ", "")) + "&user%5Buser_password%5D=" + System.Web.HttpUtility.UrlEncode(Password) + "&user%5Bscreen_name%5D=" + username + "&user%5Bremember_me_on_signup%5D=1&user%5Bremember_me_on_signup%5D=&context=front&ad_ref=&recaptcha_challenge_field=" + capcthavalue + "&recaptcha_response_field=" + System.Web.HttpUtility.UrlEncode(captchaText) + "&user%5Bdiscoverable_by_email%5D=1&user%5Bsend_email_newsletter%5D=1";
                                    string postdata = "authenticity_token=" + authenticitytoken + "&user%5Bname%5D=" + EscapeDataString_name + "&user%5Bemail%5D=" + Uri.EscapeDataString(Email.Replace(" ", "")) + "&user%5Buser_password%5D=" + System.Web.HttpUtility.UrlEncode(Password) + "&user%5Bscreen_name%5D=" + username + "&user%5Bremember_me_on_signup%5D=1&user%5Bremember_me_on_signup%5D=&context=front&ad_ref=&recaptcha_challenge_field=" + capcthavalue + "&recaptcha_response_field=" + System.Web.HttpUtility.UrlEncode(captchaText) + "&user%5Bdiscoverable_by_email%5D=1&user%5Bsend_email_newsletter%5D=1";

                                    try
                                    {
                                        AccountCreatePageSource = globusHelper.postFormData(new Uri("https://twitter.com/account/create"), postdata, "https://twitter.com/signup", "", "", "", "");
                                    }
                                    catch { };
                                    if (string.IsNullOrEmpty(AccountCreatePageSource))
                                    {
                                        Thread.Sleep(1000);
                                        AccountCreatePageSource = globusHelper.postFormData(new Uri("https://twitter.com/account/create"), postdata, "https://twitter.com/signup", "", "", "", "");
                                    }
                                }
                                catch (Exception ex)
                                {
                                    //Log(ex.Message);
                                    GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- Getting AccountCreatePageSource --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                                    GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- Getting AccountCreatePageSource >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
                                }
                            }
                            else
                            {
                                string postdata = "authenticity_token=" + authenticitytoken + "&user%5Bname%5D=" + EscapeDataString_name + "&user%5Bemail%5D=" + Email.Replace(" ", "").Replace("@", "%40") + "&user%5Buser_password%5D=" + Password + "&user%5Bscreen_name%5D=" + username + "&user%5Bremember_me_on_signup%5D=1&user%5Bremember_me_on_signup%5D=&user%5Buse_cookie_personalization%5D=1&asked_cookie_personalization_setting=1&context=front&ad_ref=&user%5Bdiscoverable_by_email%5D=1&user%5Bsend_email_newsletter%5D=1";
                                AccountCreatePageSource = globusHelper.postFormData(new Uri("https://twitter.com/account/create"), postdata, "https://twitter.com/signup", "", "", "", "");
                            }

                            //string postdata = "authenticity_token=" + authenticitytoken + "&user%5Bname%5D=" + name + "&user%5Bemail%5D=" + Email.Replace(" ", "") + "&user%5Buser_password%5D=" + Password + "&user%5Bscreen_name%5D=" + username + "&user%5Bremember_me_on_signup%5D=1&user%5Bremember_me_on_signup%5D=&context=&user%5Bdiscoverable_by_email%5D=1&user%5Bsend_email_newsletter%5D=1";
                            //string AccountCreatePageSource = globusHelper.postFormData(new Uri("https://twitter.com/account/create"), postdata, "https://twitter.com/signup", "", "", "", "");

                            if (AccountCreatePageSource.Contains("id=\"signout-form\"") && AccountCreatePageSource.Contains("/logout") && AccountCreatePageSource.Contains("id=\"signout-button")
                                || AccountCreatePageSource.Contains("/welcome/recommendations" + username))
                            {
                                Log("[ " + DateTime.Now + " ] => [ Account created With Email :" + Email + " ]");
                                lock (Lock_Createdaccounts)
                                {
                                    //GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + username + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_SuccessfulCreatedAccounts);
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_SuccessfulCreatedAccounts);
                                }
                                NoOfSuccessfullyCreatedAccount++;
                                //After Account creation
                                if (Created)
                                {
                                    try
                                    {
                                        if (!Globals.IsUseFakeEmailAccounts)
                                        {
                                            Log("[ " + DateTime.Now + " ] => [ Going for Email Verification : " + Email + " ]");
                                            Thread.Sleep(5000);

                                            ClsEmailActivator EmailActivate = new ClsEmailActivator();
                                            bool verified = EmailActivate.EmailVerification(Email.Replace(" ", ""), Password, ref globusHelper);
                                            if (verified)
                                            {
                                                GlobusFileHelper.AppendStringToTextfileNewLine(emailData.Replace("\0", "") + ":" + username + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_EmailVerifiedAccounts);
                                                Log("[ " + DateTime.Now + " ] => [ Account Verified : " + Email + " ]");
                                            }
                                            else
                                            {
                                                GlobusFileHelper.AppendStringToTextfileNewLine(emailData.Replace("\0", "") + ":" + username + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_NonEmailVerifiedAccounts);
                                                Log("[ " + DateTime.Now + " ] => [ Account Couldn't be Email Verified : " + Email + " ]");
                                            }

                                        }

                                        try
                                        {
                                            string checkPageSource = globusHelper.getHtmlfromUrl(new Uri("https://twitter.com/"), "", "");

                                            string pstAuthToken = PostAuthenticityToken(checkPageSource, "postAuthenticityToken");

                                            #region Profilig Of new created account
                                            try
                                            {
                                                new Thread(() =>
                                                {
                                                    startProfilingAfterAccountCreation(new object[] { Email, Password, IPAddress, IPPort, IPUsername, IPpassword, pstAuthToken, globusHelper });
                                                }).Start();
                                            }
                                            catch (Exception)
                                            {
                                            }
                                            #endregion

                                            #region for Follow

                                            try
                                            {
                                                Follow(ref globusHelper, Email, pstAuthToken);
                                            }
                                            catch (Exception)
                                            {
                                            }

                                            #endregion

                                        }
                                        catch (Exception)
                                        {
                                        }

                                        clsFBAccount insertUpdateDataBase = new clsFBAccount();
                                        insertUpdateDataBase.InsertUpdateFBAccount(Email.Replace(" ", ""), Password, username, IPAddress, IPPort, IPUsername, IPpassword, "", "");
                                    }
                                    catch (Exception ex)
                                    {
                                        //Log(ex.Message);
                                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- Getting After Account creation --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- Getting After Account creation >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
                                    }
                                }
                            }
                            else if (AccountCreatePageSource.Contains("/welcome/recommendations"))
                            {
                                Log("[ " + DateTime.Now + " ] => [ Account created With Email :" + Email + " ]");
                                lock (Lock_Createdaccounts)
                                {
                                    //GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + username + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_SuccessfulCreatedAccounts);
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_SuccessfulCreatedAccounts);
                                }
                                NoOfSuccessfullyCreatedAccount++;
                                //After Account creation
                                if (Created)
                                {
                                    try
                                    {
                                        if (!Globals.IsUseFakeEmailAccounts)
                                        {
                                            Log("[ " + DateTime.Now + " ] => [ Going for Email Verification : " + Email + " ]");
                                            Thread.Sleep(5000);

                                            ClsEmailActivator EmailActivate = new ClsEmailActivator();
                                            bool verified = EmailActivate.EmailVerification(Email.Replace(" ", ""), Password, ref globusHelper);
                                            if (verified)
                                            {
                                                GlobusFileHelper.AppendStringToTextfileNewLine(emailData.Replace("\0", "") + ":" + username + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_EmailVerifiedAccounts);
                                                Log("[ " + DateTime.Now + " ] => [ Account Verified : " + Email + " ]");
                                            }
                                            else
                                            {
                                                GlobusFileHelper.AppendStringToTextfileNewLine(emailData.Replace("\0", "") + ":" + username + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_NonEmailVerifiedAccounts);
                                                Log("[ " + DateTime.Now + " ] => [ Account Couldn't be Email Verified : " + Email + " ]");
                                            }
                                        }


                                        try
                                        {
                                            string checkPageSource = globusHelper.getHtmlfromUrl(new Uri("https://twitter.com/"), "", "");

                                            string pstAuthToken = PostAuthenticityToken(checkPageSource, "postAuthenticityToken");

                                            #region Profilig Of new created account
                                            try
                                            {
                                                new Thread(() =>
                                                {
                                                    startProfilingAfterAccountCreation(new object[] { Email, Password, IPAddress, IPPort, IPUsername, IPpassword, pstAuthToken, globusHelper });
                                                }).Start();
                                            }
                                            catch (Exception)
                                            {
                                            }
                                            #endregion

                                            #region for Follow

                                            try
                                            {
                                                Follow(ref globusHelper, Email, pstAuthToken);
                                            }
                                            catch (Exception)
                                            {
                                            }

                                            #endregion

                                        }
                                        catch (Exception)
                                        {
                                        }

                                        clsFBAccount insertUpdateDataBase = new clsFBAccount();
                                        insertUpdateDataBase.InsertUpdateFBAccount(Email.Replace(" ", ""), Password, username, IPAddress, IPPort, IPUsername, IPpassword, "", "");
                                    }
                                    catch (Exception ex)
                                    {
                                        //Log(ex.Message);
                                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- Getting After Account creation --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- Getting After Account creation >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
                                    }
                                }
                            }
                            else if (AccountCreatePageSource.ToLower().Contains("password is too obvious") || AccountCreatePageSource.ToLower().Contains("\"active error\">password"))
                            {
                                NoOfNonCreatedAccounts++;
                                tempCount_passwordCheckLoop = 0;
                                if (Password.Count() > 8)
                                {
                                    Password = Password.Remove(8); //Removes the extra characters
                                }
                                Password = Password + RandomStringGenerator.RandomString(3);
                                if (Password.Count() > 12)
                                {
                                    Password = Password.Remove(12); //Removes the extra characters
                                }
                                tempCount_passwordCheckLoop++;
                                if (tempCount_passwordCheckLoop < 5)
                                {
                                    goto usernameCheckLoop;
                                }
                                //Password = Password + RandomStringGenerator.RandomString(3);
                                Log("[ " + DateTime.Now + " ] => [ Please Create Accounts With Secure Password ]");
                                Log("[ " + DateTime.Now + " ] => [ Password is too obvious ]");
                                Log("[ " + DateTime.Now + " ] => [ Email : Password --> " + Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword + " ]");
                                goto usernameCheckLoop;
                                //return;
                            }
                            else if (AccountCreatePageSource.Contains("/sessions/destroy") && AccountCreatePageSource.Contains("/signup"))
                            {
                                lock (Lock_notCreatedaccounts)
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_FailedCreatedAccounts);
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password, Globals.path_FailedCreatedAccountsOnlyEmailPass);
                                }
                                NoOfNonCreatedAccounts++;
                                NoOfNonCreatedAccountsIP++;
                                Log("[ " + DateTime.Now + " ] => [ You can't do that right now. ]");
                                Log("[ " + DateTime.Now + " ] => [ Sorry, please try again later ]");
                                Log("[ " + DateTime.Now + " ] => [ and Change IP to create more accounts. ]");

                                Globals.EnquequeDataForSignUp(new object[] { emailData, username, name, IP });

                                return;
                            }
                            else
                            {
                                Globals.EnquequeDataForSignUp(new object[] { emailData, username, name, IP });
                                lock (Lock_notCreatedaccounts)
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_FailedCreatedAccounts);
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password, Globals.path_FailedCreatedAccountsOnlyEmailPass);
                                }
                                NoOfNonCreatedAccounts++;
                                Log("[ " + DateTime.Now + " ] => [ Couldn't create Account ]");
                                Log("[ " + DateTime.Now + " ] => [ Email : Password --> " + Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword + " ]");
                            }
                            //if (Created)
                            //{
                            //    Log("Going for Email Verification : " + Email);
                            //    Thread.Sleep(5000);

                            //    ClsEmailActivator EmailActivate = new ClsEmailActivator();
                            //    bool verified = EmailActivate.EmailVerification(Email.Replace(" ", ""), Password, ref globusHelper);
                            //    if (verified)
                            //    {
                            //        GlobusFileHelper.AppendStringToTextfileNewLine(emailData, Globals.path_SuccessfulCreatedAccounts);
                            //        Log("Account Verified : " + Email);
                            //    }
                            //    else
                            //    {
                            //        GlobusFileHelper.AppendStringToTextfileNewLine(emailData, Globals.path_NonEmailVerifiedAccounts);
                            //        Log("Account Couldn't be Email Verified : " + Email);
                            //    }
                            //}
                        }
                        else
                        {
                            NoOfNonCreatedAccounts++;

                            if (EmailCheck.Contains("Email has already been taken. An email can only be used on one Twitter account at a time"))
                            {
                                NoOfAlreadyCreatedAccounts++;
                                Log("[ " + DateTime.Now + " ] => [ " + Email + " : Email has already been taken. ]");
                                Log("[ " + DateTime.Now + " ] => [ An email can only be used on one Twitter account at a time ]");
                                GlobusFileHelper.AppendStringToTextfileNewLine(emailData.Replace("\0", ""), Globals.path_EmailAlreadyTaken);
                            }
                            else if (Usernamecheck.Contains("Username has already been taken"))
                            {
                                Log("[ " + DateTime.Now + " ] => [ " + username + " : Username has already been taken ]");
                                Globals.EnquequeDataForSignUp(new object[] { emailData, username, name, IP });
                            }
                            else if (EmailCheck.Contains("You cannot have a blank email address"))
                            {
                                Log("[ " + DateTime.Now + " ] => [ " + Email + " : You cannot have a blank email address ]");
                                Globals.EnquequeDataForSignUp(new object[] { emailData, username, name, IP });
                            }
                            else
                            {
                                ExportFailedAccounts(Email, Password, IPAddress, IPPort, IPUsername, IPpassword);
                                Globals.EnquequeDataForSignUp(new object[] { emailData, username, name, IP });
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        NoOfNonCreatedAccounts++;
                        lock (Lock_notCreatedaccounts)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_FailedCreatedAccounts);
                            GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password, Globals.path_FailedCreatedAccountsOnlyEmailPass);
                        }
                        GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- Posting data --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                        GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- Posting data >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);

                        Globals.EnquequeDataForSignUp(new object[] { emailData, username, name, IP });
                    }
                }
                catch (Exception ex)
                {
                    NoOfNonCreatedAccounts++;
                    lock (Lock_notCreatedaccounts)
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_FailedCreatedAccounts);
                        GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password, Globals.path_FailedCreatedAccountsOnlyEmailPass);
                    }
                    //GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.path_FailedCreatedAccounts);
                    //Console.WriteLine("4 : " + ex.Message);
                    GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- SignupMultiThreaded Start --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                    GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- SignupMultiThreaded Start >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);

                    Globals.EnquequeDataForSignUp(new object[] { emailData, username, name, IP });
                }
                finally
                {
                    CountOfAccounts++;
                    if (CountOfAccounts >= TotalEmailUploaded)
                    {
                        Log("[ " + DateTime.Now + " ] => [ Account Creation Finished ]");
                        Log("[ " + DateTime.Now + " ] => [ No Of SuccessFully Created Accounts : " + NoOfSuccessfullyCreatedAccount + " ]");
                        Log("[ " + DateTime.Now + " ] => [ No Of Non Created Accounts : " + NoOfNonCreatedAccounts + " ]");
                    }

                    //Log("SuccessFully Created Accounts Count: " + NoOfSuccessfullyCreatedAccount);
                    //Log("Failed Accounts Count: " + NoOfNonCreatedAccounts);
                    //Log("Already Created Accounts Count: " + NoOfAlreadyCreatedAccounts);
                    //Log("Failed Proxies Count: " + NoOfNonCreatedAccountsIP);
                }
                
            }
            catch
            {
            }
        }
コード例 #8
0
        public void PostGroupMsgUpdate(ref LinkedinUser objLnkedinUser)
        {
            try
            {
                if (objLnkedinUser.isloggedin)
                {
                    GlobusHttpHelper HttpHelper  = objLnkedinUser.globusHttpHelper;
                    string           postdata    = string.Empty;
                    string           postUrl     = string.Empty;
                    string           ResLogin    = string.Empty;
                    string           csrfToken   = string.Empty;
                    string           sourceAlias = string.Empty;
                    string           referal     = string.Empty;

                    string ReturnString       = string.Empty;
                    string PostGrpDiscussion  = string.Empty;
                    string PostGrpMoreDetails = string.Empty;
                    string PostGrpAttachLink  = string.Empty;
                    string PostGrpKey         = string.Empty;

                    try
                    {
                        string MessageText   = string.Empty;
                        string PostedMessage = string.Empty;
                        string pageSource    = string.Empty;

                        pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));

                        if (pageSource.Contains("csrfToken"))
                        {
                            string pattern = @"\";
                            csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50);
                            string[] Arr = csrfToken.Split('&');
                            csrfToken = Arr[0];
                            csrfToken = csrfToken.Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty);
                            csrfToken = csrfToken.Replace(pattern, string.Empty.Trim());
                        }

                        if (pageSource.Contains("sourceAlias"))
                        {
                            string pattern1 = @"\";
                            sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                            string[] Arr = sourceAlias.Split('"');
                            sourceAlias = Arr[2];
                            sourceAlias = sourceAlias.Replace(pattern1, string.Empty.Trim());
                        }

                        try
                        {
                            foreach (var Itegid in GlobalsGroups.SelectedGroups)
                            {
                                string[] grpNameWithDetails = Itegid.Split('^');

                                try
                                {
                                    lock (Locked_GrpKey_Post)
                                    {
                                        if (GlobalsGroups.Que_GrpKey_Post.Count > 0)
                                        {
                                            try
                                            {
                                                PostGrpKey = GlobalsGroups.Que_GrpKey_Post.Dequeue();
                                            }
                                            catch { }
                                        }
                                    }

                                    lock (Locked_GrpPostTitle_Post)
                                    {
                                        if (GlobalsGroups.Que_GrpPostTitle_Post.Count > 0)
                                        {
                                            try
                                            {
                                                PostGrpDiscussion = GlobalsGroups.Que_GrpPostTitle_Post.Dequeue();
                                            }
                                            catch { }
                                        }
                                    }

                                    lock (Locked_GrpMoreDtl_Post)
                                    {
                                        if (GlobalsGroups.Que_GrpMoreDtl_Post.Count > 0)
                                        {
                                            try
                                            {
                                                PostGrpMoreDetails = GlobalsGroups.Que_GrpMoreDtl_Post.Dequeue();
                                                //Que_GrpMoreDtl_Post.Clear();
                                            }
                                            catch { }
                                        }
                                    }

                                    lock (Locked_Que_GrpAttachLink_Post)
                                    {
                                        if (GlobalsGroups.Que_GrpAttachLink_Post.Count > 0)
                                        {
                                            try
                                            {
                                                PostGrpAttachLink = GlobalsGroups.Que_GrpAttachLink_Post.Dequeue();
                                            }
                                            catch { }
                                        }
                                    }

                                    string[] grpDisplay = Itegid.Split('^');
                                    string   GrpName    = grpDisplay[0].ToString().Replace("[", string.Empty).Trim();
                                    string[] PostGid    = grpDisplay[1].Replace("]", string.Empty).Split(',');
                                    string   Gid        = string.Empty;

                                    //        HJKHKJH

                                    try
                                    {
                                        if (NumberHelper.ValidateNumber(PostGid[1].Trim()))
                                        {
                                            Gid = PostGid[1].Trim();
                                        }
                                        else if (NumberHelper.ValidateNumber(PostGid[2].Trim()))
                                        {
                                            Gid = PostGid[2].Trim();
                                        }
                                        else if (NumberHelper.ValidateNumber(PostGid[3].Trim()))
                                        {
                                            Gid = PostGid[3].Trim();
                                        }
                                        else if (NumberHelper.ValidateNumber(PostGid[4].Trim()))
                                        {
                                            Gid = PostGid[4].Trim();
                                        }
                                        else if (NumberHelper.ValidateNumber(PostGid[5].Trim()))
                                        {
                                            Gid = PostGid[5].Trim();
                                        }
                                        else if (NumberHelper.ValidateNumber(PostGid[6].Trim()))
                                        {
                                            Gid = PostGid[6].Trim();
                                        }
                                        else if (NumberHelper.ValidateNumber(PostGid[7].Trim()))
                                        {
                                            Gid = PostGid[7].Trim();
                                        }
                                        else if (NumberHelper.ValidateNumber(PostGid[8].Trim()))
                                        {
                                            Gid = PostGid[8].Trim();
                                        }
                                        else if (NumberHelper.ValidateNumber(PostGid[9].Trim()))
                                        {
                                            Gid = PostGid[9].Trim();
                                        }
                                        else if (NumberHelper.ValidateNumber(PostGid[10].Trim()))
                                        {
                                            Gid = PostGid[10].Trim();
                                        }
                                        else if (NumberHelper.ValidateNumber(PostGid[11].Trim()))
                                        {
                                            Gid = PostGid[11].Trim();
                                        }
                                        else if (NumberHelper.ValidateNumber(PostGid[12].Trim()))
                                        {
                                            Gid = PostGid[12].Trim();
                                        }
                                    }
                                    catch { }

                                    //string ReqUrl = PostGrpAttachLink;
                                    string ReqUrl = PostGrpMoreDetails;
                                    ReqUrl  = ReqUrl.Replace(":", "%3A").Replace("//", "%2F%2F");
                                    referal = "http://www.linkedin.com/groups/" + grpDisplay[2].Replace(" ", "-") + "-" + Gid + "?goback=%2Egmr_" + Gid;
                                    string GetStatus = HttpHelper.getHtmlfromUrl(new Uri("http://www.linkedin.com/share?getPreview=&url=" + ReqUrl), referal);

                                    string ImgCount = string.Empty;
                                    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";
                                    }

                                    string LogoUrl = string.Empty;
                                    try
                                    {
                                        int    StartinImgUrl  = GetStatus.IndexOf("url");
                                        string startImgUrl    = GetStatus.Substring(StartinImgUrl);
                                        int    EndIndexImgUrl = startImgUrl.IndexOf("border=");
                                        string EndImgUrl      = startImgUrl.Substring(0, EndIndexImgUrl).Replace("value\":", "").Replace("\"", "");
                                        LogoUrl = EndImgUrl.Replace("url=", string.Empty).Trim();
                                    }
                                    catch
                                    {
                                        LogoUrl = "false";
                                    }

                                    string EntityId = string.Empty;
                                    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).Trim();
                                    }
                                    catch { }

                                    string contentTitle = string.Empty;
                                    try
                                    {
                                        int    StartinContent  = GetStatus.IndexOf("share-view-title");
                                        string startContent    = GetStatus.Substring(StartinContent);
                                        int    EndIndexContent = startContent.IndexOf("</h4>");
                                        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("&", "and").Replace("amp;", string.Empty).Trim();

                                        if (contentTitle.Contains("#"))
                                        {
                                            contentTitle = contentTitle.Replace("and", "&");
                                            contentTitle = Uri.EscapeDataString(contentTitle);
                                        }
                                    }
                                    catch { }

                                    string contentSummary = string.Empty;
                                    try
                                    {
                                        int    StartinConSumm  = GetStatus.IndexOf("share-view-summary\">");
                                        string startConSumm    = GetStatus.Substring(StartinConSumm);
                                        int    EndIndexConSumm = startConSumm.IndexOf("</span>");
                                        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");

                                        if (contentSummary.Contains("#"))
                                        {
                                            contentSummary = contentSummary.Replace("and", "&");
                                            contentSummary = Uri.EscapeDataString(contentSummary);
                                        }
                                    }
                                    catch { }

                                    string PostGroupstatus   = string.Empty;
                                    string ResponseStatusMsg = string.Empty;
                                    csrfToken = csrfToken.Replace("<meta http-", "").Replace(">", "").Trim();
                                    try
                                    {
                                        //PostGroupstatus = "csrfToken=" + csrfToken + "&postTitle=" + PostGrpDiscussion + "&postText=" + PostGrpMoreDetails + "&pollChoice1-ANetPostForm=&pollChoice2-ANetPostForm=&pollChoice3-ANetPostForm=&pollChoice4-ANetPostForm=&pollChoice5-ANetPostForm=&pollEndDate-ANetPostForm=0&contentImageCount=0&contentImageIndex=-1&contentImage=&contentEntityID=&contentUrl=&contentTitle=&contentSummary=&contentImageIncluded=true&%23=&gid=" + Gid.Trim() + "&postItem=&ajax=true&tetherAccountID=&facebookTetherID=";
                                        PostGroupstatus   = "csrfToken=" + csrfToken + "&postTitle=" + PostGrpDiscussion + "&postText=" + PostGrpMoreDetails + "&pollChoice1-ANetPostForm=&pollChoice2-ANetPostForm=&pollChoice3-ANetPostForm=&pollChoice4-ANetPostForm=&pollChoice5-ANetPostForm=&pollEndDate-ANetPostForm=0&contentImageCount=" + ImgCount + "&contentImageIndex=-1&contentImage=" + LogoUrl + "&contentEntityID=" + EntityId + "&contentUrl=" + ReqUrl + "&contentTitle=" + contentTitle + "&contentSummary=" + contentSummary + "&contentImageIncluded=true&%23=&gid=" + Gid + "&postItem=&ajax=true&tetherAccountID=&facebookTetherID=";
                                        ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groups"), PostGroupstatus);
                                    }
                                    catch { }
                                    #region written by sharan
                                    try
                                    {
                                        string PagesourceProfile = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/profile/view?id=394473043&trk=nav_responsive_tab_profile"));
                                        string GoBackValue       = string.Empty;
                                        string Url = string.Empty;
                                        if (PagesourceProfile.Contains("&goback="))
                                        {
                                            GoBackValue = Utils.getBetween(PagesourceProfile, "&goback=", "&").Trim();
                                            Url         = "https://www.linkedin.com/grp/home?gid=" + Gid + "&goback=" + GoBackValue;
                                        }

                                        PostGroupstatus   = "csrfToken=" + csrfToken + "&title=" + PostGrpDiscussion + "&details=" + PostGrpMoreDetails + "&groupId=" + Gid + "&displayCategory=DISCUSSION";
                                        ResponseStatusMsg = HttpHelper.postFormDataRef(new Uri("https://www.linkedin.com/grp/postForm/submit"), PostGroupstatus, Url, "", "");
                                    }
                                    catch (Exception ex)
                                    {
                                    }

                                    #endregion

                                    string CSVHeader = "UserName" + "," + "HeaderPost" + "," + "Details Post" + "," + "ToGroup";

                                    if (ResponseStatusMsg.Contains("SUCCESS") || ResponseStatusMsg.Contains("Accept  the description According to you"))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Header Posted : " + PostGrpDiscussion + " Successfully on Group : " + grpDisplay[2] + " ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message More Details Posted : " + PostGrpMoreDetails + " Successfully on Group : " + grpDisplay[2] + " ]");

                                        string CSV_Content = objLnkedinUser.username + "," + PostGrpDiscussion.Replace(",", ";") + "," + PostGrpMoreDetails.Replace(",", ";") + "," + grpDisplay[2].Replace(",", string.Empty);
                                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, FilePath.path_GroupUpdates);
                                    }
                                    else if (ResponseStatusMsg.Contains("Your request to join is still pending"))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Your membership is pending approval on a Group:" + grpDisplay[2] + " ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Header: " + PostGrpDiscussion + " Not Posted on Group:" + grpDisplay[2] + " Because Your membership is pending for approval. ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message More Details: " + PostGrpMoreDetails + " Not Posted on Group:" + grpDisplay[2] + " Because Your membership is pending for approval. ]");

                                        GlobusFileHelper.AppendStringToTextfileNewLine("Your membership is pending approval on a Group:" + grpDisplay[2], FilePath.path_GroupUpdate);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Message Header: " + PostGrpDiscussion + " Not Posted on Group:" + grpDisplay[2] + " Because Your membership is pending for approval. ", FilePath.path_GroupUpdate);
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Message More Details: " + PostGrpMoreDetails + " Not Posted on Group:" + grpDisplay[2] + " Because Your membership is pending for approval. ", FilePath.path_GroupUpdate);
                                    }
                                    else if (ResponseStatusMsg.Contains("Your post has been submitted for review"))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Header Posted : " + PostGrpDiscussion + " Successfully on Group : " + grpDisplay[2] + " ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message More Details Posted : " + PostGrpMoreDetails + " Successfully on Group : " + grpDisplay[2] + " ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Your post has been submitted for review ]");
                                        string CSV_Content = objLnkedinUser.username + "," + PostGrpDiscussion.Replace(",", ";") + "," + PostGrpMoreDetails.Replace(",", ";") + "," + grpDisplay[2];
                                    }
                                    else if (ResponseStatusMsg.Contains("Error"))
                                    {
                                        //Log("[ " + DateTime.Now + " ] => [ Error in Post ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error in Post", FilePath.path_GroupUpdate);
                                    }
                                    else
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Not Posted ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Message Not Posted", FilePath.path_GroupUpdate);
                                    }

                                    int delay = RandomNumberGenerator.GenerateRandom(GlobalsGroups.minDelay, GlobalsGroups.maxDelay);
                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                                    Thread.Sleep(delay * 1000);
                                }
                                catch (Exception ex)
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace + "    Stack Trace >>> " + ex.StackTrace, FilePath.Path_LinkedinGetGroupMemberErrorLogs);
                                    //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, FilePath.Path_LinkedinErrorLogs);
                            GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---1--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, FilePath.Path_LinkedinGetGroupMemberErrorLogs);
                            // Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                        }
                    }
                    catch (Exception ex)
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, FilePath.Path_LinkedinErrorLogs);
                        GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Group Update --> cmbGroupUser_SelectedIndexChanged() ---2--->>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, FilePath.Path_LinkedinGetGroupMemberErrorLogs);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #9
0
ファイル: AccountManager.cs プロジェクト: shah8701/faceboard
 private void OkayModified(GlobusHttpHelper HttpHelper, string fb_dtsg, string temp_nh)
 {
     #region Clickon This Is okay
     try
     {
         string postForThisIsOkay = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&submit%5BOkay%5D=Okay";
         string ResponseDatapostForThisIsOkay = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointNextUrl), postForThisIsOkay, FBGlobals.Instance.AccountVerificationCheckpointUrl);
     }
     catch (Exception ex)
     {
         GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
     }
     #endregion
 }
コード例 #10
0
ファイル: AccountManager.cs プロジェクト: shah8701/faceboard
        private static void Skip(GlobusHttpHelper HttpHelper, string fb_dtsg, string temp_nh)
        {
            try
            {
                string postForSkip = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&submit%5BSkip%5D=Skip";
                string ResponseDatapostForSkip = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), postForSkip, FBGlobals.Instance.AccountVerificationCheckpointUrl);
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

            }
        }
コード例 #11
0
ファイル: AccountManager.cs プロジェクト: shah8701/faceboard
        private bool BirthdaySolving(ref FacebookUser fbUser, ref GlobusHttpHelper HttpHelper, ref string birthdayResponse)
        {
            try
            {
                string captchaimageurl = string.Empty;
                string captcha_persist_data = string.Empty;
                string googlecaptcha = string.Empty;
                string captcha_session = "";
                string extra_challenge_params = "";
                string fb_dtsg = "";

                fb_dtsg = GlobusHttpHelper.Get_fb_dtsg(birthdayResponse);
                fb_dtsg = Uri.EscapeDataString(fb_dtsg);

                string temp_nh = birthdayResponse.Substring(birthdayResponse.IndexOf("name=\"nh\" value="), (birthdayResponse.IndexOf(">", birthdayResponse.IndexOf("name=\"nh\" value=")) - birthdayResponse.IndexOf("name=\"nh\" value="))).Replace("name=\"nh\" value=", string.Empty).Trim().Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim();
                if (birthdayResponse.Contains("captcha_persist_data"))
                {
                    try
                    {
                        string[] facebookcaptcha_persistdata = Regex.Split(birthdayResponse, "id=\"captcha_persist_data");
                        captcha_persist_data = facebookcaptcha_persistdata[1].Substring(facebookcaptcha_persistdata[1].IndexOf("value="), (facebookcaptcha_persistdata[1].IndexOf(">", facebookcaptcha_persistdata[1].IndexOf("value=")) - facebookcaptcha_persistdata[1].IndexOf("value="))).Replace("value=", string.Empty).Trim().Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim();
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                    }
                }

                if (birthdayResponse.Contains(" please enter your birthday"))
                {
                    try
                    {
                        string[] BirthArr = Regex.Split(fbUser.dateOfBirth, "-");
                        string temp_month = string.Empty;
                        string temp_date = string.Empty;
                        string temp_year = string.Empty;
                        if (BirthArr.Count() > 1)
                        {
                            temp_month = BirthArr[0];
                            temp_date = BirthArr[1];
                            temp_year = BirthArr[2];
                        }
                        string achal = string.Empty;
                        try
                        {
                            string[] achalArr = Regex.Split(birthdayResponse, "name=\"achal\"");
                            achal = achalArr[1].Substring(achalArr[1].IndexOf("value="), (achalArr[1].IndexOf(">", achalArr[1].IndexOf("value=")) - achalArr[1].IndexOf("value="))).Replace("value=", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Replace(";", string.Empty).Trim();
                            if (string.IsNullOrEmpty(achal))
                            {
                                achal = "2";
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }

                        try
                        {
                            string PostDataAfterenterdateofBirth = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&geo=true&birthday_captcha_month=" + temp_month + "&birthday_captcha_day=" + temp_date + "&birthday_captcha_year=" + temp_year + "&captcha_persist_data=" + captcha_persist_data + "&achal=2&submit%5BSubmit%5D=Submit";
                            string ResponseDataAfterenterdateofBirth = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), PostDataAfterenterdateofBirth, FBGlobals.Instance.AccountVerificationCheckpointUrl);

                            if (ResponseDataAfterenterdateofBirth.Contains("You took too much time to complete the security challenge"))
                            {

                                GlobusLogHelper.log.Info("You took too much time to complete the security challenge : " + fbUser.username);
                                GlobusLogHelper.log.Debug("You took too much time to complete the security challenge : " + fbUser.username);

                                return false;

                            }

                            if (ResponseDataAfterenterdateofBirth.Contains("Create a New Password") || ResponseDataAfterenterdateofBirth.Contains("please select a new password"))
                            {
                                string NewPassword = fbUser.password + "123";
                                string postDataForCreateNewPassword = "******" + fb_dtsg + "&nh=" + temp_nh + "&new_pass="******"&confirm_pass="******"&submit%5BSubmit%5D=Submit";
                                string ResponseForCreateNewPassword = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), postDataForCreateNewPassword, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                                if (ResponseForCreateNewPassword.Contains("www.facebook.com/welcomeback") || ResponseForCreateNewPassword.Contains("sk=welcome") || ResponseForCreateNewPassword.Contains("Redirecting.."))
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine(fbUser.username + ":" + fbUser.password + ":" + fbUser.proxyip + ":" + fbUser.proxyport + ":" + fbUser.proxyusername + ":" + fbUser.password, exportFilePathAccountVerification + "\\SecuritySolvedChangePassword.txt");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(fbUser.username + ":" + fbUser.password + ":" + fbUser.proxyip + ":" + fbUser.proxyport + ":" + fbUser.proxyusername + ":" + fbUser.password, exportFilePathAccountVerification + "\\SecuritySolved.txt");

                                    GlobusLogHelper.log.Info("Your Username : "******" Entered New Password : "******"Your Username : "******" Entered New Password : "******":" + fbUser.password + ":" + fbUser.proxyip + ":" + fbUser.proxyport + ":" + fbUser.proxyusername + ":" + fbUser.password, exportFilePathAccountVerification + "\\SecuritynotSolved.txt");

                                    GlobusLogHelper.log.Info("Your Username : "******" Entered New Password : "******"Your Username : "******" Entered New Password : "******"Error : " + ex.StackTrace);

                            }
                            #endregion

                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                        }
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                    }
                }

                string tempPostUrl = FBGlobals.Instance.AccountVerificationCheckpointUrl;
                string temppostdata = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&submit%5BContinue%5D=Continue";
                string tempresponse = HttpHelper.postFormData(new Uri(tempPostUrl), temppostdata);
                string[] captchpersist = Regex.Split(tempresponse, "id=\"captcha_persist_data");

                if (tempresponse.Contains("captcha_persist_data"))
                {
                    try
                    {
                        string[] facebookcaptcha_persistdata = Regex.Split(tempresponse, "id=\"captcha_persist_data");
                        captcha_persist_data = facebookcaptcha_persistdata[1].Substring(facebookcaptcha_persistdata[1].IndexOf("value="), (facebookcaptcha_persistdata[1].IndexOf(">", facebookcaptcha_persistdata[1].IndexOf("value=")) - facebookcaptcha_persistdata[1].IndexOf("value="))).Replace("value=", string.Empty).Trim().Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim();
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                    }
                }
                if (tempresponse.Contains("captcha_session"))
                {
                    try
                    {
                        string captcha_session_val = tempresponse.Substring(tempresponse.IndexOf("captcha_session"), 200);
                        string[] Arr_captcha_session_val = captcha_session_val.Split('"');
                        captcha_session = Arr_captcha_session_val[4];
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }
                }
                if (tempresponse.Contains("extra_challenge_params"))
                {
                    try
                    {
                        string extra_challenge_params_val = tempresponse.Substring(tempresponse.IndexOf("extra_challenge_params"), 500);
                        string[] Arr_extra_challenge_params_val = extra_challenge_params_val.Split('"');
                        string authp_pisg_nonce_tt = Arr_extra_challenge_params_val[4];
                        extra_challenge_params = Arr_extra_challenge_params_val[4];
                        extra_challenge_params = extra_challenge_params.Replace("=", "%3D");
                        extra_challenge_params = extra_challenge_params.Replace("&amp;", "%26");
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }
                }

                if (tempresponse.Contains("please enter your birthday"))
                {
                    try
                    {
                        string[] BirthArr = Regex.Split(fbUser.dateOfBirth, "-");
                        string temp_month = string.Empty;
                        string temp_date = string.Empty;
                        string temp_year = string.Empty;

                        if (BirthArr.Count() > 1)
                        {
                            temp_month = BirthArr[0];
                            temp_date = BirthArr[1];
                            temp_year = BirthArr[2];
                        }
                        string achal = string.Empty;
                        try
                        {
                            string[] achalArr = Regex.Split(tempresponse, "name=\"achal\"");
                            achal = achalArr[1].Substring(achalArr[1].IndexOf("value="), (achalArr[1].IndexOf(">", achalArr[1].IndexOf("value=")) - achalArr[1].IndexOf("value="))).Replace("value=", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Replace(";", string.Empty).Trim();
                            if (string.IsNullOrEmpty(achal))
                            {
                                achal = "2";
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }

                        try
                        {
                            string PostDataAfterenterdateofBirth = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&geo=true&birthday_captcha_month=" + temp_month + "&birthday_captcha_day=" + temp_date + "&birthday_captcha_year=" + temp_year + "&captcha_persist_data=" + captcha_persist_data + "&achal=2&submit%5BSubmit%5D=Submit";
                            string ResponseDataAfterenterdateofBirth = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), PostDataAfterenterdateofBirth, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                            if (ResponseDataAfterenterdateofBirth.Contains("Create a New Password") || ResponseDataAfterenterdateofBirth.Contains("please select a new password"))
                            {
                                string NewPassword = fbUser.password + "123";
                                string postDataForCreateNewPassword = "******" + fb_dtsg + "&nh=" + temp_nh + "&new_pass="******"&confirm_pass="******"&submit%5BSubmit%5D=Submit";
                                string ResponseForCreateNewPassword = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), postDataForCreateNewPassword, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                                if (ResponseForCreateNewPassword.Contains("www.facebook.com/welcomeback") || ResponseForCreateNewPassword.Contains("sk=welcome") || ResponseForCreateNewPassword.Contains("Redirecting.."))
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine(fbUser.username + ":" + fbUser.password + ":" + fbUser.proxyip + ":" + fbUser.proxyport + ":" + fbUser.proxyusername + ":" + fbUser.password, exportFilePathAccountVerification + "\\SecuritySolvedChangePassword.txt");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(fbUser.username + ":" + fbUser.password + ":" + fbUser.proxyip + ":" + fbUser.proxyport + ":" + fbUser.proxyusername + ":" + fbUser.password, exportFilePathAccountVerification + "\\SecuritySolved.txt");

                                    GlobusLogHelper.log.Info("Your Username : "******" Entered New Password : "******"Your Username : "******" Entered New Password : "******":" + fbUser.password + ":" + fbUser.proxyip + ":" + fbUser.proxyport + ":" + fbUser.proxyusername + ":" + fbUser.password, exportFilePathAccountVerification + "\\SecuritynotSolved.txt");

                                    GlobusLogHelper.log.Info("Your Username : "******" Entered New Password : "******"Your Username : "******" Entered New Password : "******"Error : " + ex.StackTrace);

                            }
                            #endregion

                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                        }
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }

            return false;
        }
コード例 #12
0
ファイル: AccountManager.cs プロジェクト: shah8701/faceboard
        private void Okay(ref FacebookUser fbUser, GlobusHttpHelper HttpHelper, string fb_dtsg, string temp_nh)
        {
            #region Clickon This Is okay
            try
            {
                string postForThisIsOkay = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&submit%5BThis+is+Okay%5D=This+is+Okay";
                string ResponseDatapostForThisIsOkay = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), postForThisIsOkay, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                if (ResponseDatapostForThisIsOkay.Contains("Create a New Password"))
                {
                    string NewPassword = fbUser.password + "123";
                    string postDataForCreateNewPassword = "******" + fb_dtsg + "&nh=" + temp_nh + "&new_pass="******"&confirm_pass="******"&submit%5BSubmit%5D=Submit";
                    string ResponseForCreateNewPassword = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), postDataForCreateNewPassword, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                    if (ResponseForCreateNewPassword.Contains("www.facebook.com/welcomeback") || ResponseForCreateNewPassword.Contains("sk=welcome") || ResponseForCreateNewPassword.Contains("Redirecting.."))
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine(fbUser.username + ":" + fbUser.password + ":" + fbUser.proxyip + ":" + fbUser.proxyport + ":" + fbUser.proxyusername + ":" + fbUser.password, exportFilePathAccountVerification + "\\SecuritySolved.txt");
                        GlobusLogHelper.log.Info("Your Username : "******" Entered New Password : "******"Your Username : "******" Entered New Password : "******"Error : " + ex.StackTrace);
            }
            #endregion
        }
コード例 #13
0
ファイル: AccountManager.cs プロジェクト: shah8701/faceboard
 private static string Continue(GlobusHttpHelper HttpHelper, string fb_dtsg, string temp_nh)
 {
     #region Click on Continue
     try
     {
         try
         {
             string postforshare = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&submit%5BContinue%5D=Continue";
             string ResponseDatapostforshare = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), postforshare, FBGlobals.Instance.AccountVerificationCheckpointUrl);             //"https://www.facebook.com/checkpoint/"
             return ResponseDatapostforshare;
         }
         catch (Exception ex)
         {
             GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
         }
     }
     catch (Exception ex)
     {
         GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
     }
     return string.Empty;
     #endregion
 }
コード例 #14
0
ファイル: AccountManager.cs プロジェクト: shah8701/faceboard
        private bool EntercaptchaForTemporarilyLockedAccount(ref FacebookUser fbUser, ref GlobusHttpHelper HttpHelper)
        {
            string googlecaptcha = string.Empty;
            string fb_dtsg = "";
            string strPageSource = HttpHelper.getHtmlfromUrl(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl));                                       //"https://www.facebook.com/checkpoint/"
            fb_dtsg = GlobusHttpHelper.Get_fb_dtsg(strPageSource);
            fb_dtsg = Uri.EscapeDataString(fb_dtsg);
            string temp_nh = strPageSource.Substring(strPageSource.IndexOf("name=\"nh\" value="), (strPageSource.IndexOf(">", strPageSource.IndexOf("name=\"nh\" value=")) - strPageSource.IndexOf("name=\"nh\" value="))).Replace("name=\"nh\" value=", string.Empty).Trim().Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim();
            string tempPostUrl = FBGlobals.Instance.AccountVerificationCheckpointUrl;                                                                                  //"https://www.facebook.com/checkpoint/";

            string temppostdata = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&submit%5BContinue%5D=Continue";

            string tempresponse = HttpHelper.postFormData(new Uri(tempPostUrl), temppostdata, FBGlobals.Instance.AccountVerificationCheckpointUrl);                     //"https://www.facebook.com/checkpoint/
            string[] captchpersist = Regex.Split(tempresponse, "id=\"captcha_persist_data");
            string captchaimageurl = string.Empty;
            string captcha_persist_data = string.Empty;
            string captcha_session = "";
            string extra_challenge_params = "";
            string challengeurl = "";
            string captchaText = "";
            if (tempresponse.Contains("captcha_persist_data"))
            {
                try
                {

                    string[] facebookcaptcha_persistdata = Regex.Split(tempresponse, "id=\"captcha_persist_data");
                    captcha_persist_data = facebookcaptcha_persistdata[1].Substring(facebookcaptcha_persistdata[1].IndexOf("value="), (facebookcaptcha_persistdata[1].IndexOf(">", facebookcaptcha_persistdata[1].IndexOf("value=")) - facebookcaptcha_persistdata[1].IndexOf("value="))).Replace("value=", string.Empty).Trim().Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim();

                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
            }
            if (tempresponse.Contains("captcha_session"))
            {
                try
                {
                    string captcha_session_val = tempresponse.Substring(tempresponse.IndexOf("captcha_session"), 200);
                    string[] Arr_captcha_session_val = captcha_session_val.Split('"');
                    captcha_session = Arr_captcha_session_val[4];
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
            }
            if (tempresponse.Contains("extra_challenge_params"))
            {
                try
                {
                    string extra_challenge_params_val = tempresponse.Substring(tempresponse.IndexOf("extra_challenge_params"), 500);
                    string[] Arr_extra_challenge_params_val = extra_challenge_params_val.Split('"');
                    string authp_pisg_nonce_tt = Arr_extra_challenge_params_val[4];
                    extra_challenge_params = Arr_extra_challenge_params_val[4];
                    extra_challenge_params = extra_challenge_params.Replace("=", "%3D");
                    extra_challenge_params = extra_challenge_params.Replace("&amp;", "%26");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
            }
            string tempcaptchresponse1 = string.Empty;
            if (tempresponse.Contains("{create_captcha"))
            {
                try
                {
                    string k = tempresponse.Substring(tempresponse.IndexOf("{create_captcha"), (tempresponse.IndexOf("}", tempresponse.IndexOf("{create_captcha")) - tempresponse.IndexOf("{create_captcha"))).Replace("{create_captcha", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("}", string.Empty).Replace("\"", string.Empty).Replace(";", string.Empty).Trim();
                    string authp = tempresponse.Substring(tempresponse.IndexOf("authp="), (tempresponse.IndexOf(";", tempresponse.IndexOf("authp=")) - tempresponse.IndexOf("authp="))).Replace("authp=", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace(";", string.Empty).Trim();
                    string nonce = tempresponse.Substring(tempresponse.IndexOf("nonce="), (tempresponse.IndexOf(";", tempresponse.IndexOf("nonce=")) - tempresponse.IndexOf("nonce="))).Replace("nonce=", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace(";", string.Empty).Trim();
                    string psig = tempresponse.Substring(tempresponse.IndexOf("psig="), (tempresponse.IndexOf(";", tempresponse.IndexOf("psig=")) - tempresponse.IndexOf("psig="))).Replace("psig=", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace(";", string.Empty).Trim();
                    string tt = tempresponse.Substring(tempresponse.IndexOf("tt="), (tempresponse.IndexOf(";", tempresponse.IndexOf("tt=")) - tempresponse.IndexOf("tt="))).Replace("tt=", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace(";", string.Empty).Trim();
                    string time = tempresponse.Substring(tempresponse.IndexOf("time="), (tempresponse.IndexOf(";", tempresponse.IndexOf("time=")) - tempresponse.IndexOf("time="))).Replace("time=", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace(";", string.Empty).Trim();
                    string googleimageurl = HttpHelper.getHtmlfromUrl(new Uri(FBGlobals.Instance.AccountVerificationRecaptchaApiChallengeUrl + k + "&ajax=1&xcachestop=0.37163324314553736&authp=" + authp + "&psig=" + psig + "&nonce=" + nonce + "&tt=" + tt + "&time=" + time + "&new_audio_default=1"));  //"https://www.google.com/recaptcha/api/challenge?k="
                    if (googleimageurl.Contains("challenge"))
                    {
                        challengeurl = googleimageurl.Substring(googleimageurl.IndexOf("challenge :"), (googleimageurl.IndexOf(",", googleimageurl.IndexOf("challenge :")) - googleimageurl.IndexOf("challenge :"))).Replace("challenge :", string.Empty).Trim().Replace(")", string.Empty).Replace("'", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace(";", string.Empty).Trim();
                        googlecaptcha = FBGlobals.Instance.AccountVerificationRecaptchaApiImageUrl + challengeurl;                       //"https://www.google.com/recaptcha/api/image?c="

                        System.Net.WebClient webclient = new System.Net.WebClient();
                        byte[] args = webclient.DownloadData(googlecaptcha);

                        string[] arr1 = new string[3] { FBGlobals.dbcUserName, FBGlobals.dbcPassword, "" };
                        captchaText = DecodeDBC(arr1, args);
                        if (!string.IsNullOrEmpty(captchaText))
                        {
                            string postdataforgoogle = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&geo=true&captcha_persist_data=" + captcha_persist_data + "&captcha_session=" + captcha_session + "&extra_challenge_params=" + extra_challenge_params + "%3D1&recaptcha_type=password&recaptcha_challenge_field=" + challengeurl + "&captcha_response=" + captchaText + "&achal=1&submit%5BSubmit%5D=Submit";
                            tempcaptchresponse1 = HttpHelper.postFormData(new Uri(tempPostUrl), postdataforgoogle, FBGlobals.Instance.AccountVerificationCheckpointUrl);   //"https://www.facebook.com/checkpoint/"
                            if (tempcaptchresponse1.Contains("To verify that you are the owner of this account, please identify the people tagged in the following photos. If you aren't sure about a question, please click") || tempcaptchresponse1.Contains("To make sure this is your account, we need you to upload a color photo of your government-issued ID. Your ID should include your name"))
                            {
                                try
                                {
                                    GlobusLogHelper.log.Info("Your Username : "******" Need Photo for Identification");
                                    GlobusLogHelper.log.Debug("Your Username : "******" Need Photo for Identification");

                                    return true;
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                        }
                        else
                        {
                            // GlobusLogHelper.log.Info("google Captcha Not Found ");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
            }

            string tempcaptchresponse = string.Empty;

            #region
            if (tempresponse.Contains("captcha_challenge_code"))
            {
                if (tempresponse.Contains(FBGlobals.Instance.AccountVerificationCaptchaTfimageUrl))  //"https://www.facebook.com/captcha/tfbimage.php"
                {
                    try
                    {
                        challengeurl = tempresponse.Substring(tempresponse.IndexOf("captcha_challenge_code="), (tempresponse.IndexOf("captcha_challenge_hash=", tempresponse.IndexOf("captcha_challenge_code=")) - tempresponse.IndexOf("captcha_challenge_code="))).Replace("captcha_challenge_code=", string.Empty).Trim().Replace(")", string.Empty).Replace("'", string.Empty).Replace("\"", string.Empty).Replace("\"", string.Empty).Replace(" ", string.Empty).Trim();
                        string facebookurl = FBGlobals.Instance.AccountVerificationCaptchaTfbimageChallengeUrl + challengeurl + "captcha_challenge_hash=" + captcha_persist_data;   //"https://www.facebook.com/captcha/tfbimage.php?captcha_challenge_code="
                        googlecaptcha = facebookurl;


                        System.Net.WebClient webclient = new System.Net.WebClient();
                        byte[] args = webclient.DownloadData(googlecaptcha);
                        string[] arr1 = new string[3] { FBGlobals.dbcUserName, FBGlobals.dbcPassword, "" };

                        captchaText = DecodeDBC(arr1, args);
                        if (!string.IsNullOrEmpty(captchaText))
                        {

                            string captchapostdata = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&geo=true&captcha_persist_data=" + captcha_persist_data + "&captcha_response=" + captchaText + "&achal=8&submit%5BSubmit%5D=Submit";
                            tempcaptchresponse = HttpHelper.postFormData(new Uri(tempPostUrl), captchapostdata, FBGlobals.Instance.AccountVerificationCheckpointUrl);

                            try
                            {
                                string PostDataAfterenterSecurity = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&geo=true&captcha_persist_data=" + captcha_persist_data + "&captcha_response=" + fbUser.securityAnswer + "&achal=5&submit%5BSubmit%5D=Submit";
                                string ResponseAfterenterSecurity = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), PostDataAfterenterSecurity, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.StackTrace);
                            }

                            if (tempcaptchresponse.Contains("To verify that you are the owner of this account, please identify the people tagged in the following photos. If you aren't sure about a question, please click") || tempcaptchresponse.Contains("To make sure this is your account, we need you to upload a color photo of your government-issued ID. Your ID should include your name"))
                            {
                                return true;
                            }
                            if (tempcaptchresponse.Contains("Use a phone to verify your account"))
                            {
                                return true;
                            }
                        }
                        else
                        {
                            GlobusLogHelper.log.Info("Facebook Captcha Not Found ");
                            GlobusLogHelper.log.Debug("Facebook Captcha Not Found ");

                        }

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }
            #endregion
            #region
                if (tempcaptchresponse.Contains("Please confirm your identity") || tempcaptchresponse.Contains("Provide your birthday") || tempcaptchresponse.Contains("Answer your security question"))
                {
                    try
                    {
                        string[] BirthArr = Regex.Split(fbUser.dateOfBirth, "-");
                        string temp_month = string.Empty;
                        string temp_date = string.Empty;
                        string temp_year = string.Empty;

                        if (BirthArr.Count() > 1)
                        {
                            temp_month = BirthArr[0];
                            temp_date = BirthArr[1];
                            temp_year = BirthArr[2];
                        }
                        string achal = string.Empty;
                        try
                        {
                            string[] achalArr = Regex.Split(tempresponse, "name=\"achal\"");
                            achal = achalArr[1].Substring(achalArr[1].IndexOf("value="), (achalArr[1].IndexOf(">", achalArr[1].IndexOf("value=")) - achalArr[1].IndexOf("value="))).Replace("value=", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Replace(";", string.Empty).Trim();
                            if (string.IsNullOrEmpty(achal))
                            {
                                achal = "2";
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            if (tempresponse.Contains("To confirm that this is your account, please enter your date of birth"))
                            {
                                string PostDataAfterenterdateofBirth = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&geo=true&birthday_captcha_month=" + temp_month + "&birthday_captcha_day=" + temp_date + "&birthday_captcha_year=" + temp_year + "&captcha_persist_data=" + captcha_persist_data + "&achal=2&submit%5BSubmit%5D=Submit";
                                string ResponseDataAfterenterdateofBirth = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), PostDataAfterenterdateofBirth, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                                if (ResponseDataAfterenterdateofBirth.Contains("Create a New Password") || ResponseDataAfterenterdateofBirth.Contains(" please select a new password"))
                                {
                                    string NewPassword = fbUser.password + "123";

                                    string postDataForCreateNewPassword = "******" + fb_dtsg + "&nh=" + temp_nh + "&new_pass="******"&confirm_pass="******"&submit%5BSubmit%5D=Submit";
                                    string ResponseForCreateNewPassword = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), postDataForCreateNewPassword, FBGlobals.Instance.AccountVerificationCheckpointUrl);

                                }
                            }

                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                        }

                        #region After click of security condition

                        string captcha_persist_data1 = string.Empty;
                        try
                        {
                            if (!string.IsNullOrEmpty(fbUser.securityAnswer))
                            {

                                string PostForSubmitclick = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&achal=5&submit%5BSubmit%5D=Submit";
                                string SubmitResponse = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), PostForSubmitclick, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                                string[] facebookcaptcha_persistdata = Regex.Split(SubmitResponse, "id=\"captcha_persist_data");
                                try
                                {
                                    captcha_persist_data1 = facebookcaptcha_persistdata[1].Substring(facebookcaptcha_persistdata[1].IndexOf("value="), (facebookcaptcha_persistdata[1].IndexOf(">", facebookcaptcha_persistdata[1].IndexOf("value=")) - facebookcaptcha_persistdata[1].IndexOf("value="))).Replace("value=", string.Empty).Trim().Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim();

                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                                }
                                if (string.IsNullOrEmpty(captcha_persist_data1))
                                {
                                    try
                                    {
                                        facebookcaptcha_persistdata = Regex.Split(SubmitResponse, "name=\"captcha_persist_data\"");
                                        //name="captcha_persist_data"
                                        captcha_persist_data1 = facebookcaptcha_persistdata[1].Substring(facebookcaptcha_persistdata[1].IndexOf("value="), (facebookcaptcha_persistdata[1].IndexOf(">", facebookcaptcha_persistdata[1].IndexOf("value=")) - facebookcaptcha_persistdata[1].IndexOf("value="))).Replace("value=", string.Empty).Trim().Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim();
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                                    }
                                }
                                try
                                {
                                    string[] achalArr = Regex.Split(SubmitResponse, "name=\"achal\"");
                                    achal = achalArr[1].Substring(achalArr[1].IndexOf("value="), (achalArr[1].IndexOf(">", achalArr[1].IndexOf("value=")) - achalArr[1].IndexOf("value="))).Replace("value=", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Replace(";", string.Empty).Trim();
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                                }
                            }
                            else
                            {
                                try
                                {
                                    string PostForSubmitclick = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&achal=2&submit%5BSubmit%5D=Submit";
                                    string SubmitResponse = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), PostForSubmitclick, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                                    string[] facebookcaptcha_persistdata = Regex.Split(tempresponse, "id=\"captcha_persist_data");
                                    try
                                    {
                                        captcha_persist_data1 = facebookcaptcha_persistdata[1].Substring(facebookcaptcha_persistdata[1].IndexOf("value="), (facebookcaptcha_persistdata[1].IndexOf(">", facebookcaptcha_persistdata[1].IndexOf("value=")) - facebookcaptcha_persistdata[1].IndexOf("value="))).Replace("value=", string.Empty).Trim().Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim();
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                                    }
                                    if (string.IsNullOrEmpty(captcha_persist_data1))
                                    {
                                        try
                                        {
                                            facebookcaptcha_persistdata = Regex.Split(SubmitResponse, "name=\"captcha_persist_data\"");

                                            captcha_persist_data1 = facebookcaptcha_persistdata[1].Substring(facebookcaptcha_persistdata[1].IndexOf("value="), (facebookcaptcha_persistdata[1].IndexOf(">", facebookcaptcha_persistdata[1].IndexOf("value=")) - facebookcaptcha_persistdata[1].IndexOf("value="))).Replace("value=", string.Empty).Trim().Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim();
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                                }
                            }

                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                        }
                        #endregion
                        #region Afetr Enter security
                        try
                        {
                            if (!string.IsNullOrEmpty(fbUser.securityAnswer))
                            {
                                try
                                {
                                    string PostDataAfterenterSecurity = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&geo=true&captcha_persist_data=" + captcha_persist_data1 + "&captcha_response=" + fbUser.securityAnswer + "&achal=5&submit%5BSubmit%5D=Submit";
                                    string ResponseAfterenterSecurity = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), PostDataAfterenterSecurity, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                                    if (ResponseAfterenterSecurity.Contains("Create a New Password") || ResponseAfterenterSecurity.Contains(" please select a new password"))
                                    {
                                        string NewPassword = fbUser.password + "123";

                                        string postDataForCreateNewPassword = "******" + fb_dtsg + "&nh=" + temp_nh + "&new_pass="******"&confirm_pass="******"&submit%5BSubmit%5D=Submit";
                                        string ResponseForCreateNewPassword = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), postDataForCreateNewPassword, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                                        if (ResponseForCreateNewPassword.Contains("www.facebook.com/welcomeback") || ResponseForCreateNewPassword.Contains("sk=welcome") || ResponseForCreateNewPassword.Contains("Redirecting.."))
                                        {
                                        }
                                        else
                                        {
                                            string postDataForCreateNewPassword1 = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&new_pass="******"&confirm_pass="******"&submit%5BChange+Password%5D=Change+Password";
                                            string ResponseForCreateNewPassword1 = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), postDataForCreateNewPassword1, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                                            if (ResponseForCreateNewPassword1.Contains("www.facebook.com/welcomeback") || ResponseForCreateNewPassword1.Contains("sk=welcome") || ResponseForCreateNewPassword1.Contains("Redirecting.."))
                                            {
                                                return true;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (ResponseAfterenterSecurity.Contains("The text you entered didn") && ResponseAfterenterSecurity.Contains("match the security check"))
                                        {
                                            try
                                            {
                                                if (!string.IsNullOrEmpty(fbUser.dateOfBirth))
                                                {
                                                    string PostDataAfterenterdateofBirth = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&geo=true&birthday_captcha_month=" + temp_month + "&birthday_captcha_day=" + temp_date + "&birthday_captcha_year=" + temp_year + "&captcha_persist_data=" + captcha_persist_data1 + "&achal=2&submit%5BSubmit%5D=Submit";
                                                    string ResponseDataAfterenterdateofBirth = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), PostDataAfterenterdateofBirth, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                                                    if (ResponseDataAfterenterdateofBirth.Contains("Create a New Password") || ResponseDataAfterenterdateofBirth.Contains(" please select a new password"))
                                                    {
                                                        string NewPassword = fbUser.password + "123";
                                                        string postDataForCreateNewPassword = "******" + fb_dtsg + "&nh=" + temp_nh + "&new_pass="******"&confirm_pass="******"&submit%5BSubmit%5D=Submit";
                                                        string ResponseForCreateNewPassword = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), postDataForCreateNewPassword, FBGlobals.Instance.AccountVerificationCheckpointUrl);

                                                    }
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                                            }
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                                }
                            }

                            if (true)
                            {
                                try
                                {
                                    string PostDataAfterenterdateofBirth = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&geo=true&birthday_captcha_month=" + temp_month + "&birthday_captcha_day=" + temp_date + "&birthday_captcha_year=" + temp_year + "&captcha_persist_data=" + captcha_persist_data1 + "&achal=2&submit%5BSubmit%5D=Submit";
                                    string ResponseDataAfterenterdateofBirth = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), PostDataAfterenterdateofBirth, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                                    if (ResponseDataAfterenterdateofBirth.Contains("Create a New Password") || ResponseDataAfterenterdateofBirth.Contains(" please select a new password"))
                                    {
                                        string NewPassword = fbUser.password + "123";
                                        string postDataForCreateNewPassword = "******" + fb_dtsg + "&nh=" + temp_nh + "&new_pass="******"&confirm_pass="******"&submit%5BSubmit%5D=Submit";
                                        string ResponseForCreateNewPassword = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), postDataForCreateNewPassword, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                        }
                        #endregion

                        #region Click on Continue
                        try
                        {
                            try
                            {
                                string postforshare = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&submit%5BContinue%5D=Continue";
                                string ResponseDatapostforshare = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), postforshare, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                        }
                        #endregion

                        #region Clickon skip

                        try
                        {
                            string postForSkip = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&submit%5BSkip%5D=Skip";
                            string ResponseDatapostForSkip = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl), postForSkip, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                        }

                        #endregion

                        Okay(ref fbUser, HttpHelper, fb_dtsg, temp_nh);

                        #region
                        try
                        {
                            string FinalResponse = HttpHelper.getHtmlfromUrl(new Uri(FBGlobals.Instance.fbWelcomeUrl));    //"https://www.facebook.com/?sk=welcome"

                            int Pageresponselengh = FinalResponse.Length;
                            if (Pageresponselengh > 8000)
                            {
                                return true;
                            }
                            else
                            {
                                return false;
                            }
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                        }
                        #endregion
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                    }

                }
                #endregion

            }
            return false;
        }
コード例 #15
0
        public string PostFollowCompanyUsingUrl(ref GlobusHttpHelper HttpHelper, Dictionary <string, Dictionary <string, string> > LinkdInContacts, int mindelay, int maxdelay)
        {
            string postdata     = string.Empty;
            string postUrl      = string.Empty;
            string ResLogin     = string.Empty;
            string csrfToken    = string.Empty;
            string sourceAlias  = string.Empty;
            string ReturnString = string.Empty;

            try
            {
                string MessageText   = string.Empty;
                string PostedMessage = string.Empty;
                string pageSource    = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));

                if (pageSource.Contains("csrfToken"))
                {
                    csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50);
                    string[] Arr = csrfToken.Split('&');
                    csrfToken = Arr[0];
                    csrfToken = csrfToken.Replace(":", "%3A").Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty);
                    csrfToken = csrfToken.Trim();
                }

                if (pageSource.Contains("sourceAlias"))
                {
                    sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                    string[] Arr = sourceAlias.Split('"');
                    sourceAlias = Arr[2];
                }

                try
                {
                    int counter = 0;
                    foreach (KeyValuePair <string, Dictionary <string, string> > UserValue in LinkdInContacts)
                    {
                        counter = counter + 1;
                        foreach (KeyValuePair <string, string> GroupValue in UserValue.Value)
                        {
                            post_url = string.Empty;
                            post_url = (GroupValue.Key + ":" + GroupValue.Value);

                            string Screen_name = UserValue.Key.Split(':')[0];
                            string pass        = UserValue.Key.Split(':')[1];

                            postUrl  = "https://www.linkedin.com/uas/login-submit";
                            postdata = "session_key=" + Screen_name + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
                            ResLogin = HttpHelper.postFormData(new Uri(postUrl), postdata);

                            try
                            {
                                string GoBack = "%2Ebzo_*1_*1_*1_*1_*1_*1_*1_" + post_url.Split(':')[1];
                                Log("[ " + DateTime.Now + " ] => [ ID: " + Screen_name + " has Follow the Company: " + post_url.Split(':')[0] + " ]");
                                string pageGetreq = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/company/follow/submit?id=" + post_url.Split(':')[1] + "&fl=start&version=2&ft=pageKey%3Dbiz-overview-internal%3Bmodule%3Dbutton&sp=biz-overview&csrfToken=" + csrfToken + "&goback=" + GoBack));

                                if (pageGetreq.Contains("Following"))
                                {
                                    ReturnString = "Your request to Follow the: " + post_url.Split(':')[0] + " company has been Successfully Followed.";
                                    Log("[ " + DateTime.Now + " ] => [ " + ReturnString + " ]");
                                    //GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + ReturnString, Globals.path_FollowCompany);
                                }
                                else if (pageGetreq.Contains("Error"))
                                {
                                    Log("[ " + DateTime.Now + " ] => [ Error In Follow Company ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + "Error In Follow Company", Globals.path_Not_FollowCompany);
                                }
                                else
                                {
                                    Log("[ " + DateTime.Now + " ] => [ Company Could Not Be Followed ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + "Company Could Not Be Followed", Globals.path_Not_FollowCompany);
                                }
                            }
                            catch { }

                            if (counter < LinkdInContacts.Count())
                            {
                                int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                                Thread.Sleep(delay * 1000);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Follow Company--1 --> PostFollowCompanyUsingUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Follow Company--1 --> PostFollowCompanyUsingUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinFollowCompanyErrorLogs);
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Follow Company--2--> PostFollowCompanyUsingUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Follow Company--2--> PostFollowCompanyUsingUrl() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinFollowCompanyErrorLogs);
                ReturnString = "Error";
            }
            return(ReturnString);
        }
コード例 #16
0
ファイル: AccountManager.cs プロジェクト: shah8701/faceboard
        public void ProvideYourBirthday(ref FacebookUser fbUser, ref string response, ref GlobusHttpHelper HttpHelper)
        {
            try
            {
                GlobusLogHelper.log.Info("Try to solving provide your birthday : " + fbUser.username);
                GlobusLogHelper.log.Debug("Try to solving provide your birthday : " + fbUser.username);

                GetFbdtsgNh(ref fb_dtsg, ref nh, response);
                string postData = "fb_dtsg=" + fb_dtsg + "&nh=" + nh + "&achal=2&submit%5BSubmit%5D=Submit";
                string resSubmit = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointNextUrl), postData);                  //"https://www.facebook.com/checkpoint/?next"

                if (string.IsNullOrEmpty(resSubmit))
                {
                    Thread.Sleep(2 * 1000);
                    resSubmit = HttpHelper.postFormData(new Uri(FBGlobals.Instance.AccountVerificationCheckpointNextUrl), postData);
                }

                response = resSubmit;
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
コード例 #17
0
ファイル: AccountManager.cs プロジェクト: shah8701/faceboard
        private static void GetCaptchaPageSrc(GlobusHttpHelper HttpHelper, string tempPostUrl, string temppostdata, ref string tempresponse, ref string captcha_persist_data, ref string captcha_session, ref string extra_challenge_params, ref string challengeurl, ref string captchaText)
        {
            try
            {
                tempresponse = HttpHelper.postFormData(new Uri(tempPostUrl), temppostdata, FBGlobals.Instance.AccountVerificationCheckpointUrl);

                string[] captchpersist = Regex.Split(tempresponse, "id=\"captcha_persist_data");
                string captchaimageurl = string.Empty;
                captcha_persist_data = string.Empty;
                captcha_session = "";
                extra_challenge_params = "";
                challengeurl = "";
                captchaText = "";

                if (tempresponse.Contains("captcha_persist_data"))
                {
                    try
                    {
                        string[] facebookcaptcha_persistdata = Regex.Split(tempresponse, "id=\"captcha_persist_data");
                        captcha_persist_data = facebookcaptcha_persistdata[1].Substring(facebookcaptcha_persistdata[1].IndexOf("value="), (facebookcaptcha_persistdata[1].IndexOf(">", facebookcaptcha_persistdata[1].IndexOf("value=")) - facebookcaptcha_persistdata[1].IndexOf("value="))).Replace("value=", string.Empty).Trim().Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim();

                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }
                }
                if (tempresponse.Contains("captcha_session"))
                {
                    try
                    {
                        string captcha_session_val = tempresponse.Substring(tempresponse.IndexOf("captcha_session"), 200);
                        string[] Arr_captcha_session_val = captcha_session_val.Split('"');
                        captcha_session = Arr_captcha_session_val[4];
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                    }
                }
                if (tempresponse.Contains("extra_challenge_params"))
                {
                    try
                    {
                        string extra_challenge_params_val = tempresponse.Substring(tempresponse.IndexOf("extra_challenge_params"), 500);
                        string[] Arr_extra_challenge_params_val = extra_challenge_params_val.Split('"');
                        string authp_pisg_nonce_tt = Arr_extra_challenge_params_val[4];
                        extra_challenge_params = Arr_extra_challenge_params_val[4];
                        extra_challenge_params = extra_challenge_params.Replace("=", "%3D");
                        extra_challenge_params = extra_challenge_params.Replace("&amp;", "%26");
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

            }
        }
コード例 #18
0
ファイル: TwitterSignUp.cs プロジェクト: prog-moh/twtboard
        //Added By abhishek 

        public System.Collections.Specialized.NameValueCollection SignupManual(object parameters, GlobusHttpHelper globusHelper)
        {
            Array paramsArray = new object[4];
            paramsArray = (Array)parameters;

            System.Collections.Specialized.NameValueCollection nvc = new System.Collections.Specialized.NameValueCollection();

            string DBCUsername = BaseLib.Globals.DBCUsername;
            string DBCPAssword = BaseLib.Globals.DBCPassword;
            //GlobusHttpHelper globusHelper = new GlobusHttpHelper();


            string ImageURL = string.Empty;
            string authenticitytoken = string.Empty;
            string capcthavalue = string.Empty;



            string Email = string.Empty;//"*****@*****.**";
            string Password = string.Empty;//"1JESUS11";

            string IPAddress = string.Empty;
            string IPPort = string.Empty;
            string IPUsername = string.Empty;
            string IPpassword = string.Empty;

            string emailData = (string)paramsArray.GetValue(0);
            string username = (string)paramsArray.GetValue(1);
            string name = (string)paramsArray.GetValue(2);
            string IP = (string)paramsArray.GetValue(3);
            bool Created = true;

            try
            {

                int Count = emailData.Split(':').Length;
                if (Count == 1)
                {
                    Log("[ " + DateTime.Now + " ] => [ Uploaded Emails Not In correct Format ]");
                    Log("[ " + DateTime.Now + " ] => [ " + emailData + " ]");
                }
                if (Count == 2)
                {
                    Email = emailData.Split(':')[0].Replace("\0", "");
                    Password = emailData.Split(':')[1].Replace("\0", "");
                }
                else if (Count == 4)
                {
                    Email = emailData.Split(':')[0].Replace("\0", "");
                    Password = emailData.Split(':')[1].Replace("\0", "");
                    IPAddress = emailData.Split(':')[2];
                    IPPort = emailData.Split(':')[3];
                }
                else if (Count == 6)
                {
                    Email = emailData.Split(':')[0].Replace("\0", "");
                    Password = emailData.Split(':')[1].Replace("\0", "");
                    IPAddress = emailData.Split(':')[2];
                    IPPort = emailData.Split(':')[3];
                    IPUsername = emailData.Split(':')[4];
                    IPpassword = emailData.Split(':')[5];
                }
                else
                {
                    Log("[ " + DateTime.Now + " ] => [ Uploaded Emails Not In correct Format ]");
                    Log("[ " + DateTime.Now + " ] => [ " + emailData + " ]");
                }
            }
            catch (Exception ex)
            {
                Log(ex.Message); Console.WriteLine("8 :" + ex.StackTrace);
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- Email Pass --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- Email Pass >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
            }

            try
            {
                RaiseEvent_AddToDictionary(Email);
            }
            catch (Exception ex) { Console.WriteLine(ex.StackTrace); }

            try
            {
                if (IP.Split(':').Length == 4)
                {
                    IPAddress = IP.Split(':')[0];
                    IPPort = IP.Split(':')[1];
                    IPUsername = IP.Split(':')[2];
                    IPpassword = IP.Split(':')[3];
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("7 :" + ex.StackTrace);
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- IP Split --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- IP Split >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
            }

            string url = "https://twitter.com/users/email_available?suggest=1&username=&full_name=&email=" + Email.Replace("@", "%40").Replace(" ", "") + "&suggest_on_username=true&context=signup";
            string EmailCheck = globusHelper.getHtmlfromUrlIP(new Uri(url), IPAddress, IPPort, IPUsername, IPpassword, "https://twitter.com/signup", "");
            if (EmailCheck.Contains("\"taken\":true"))
            {
                Log("[ " + DateTime.Now + " ] => [ Email : " + Email + " has already been taken. An email can only be used on one Twitter account at a time ]");
                Created = false;
                GlobusFileHelper.AppendStringToTextfileNewLine(emailData.Replace("\0", ""), Globals.path_EmailAlreadyTaken);
                nvc.Clear();
                return nvc;
            }


            //Get User name .....
            try
            {
                username = username.Replace("\0", "");
                Password = Password.Replace("\0", "");
                if (!(username.Count() < 15 || Password.Count() > 6))
                {
                    if (username.Count() > 15)
                    {
                        Log("[ " + DateTime.Now + " ] => [ Username Must Not be greater than 15 character ]");
                        username = username.Remove(13); //Removes the extra characters
                    }
                    else if (Password.Count() < 6)
                    {
                        Log("[ " + DateTime.Now + " ] => [ Password Must Not be less than 6 char ]");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("6 :" + ex.StackTrace);
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- Check Username --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- Check Username >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
            }



            Random randm = new Random();
            double cachestop = randm.NextDouble();
            string pagesource2 = string.Empty;
            string textUrl = string.Empty;


            try
            {
                textUrl = globusHelper.getHtmlfromUrlIP(new Uri("https://twitter.com/signup"), IPAddress, IPPort, IPUsername, IPpassword, "", "");
                string pagesource1 = globusHelper.getHtmlfromUrlIP(new Uri("https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"), IPAddress, IPPort, IPUsername, IPpassword, "", "");
                pagesource2 = globusHelper.getHtmlfromUrlIP(new Uri("https://www.google.com/recaptcha/api/challenge?k=6LfbTAAAAAAAAE0hk8Vnfd1THHnn9lJuow6fgulO&ajax=1&cachestop=" + cachestop + "&lang=en"), IPAddress, IPPort, IPUsername, IPpassword, "", "");
            }
            catch (Exception ex)
            {
                Console.WriteLine("5 :" + ex.StackTrace);
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- Getting Signup PageSource --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- Getting Signup PageSource >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
            }



            try
            {
                int IndexStart = pagesource2.IndexOf("challenge :");
                if (IndexStart > 0)
                {
                    string Start = pagesource2.Substring(IndexStart);
                    int IndexEnd = Start.IndexOf("',");
                    string End = Start.Substring(0, IndexEnd).Replace("challenge :", "").Replace("'", "").Replace(" ", "");
                    capcthavalue = End;
                    ImageURL = "https://www.google.com/recaptcha/api/image?c=" + End;
                }
                else
                {
                    Log("[ " + DateTime.Now + " ] => [ Cannot Find challenge Captcha on Page. Email : Password --> " + Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword + " ]");
                    GlobusFileHelper.AppendStringToTextfileNewLine(Email + ":" + Password + ":" + IPAddress + ":" + IPPort + ":" + IPUsername + ":" + IPpassword, Globals.Path_CaptchaRequired);
                    nvc.Clear();
                    return nvc;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("1 :" + ex.StackTrace);
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- Getting Image Url --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- Getting Image Url >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
            }


            WebClient webclient = new WebClient();
            try
            {
                int intIPPort = 80;
                if (!string.IsNullOrEmpty(IPPort) && GlobusRegex.ValidateNumber(IPPort))
                {
                    intIPPort = int.Parse(IPPort);
                }
                ChangeIP_WebClient(IPAddress, intIPPort, IPUsername, IPpassword, ref webclient);
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- ChangeIP_WebClient() --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- ChangeIP_WebClient() >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
            }

            try
            {
                int StartIndex = textUrl.IndexOf("phx-signup-form");
                if (StartIndex > 0)
                {
                    string Start = textUrl.Substring(StartIndex);
                    int EndIndex = Start.IndexOf("name=\"authenticity_token");
                    string End = Start.Substring(0, EndIndex).Replace("phx-signup-form", "").Replace("method=\"POST\"", "").Replace("action=\"https://twitter.com/account/create\"", "");
                    authenticitytoken = End.Replace("class=\"\">", "").Replace("<input type=\"hidden\"", "").Replace("class=\"\">", "").Replace("value=\"", "").Replace("\n", "").Replace("\"", "").Replace(" ", "");
                }
                else
                {
                    Log("[ " + DateTime.Now + " ] => [ Cannot find Authenticity Token On Page ]");
                    nvc.Clear();
                    return nvc;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("2 :" + ex.StackTrace);
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup -  SignupMultiThreaded() -- Getting Authenticity --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup -  SignupMultiThreaded() -- Getting Authenticity >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
            }


            string postData_SignUp = "user%5Bname%5D=" + username + "&user%5Bemail%5D=" + Email + "&user%5Buser_password%5D=" + Password + "&context=front&authenticity_token=" + authenticitytoken + "";
            string res_PostSignUp = globusHelper.postFormData(new Uri("https://twitter.com/signup"), postData_SignUp, "", "", "", "", "");

            int tempCount_usernameCheckLoop = 0;
        usernameCheckLoop:
            int tempCount_passwordCheckLoop = 0;

            if (username.Contains(" "))
            {
                username = username.Replace(" ", "_");
            }

            string headr = globusHelper.gResponse.Headers.ToString();
            string Usernamecheck = globusHelper.getHtmlfromUrlIP(new Uri("https://twitter.com/users/username_available?suggest=1&username="******"&full_name=" + name + "&email=&suggest_on_username=true&context=signup"), IPAddress, IPPort, IPUsername, IPpassword, "https://twitter.com/signup", "");

            //if (EmailCheck.Contains("\"taken\":true")
            //    || res_PostSignUp.Contains("You already have an account with this username and password"))
            //{
            //    Log("Email : " + Email + " has already been taken. An email can only be used on one Twitter account at a time");
            //    Created = false;
            //    GlobusFileHelper.AppendStringToTextfileNewLine(emailData.Replace("\0", ""), Globals.path_EmailAlreadyTaken);
            //}
            //else 
            if (Usernamecheck.Contains("Username has already been taken"))
            {
                //Created = false;
                Log("[ " + DateTime.Now + " ] => [ Username : "******" has already been taken ]");
                if (username.Count() > 12)
                {
                    username = username.Remove(8); //Removes the extra characters
                }

                if (UsernameType == "String")
                {
                    Log("[ " + DateTime.Now + " ] => [ Adding String To Username ]");
                    username = username + RandomStringGenerator.RandomString(5);
                }
                else if (UsernameType == "Numbers")
                {
                    Log("[ " + DateTime.Now + " ] => [ Adding Numbers To Username ]");
                    username = username + RandomStringGenerator.RandomNumber(5);
                }
                else
                {
                    Log("[ " + DateTime.Now + " ] => [ Adding Strings & Numbers To Username ]");
                    username = username + RandomStringGenerator.RandomStringAndNumber(5);
                    Log("[ " + DateTime.Now + " ] => [ New user name :- " + username + " ]");
                }

                if (username.Count() > 15)
                {
                    username = username.Remove(13); //Removes the extra characters
                }
                tempCount_usernameCheckLoop++;
                if (tempCount_usernameCheckLoop < 5)
                {
                    goto usernameCheckLoop;
                }
            }
            else if (EmailCheck.Contains("You cannot have a blank email address"))
            {
                Log("[ " + DateTime.Now + " ] => [ Email Address is Blank ]");
                Created = false;
            }


            if (Created)
            {
                nvc.Add("Email", Email);
                nvc.Add("username", username);
                nvc.Add("name", name);
                nvc.Add("Password", Password);
                nvc.Add("authenticitytoken", authenticitytoken);
                nvc.Add("IPAddress", IPAddress);
                nvc.Add("IPpassword", IPpassword);
                nvc.Add("IPPort", IPPort);
                nvc.Add("IPUsername", IPUsername);
                nvc.Add("IPpassword", IPpassword);
                nvc.Add("capcthavalue", capcthavalue);
                nvc.Add("ImageURL", ImageURL);
                //nvc.Add("globusHelper", globusHelper);
            }

            return nvc;
        }
コード例 #19
0
ファイル: AccountManager.cs プロジェクト: shah8701/faceboard
        private bool SolveGoogleCaptcha(ref FacebookUser fbUser, GlobusHttpHelper HttpHelper, ref string googlecaptcha, string fb_dtsg, string temp_nh, string tempPostUrl, string tempresponse, string captcha_persist_data, string captcha_session, string extra_challenge_params, ref string challengeurl, ref string captchaText, ref string tempcaptchresponse1)
        {
            try
            {
                GlobusLogHelper.log.Info("Try to solving google captcha : " + fbUser.username);
                GlobusLogHelper.log.Debug("Try to solving google captcha : " + fbUser.username);

                string k = tempresponse.Substring(tempresponse.IndexOf("{create_captcha"), (tempresponse.IndexOf("}", tempresponse.IndexOf("{create_captcha")) - tempresponse.IndexOf("{create_captcha"))).Replace("{create_captcha", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("}", string.Empty).Replace("\"", string.Empty).Replace(";", string.Empty).Trim();
                string authp = tempresponse.Substring(tempresponse.IndexOf("authp="), (tempresponse.IndexOf(";", tempresponse.IndexOf("authp=")) - tempresponse.IndexOf("authp="))).Replace("authp=", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace(";", string.Empty).Trim();
                string nonce = tempresponse.Substring(tempresponse.IndexOf("nonce="), (tempresponse.IndexOf(";", tempresponse.IndexOf("nonce=")) - tempresponse.IndexOf("nonce="))).Replace("nonce=", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace(";", string.Empty).Trim();
                string psig = tempresponse.Substring(tempresponse.IndexOf("psig="), (tempresponse.IndexOf(";", tempresponse.IndexOf("psig=")) - tempresponse.IndexOf("psig="))).Replace("psig=", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace(";", string.Empty).Trim();
                string tt = tempresponse.Substring(tempresponse.IndexOf("tt="), (tempresponse.IndexOf(";", tempresponse.IndexOf("tt=")) - tempresponse.IndexOf("tt="))).Replace("tt=", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace(";", string.Empty).Trim();
                string time = tempresponse.Substring(tempresponse.IndexOf("time="), (tempresponse.IndexOf(";", tempresponse.IndexOf("time=")) - tempresponse.IndexOf("time="))).Replace("time=", string.Empty).Trim().Replace(")", string.Empty).Replace("(", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace(";", string.Empty).Trim();
                string googleimageurl = HttpHelper.getHtmlfromUrl(new Uri(FBGlobals.Instance.AccountVerificationRecaptchaApiChallengeUrl + k + "&ajax=1&xcachestop=0.37163324314553736&authp=" + authp + "&psig=" + psig + "&nonce=" + nonce + "&tt=" + tt + "&time=" + time + "&new_audio_default=1"));//https://www.google.com/recaptcha/api/challenge?k=

                if (googleimageurl.Contains("challenge"))
                {
                    challengeurl = googleimageurl.Substring(googleimageurl.IndexOf("challenge :"), (googleimageurl.IndexOf(",", googleimageurl.IndexOf("challenge :")) - googleimageurl.IndexOf("challenge :"))).Replace("challenge :", string.Empty).Trim().Replace(")", string.Empty).Replace("'", string.Empty).Replace("&amp", string.Empty).Replace("\"", string.Empty).Replace(";", string.Empty).Trim();
                    googlecaptcha = FBGlobals.Instance.AccountVerificationRecaptchaApiImageUrl + challengeurl;                              //"https://www.google.com/recaptcha/api/image?c="

                    System.Net.WebClient webclient = new System.Net.WebClient();
                    byte[] args = webclient.DownloadData(googlecaptcha);

                    string[] arr1 = new string[3] { FBGlobals.dbcUserName, FBGlobals.dbcPassword, "" };
                    captchaText = DecodeDBC(arr1, args);
                    if (!string.IsNullOrEmpty(captchaText))
                    {

                        string postdataforgoogle = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&geo=true&captcha_persist_data=" + captcha_persist_data + "&captcha_session=" + captcha_session + "&extra_challenge_params=" + extra_challenge_params + "%3D1&recaptcha_type=password&recaptcha_challenge_field=" + challengeurl + "&captcha_response=" + captchaText + "&achal=1&submit%5BSubmit%5D=Submit";
                        tempcaptchresponse1 = HttpHelper.postFormData(new Uri(tempPostUrl), postdataforgoogle, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                        if (tempcaptchresponse1.Contains("To verify that you are the owner of this account, please identify the people tagged in the following photos. If you aren't sure about a question, please click") || tempcaptchresponse1.Contains("To make sure this is your account, we need you to upload a color photo of your government-issued ID. Your ID should include your name"))
                        {
                            try
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine(fbUser.username + ":" + fbUser.password + ":" + fbUser.proxyip + ":" + fbUser.proxyport + ":" + fbUser.proxyusername + ":" + fbUser.password, exportFilePathAccountVerification + "\\SecurityAccountWithPhotoVerify.txt");

                                GlobusLogHelper.log.Info("Your Username : "******" Need Photo for Identification ");
                                GlobusLogHelper.log.Debug("Your Username : "******" Need Photo for Identification ");

                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);

                            }
                            return true;
                        }
                        if (tempcaptchresponse1.Contains("Use a phone to verify your account"))
                        {
                            try
                            {
                                GlobusFileHelper.AppendStringToTextfileNewLine(fbUser.username + ":" + fbUser.password + ":" + fbUser.proxyip + ":" + fbUser.proxyport + ":" + fbUser.proxyusername + ":" + fbUser.password, exportFilePathAccountVerification + "\\UsePhoneToVerifyYourAccount.txt");

                                GlobusLogHelper.log.Info("Your Username : "******" Need Phone Verification ");
                                GlobusLogHelper.log.Debug("Your Username : "******" Need Phone Verification ");

                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }
                            return true;
                        }
                        return false;
                    }
                    else
                    {
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }

            return false;
        }
コード例 #20
0
ファイル: EventManager.cs プロジェクト: shah8701/faceboard
        public void InviteFriendsEventInviter(ref FacebookUser fbUser)
        {
            try
            {
                string fb_dtsg = "";
                int    index   = 0;
                string __user  = "";
                string strEventURLPageSource = "";
                string strplan_id            = "";

                GlobusHttpHelper HttpHelper = fbUser.globusHttpHelper;

                List <string> lstFriend = new List <string>();

                foreach (string lstEventURLsFileitem in LstEventURLsEventInviter)
                {
                    try
                    {
                        int CountInvitation = 1;

                        strEventURLPageSource = HttpHelper.getHtmlfromUrl(new Uri(lstEventURLsFileitem));

                        __user = GlobusHttpHelper.GetParamValue(strEventURLPageSource, "user");
                        if (string.IsNullOrEmpty(__user))
                        {
                            __user = GlobusHttpHelper.ParseJson(strEventURLPageSource, "user");
                        }

                        if (string.IsNullOrEmpty(__user) || __user == "0" || __user.Length < 3)
                        {
                            GlobusLogHelper.log.Info("Please Check The Account : " + fbUser.username);
                            GlobusLogHelper.log.Debug("Please Check The Account : " + fbUser.username);

                            return;
                        }

                        fb_dtsg = GlobusHttpHelper.Get_fb_dtsg(strEventURLPageSource);

                        // Find Total Friends
                        lstFriend = FBUtils.GetAllFriends(ref HttpHelper, __user);
                        lstFriend = lstFriend.Distinct().ToList();

                        GlobusLogHelper.log.Info("Total Friends : " + lstFriend.Count + " for " + fbUser.username);
                        GlobusLogHelper.log.Debug("Total Friends : " + lstFriend.Count + " for " + fbUser.username);

                        List <string> lstids = new List <string>();

                        if (SendToAllFriendsEventInviter)
                        {
                            intNoOfFriends = lstFriend.Count - 1;
                        }

                        foreach (string item in lstFriend)
                        {
                            try
                            {
                                if (item.Contains("&"))
                                {
                                    try
                                    {
                                        string[] IdData = Regex.Split(item, "&");
                                        lstids.Add(IdData[0]);
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }
                                else
                                {
                                    lstids.Add(item);
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }
                        }

                        List <string> lstInvitedFriends = new List <string>();
                        foreach (string lstFrienditem in lstids)
                        {
                            try
                            {
                                if (CountInvitation > intNoOfFriends)
                                {
                                    break;
                                }

                                lstInvitedFriends.Add(lstFrienditem);
                                CountInvitation++;
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }
                        }

                        #region Split IDs in 100s and Send
                        List <List <string> > split_ListIDs = Utils.Split(lstInvitedFriends, NoOfFriendsSuggestionAtOneTimeEventInviter);


                        foreach (List <string> item in split_ListIDs)
                        {
                            try
                            {
                                index = 0;
                                string checkableitems      = "&checkableitems[" + index + "]";
                                string profileChooserItems = "%7B%22";

                                foreach (string lstFrienditem in item)
                                {
                                    try
                                    {
                                        index++;
                                        profileChooserItems = profileChooserItems + lstFrienditem + "%22%3A1%2C%22";
                                        checkableitems      = checkableitems + "=" + lstFrienditem + "&checkableitems[" + index + "]";
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }
                                }


                                try
                                {
                                    int indexOfLastComma = profileChooserItems.LastIndexOf("%2C%22");
                                    profileChooserItems = profileChooserItems.Remove(indexOfLastComma);
                                    profileChooserItems = profileChooserItems + "%7D";
                                    int indexOfLastcheckableitems = checkableitems.LastIndexOf("&checkableitems[" + index + "]");
                                    checkableitems = checkableitems.Remove(indexOfLastcheckableitems);
                                }
                                catch (Exception ex)
                                {
                                    GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                }



                                if (lstEventURLsFileitem.Contains("events/"))
                                {
                                    try
                                    {
                                        string eventUrlsTemp = lstEventURLsFileitem + "/";
                                        strplan_id = eventUrlsTemp.Substring(eventUrlsTemp.IndexOf("events/"), (eventUrlsTemp.IndexOf('/', eventUrlsTemp.IndexOf("events/") + 8)) - eventUrlsTemp.IndexOf("events/")).Replace("events/", string.Empty).Trim();
                                    }
                                    catch (Exception ex)
                                    {
                                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                    }

                                    #region BySan
                                    if (strEventURLPageSource.Contains("ajax/events/permalink/join.php") || strEventURLPageSource.Contains("Invite Friends"))
                                    {
                                        try
                                        {
                                            string joinPostDataUrl = FBGlobals.Instance.EventInviterPostAjaxJoinPHP;

                                            //eid=160921707405189&ref=0&nctr[_mod]=pagelet_event_header&__user=100004323278246&__a=1&__dyn=798ahxoNpGojEa0&__req=k&fb_dtsg=AQCKCBkm&phstamp=1658167756766107109133

                                            string joinPostData            = "eid=" + strplan_id + "&ref=0&nctr[_mod]=pagelet_event_header&__user="******"&__a=1&__dyn=798aD5z5ynU-wE&__req=9&fb_dtsg=" + fb_dtsg + "&phstamp=165816749496688101132";
                                            string ResponseOfJoinClickPost = HttpHelper.postFormData(new Uri(joinPostDataUrl), joinPostData);
                                        }
                                        catch (Exception ex)
                                        {
                                            GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                                        }
                                    }

                                    #endregion

                                    string strAjaxGetRequest1 = HttpHelper.getHtmlfromUrl(new Uri(FBGlobals.Instance.EventInviterGetAjaxChoosePlan_Id + strplan_id + "&causal_element=js_" + CountInvitation + "&__asyncDialog=1&__user="******"&__a=1"));
                                    string strAjaxGetRequest2 = HttpHelper.getHtmlfromUrl(new Uri(FBGlobals.Instance.EventInviterGetAjaxIncludeAllPlan_Id + strplan_id + "&__user="******"&__a=1"));

                                    //string strPostData = "fb_dtsg=" + fb_dtsg + "&profileChooserItems=" + profileChooserItems + checkableitems + "&__user="******"&__a=1&phstamp=" + Globals.GenerateTimeStamp() + ""; //fb_dtsg=AQCAp9jD&profileChooserItems=%7B%22100001409031727%22%3A1%7D&checkableitems[0]=100001409031727&__user=100003798185175&__a=1&phstamp=1658167651125710668131"
                                    string strPostData = "fb_dtsg=" + fb_dtsg + "&profileChooserItems=" + profileChooserItems + checkableitems + "&__user="******"&__a=1&__dyn=798aD5z5ynU&__req=a&phstamp=" + Utils.GenerateTimeStamp() + ""; //fb_dtsg=AQCAp9jD&profileChooserItems=%7B%22100001409031727%22%3A1%7D&checkableitems[0]=100001409031727&__user=100003798185175&__a=1&phstamp=1658167651125710668131"

                                    //string strPostURL = "http://www.facebook.com/ajax/events/permalink/invite.php?plan_id=" + strplan_id + "&profile_chooser=1";

                                    string strPostURL = FBGlobals.Instance.EventInviterPostAjaxInvitePlan_Id + strplan_id + "&source=1";


                                    string lastResponseStatus = string.Empty;
                                    //  string strResponse = HttpHelper.postFormData(new Uri(strPostURL), strPostData);//HttpHelper.postFormData(new Uri(strPostURL), strPostData);

                                    string strResponse = HttpHelper.postFormData(new Uri(strPostURL), strPostData, ref lastResponseStatus, lstEventURLsFileitem);//string strResponse = HttpHelper.postFormData(new Uri(strPostURL), strPostData, ref lastResponseStatus)//HttpHelper.postFormData(new Uri(strPostURL), strPostData);
                                    if (lastResponseStatus.Contains("error: (404) Not Found"))
                                    {
                                        GlobusLogHelper.log.Info("URL : " + lstEventURLsFileitem + " isn't owned by Username : "******"URL : " + lstEventURLsFileitem + " isn't owned by Username : "******"error"))
                                    {
                                        foreach (string id in item)
                                        {
                                            GlobusLogHelper.log.Info("Invited : " + id + " with UserName : "******" for URL : " + lstEventURLsFileitem);
                                            GlobusLogHelper.log.Debug("Invited : " + id + " with UserName : "******" for URL : " + lstEventURLsFileitem);
                                            try
                                            {
                                                int delayInSeconds = Utils.GenerateRandom(minDelayEventInvitor * 1000, maxDelayEventInvitor * 1000);
                                                GlobusLogHelper.log.Info("Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Error : " + ex.StackTrace);
                                            }
                                        }

                                        GlobusLogHelper.log.Info("Invited Friends : " + item.Count + " with UserName : "******"Invited Friends : " + item.Count + " with UserName : "******" Error With URL : " + lstEventURLsFileitem + " By Username : "******" Error With URL : " + lstEventURLsFileitem + " By Username : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Delaying for " + delayInSeconds / 1000 + " Seconds With UserName : "******"Error : " + ex.StackTrace);
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }
                        }

                        #endregion
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }

            GlobusLogHelper.log.Info("Process Completed With User Name : " + fbUser.username);
            GlobusLogHelper.log.Debug("Process Completed With User Name : " + fbUser.username);
        }
コード例 #21
0
ファイル: AccountManager.cs プロジェクト: shah8701/faceboard
        private bool SolveFacebookCaptcha(ref FacebookUser fbUser, GlobusHttpHelper HttpHelper, ref string captchaUrl, string fb_dtsg, string temp_nh, string tempPostUrl, string tempresponse, string captcha_persist_data, ref string challengeurl, ref string captchaText, ref string tempcaptchresponse)
        {
            try
            {
                GlobusLogHelper.log.Info("Try to solving facebook captcha : " + fbUser.username);
                GlobusLogHelper.log.Debug("Try to solving facebook captcha : " + fbUser.username);

                challengeurl = tempresponse.Substring(tempresponse.IndexOf("captcha_challenge_code="), (tempresponse.IndexOf("captcha_challenge_hash=", tempresponse.IndexOf("captcha_challenge_code=")) - tempresponse.IndexOf("captcha_challenge_code="))).Replace("captcha_challenge_code=", string.Empty).Trim().Replace(")", string.Empty).Replace("'", string.Empty).Replace("\"", string.Empty).Replace("\"", string.Empty).Replace(" ", string.Empty).Trim().Replace("&amp;", "");

                string facebookurl = FBGlobals.Instance.AccountVerificationCaptchaTfbimageChallengeUrl + challengeurl + "&captcha_challenge_hash=" + captcha_persist_data;  //"https://www.facebook.com/captcha/tfbimage.php?captcha_challenge_code="
                captchaUrl = facebookurl;

                byte[] captchaPgsrc = HttpHelper.getImgfromUrl(new Uri(captchaUrl));
                System.Net.WebClient webclient = new System.Net.WebClient();
                string[] arr1 = new string[3] { FBGlobals.dbcUserName, FBGlobals.dbcPassword, "" };
                captchaText = DecodeDBC(arr1, captchaPgsrc);

                if (!string.IsNullOrEmpty(captchaText))
                {
                    string captchapostdata = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&geo=true&captcha_persist_data=" + captcha_persist_data + "&captcha_response=" + captchaText + "&achal=8&submit%5BSubmit%5D=Submit";
                    tempcaptchresponse = HttpHelper.postFormData(new Uri(tempPostUrl), captchapostdata, FBGlobals.Instance.AccountVerificationCheckpointUrl);
                    if (tempcaptchresponse.Contains("To verify that you are the owner of this account, please identify the people tagged in the following photos. If you aren't sure about a question, please click") || tempcaptchresponse.Contains("To make sure this is your account, we need you to upload a color photo of your government-issued ID. Your ID should include your name"))
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine(fbUser.username + ":" + fbUser.password + ":" + fbUser.proxyip + ":" + fbUser.proxyport + ":" + fbUser.proxyusername + ":" + fbUser.password, exportFilePathAccountVerification + "\\SecurityAccountWithPhotoVerify.txt");

                        GlobusLogHelper.log.Info("Your Username : "******" Need Photo for Identification ");
                        GlobusLogHelper.log.Debug("Your Username : "******" Need Photo for Identification ");

                        return true;
                    }
                    if (tempcaptchresponse.Contains("Use a phone to verify your account"))
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine(fbUser.username + ":" + fbUser.password + ":" + fbUser.proxyip + ":" + fbUser.proxyport + ":" + fbUser.proxyusername + ":" + fbUser.password, exportFilePathAccountVerification + "\\UsePhoneToVerifyYourAccount.txt");

                        GlobusLogHelper.log.Info("Your Username : "******" Use a phone to verify your account ");
                        GlobusLogHelper.log.Debug("Your Username : "******" Use a phone to verify your account ");

                        return true;
                    }
                    if (tempcaptchresponse.Contains("Please confirm your identity") && tempcaptchresponse.Contains("Provide your birthday"))
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine(fbUser.username + ":" + fbUser.password + ":" + fbUser.proxyip + ":" + fbUser.proxyport + ":" + fbUser.proxyusername + ":" + fbUser.password, exportFilePathAccountVerification + "\\Provideyourbirthday.txt");

                        GlobusLogHelper.log.Info("Your Username : "******" Provide your birthday ");
                        GlobusLogHelper.log.Debug("Your Username : "******" Provide your birthday ");

                        return true;
                    }

                    if (tempcaptchresponse.Contains("The text you entered didn&#039;t match the security check"))
                    {
                        //GlobusFileHelper.AppendStringToTextfileNewLine(fbUser.username + ":" + fbUser.password + ":" + fbUser.proxyip + ":" + fbUser.proxyport + ":" + fbUser.proxyusername + ":" + fbUser.password, exportFilePathAccountVerification + "\\UsePhoneToVerifyYourAccount.txt");

                        GlobusLogHelper.log.Info("Your Username : "******" The text you entered didn't match the security check ");
                        GlobusLogHelper.log.Debug("Your Username : "******" The text you entered didn't match the security check ");
                    }
                    return false;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
            return false;
        }
コード例 #22
0
        public bool Login()
        {
            string OAuthVerifier      = string.Empty;
            string OAuthenticityToken = string.Empty;
            string OAuthToken         = string.Empty;
            string PinToken           = string.Empty;
            string InviteUrl          = string.Empty;

            bool IsAccountCreated = false;

            try
            {
                string ts = GenerateTimeStamp();

                InviteUrl = "http://pinterest.com/invited/?email=" + PinEmail + "&invite=" + InviteCode;
                InviteUrl = "http://pinterest.com/invited/?invite=" + InviteCode;

                int intProxyPort = 80;
                if (ApplicationData.ValidateNumber(this.proxyPort))
                {
                    intProxyPort = int.Parse(this.proxyPort);
                }

                string TwitterPageContent = httpHelper.getHtmlfromUrlProxy(new Uri("https://twitter.com/"), "", this.proxyAddress, intProxyPort, this.proxyUsername, this.proxyPassword, this.userAgent);
                string BootPageContent    = httpHelper.getHtmlfromUrl(new Uri("https://twitter.com/account/bootstrap_data?r=0.9414130715097342"), "https://twitter.com/", "", this.userAgent);

                //string PostData = "session%5Busername_or_email%5D=" + TwitterUsername + "&session%5Bpassword%5D=" + TwitterPassword  + "&scribe_log=%5B%22%7B%5C%22event_name%5C%22%3A%5C%22web%3Afront%3Alogin_callout%3Aform%3A%3Alogin_click%5C%22%2C%5C%22noob_level%5C%22%3Anull%2C%5C%22internal_referer%5C%22%3Anull%2C%5C%22user_id%5C%22%3A0%2C%5C%22page%5C%22%3A%5C%22front%5C%22%2C%5C%22_category_%5C%22%3A%5C%22client_event%5C%22%2C%5C%22ts%5C%22%3A" + ts + "%7D%22%5D&redirect_after_login="******"https://twitter.com/sessions?phx=1"), PostData, "https://twitter.com/", "" , this.userAgent);

                //string ts = GenerateTimeStamp();
                string get_twitter_first = string.Empty;
                try
                {
                    get_twitter_first = httpHelper.getHtmlfromUrlProxy(new Uri("https://twitter.com/"), "", proxyAddress, 0, proxyUsername, proxyPassword, "");
                }
                catch (Exception ex)
                {
                    //string get_twitter_first = globusHttpHelper1.getHtmlfromUrlp(new Uri("http://twitter.com/"), string.Empty, string.Empty);
                    //Thread.Sleep(1000);
                    get_twitter_first = httpHelper.getHtmlfromUrlProxy(new Uri("https://twitter.com/"), "", proxyAddress, 0, proxyUsername, proxyPassword, "");
                }

                string postAuthenticityToken = "";

                int startIndx = get_twitter_first.IndexOf("postAuthenticityToken");
                if (startIndx > 0)
                {
                    int indexstart = startIndx + "postAuthenticityToken".Length + 3;
                    int endIndx    = get_twitter_first.IndexOf("\"", startIndx);

                    postAuthenticityToken = get_twitter_first.Substring(startIndx, endIndx - startIndx).Replace(",", "");

                    if (postAuthenticityToken.Contains("postAuthenticityToken"))
                    {
                        try
                        {
                            string[] getOuthentication = System.Text.RegularExpressions.Regex.Split(get_twitter_first, "\"postAuthenticityToken\":\"");
                            string[] authenticity      = System.Text.RegularExpressions.Regex.Split(getOuthentication[1], ",");

                            if (authenticity[0].IndexOf("\"") > 0)
                            {
                                int    indexStart1 = authenticity[0].IndexOf("\"");
                                string start       = authenticity[0].Substring(0, indexStart1);
                                postAuthenticityToken = start.Replace("\"", "").Replace(":", "");
                            }
                        }
                        catch { };
                    }
                }
                else
                {
                    string[] array = System.Text.RegularExpressions.Regex.Split(get_twitter_first, "<input type=\"hidden\"");
                    foreach (string item in array)
                    {
                        if (item.Contains("authenticity_token"))
                        {
                            int startindex = item.IndexOf("value=\"");
                            if (startindex > 0)
                            {
                                string start    = item.Substring(startindex).Replace("value=\"", "");
                                int    endIndex = start.IndexOf("\"");
                                string end      = start.Substring(0, endIndex);
                                postAuthenticityToken = end;
                                break;
                            }
                        }
                    }
                }

                string get_twitter_second = httpHelper.postFormData(new Uri("https://twitter.com/scribe"), "log%5B%5D=%7B%22event_name%22%3A%22web%3Amobile_gallery%3Agallery%3A%3A%3Aimpression%22%2C%22noob_level%22%3Anull%2C%22internal_referer%22%3Anull%2C%22context%22%3A%22mobile_gallery%22%2C%22event_info%22%3A%22mobile_app_download%22%2C%22user_id%22%3A0%2C%22page%22%3A%22mobile_gallery%22%2C%22_category_%22%3A%22client_event%22%2C%22ts%22%3A" + ts + "%7D", "https://twitter.com/?lang=en&logged_out=1#!/download", "", ""); //globusHttpHelper.getHtmlfromUrl(new Uri("https://twitter.com/account/bootstrap_data?r=0.21632839148912897"), "https://twitter.com/", string.Empty);

                string get2nd = httpHelper.getHtmlfromUrlProxy(new Uri("http://twitter.com/account/bootstrap_data?r=0.21632839148912897"), "https://twitter.com/", proxyAddress, 0, proxyUsername, proxyPassword, "");

                string get_api = httpHelper.getHtmlfromUrl(new Uri("http://api.twitter.com/receiver.html"), "https://twitter.com/", "", "");


                //Old postdata
                //string postData = "session%5Busername_or_email%5D=" + Username + "&session%5Bpassword%5D=" + Password + "&scribe_log=%5B%22%7B%5C%22event_name%5C%22%3A%5C%22web%3Afront%3Alogin_callout%3Aform%3A%3Alogin_click%5C%22%2C%5C%22noob_level%5C%22%3Anull%2C%5C%22internal_referer%5C%22%3Anull%2C%5C%22user_id%5C%22%3A0%2C%5C%22page%5C%22%3A%5C%22front%5C%22%2C%5C%22_category_%5C%22%3A%5C%22client_event%5C%22%2C%5C%22ts%5C%22%3A" + ts + "%7D%22%5D&redirect_after_login="******"session%5Busername_or_email%5D=" + TwitterUsername + "&session%5Bpassword%5D=" + TwitterPassword + "&scribe_log=&redirect_after_login=&authenticity_token=" + postAuthenticityToken + "";

                string response_Login = httpHelper.postFormData(new Uri("https://twitter.com/sessions"), postData, "https://twitter.com/", "", "");


                string AfterPostPageContent = httpHelper.getHtmlfromUrl(new Uri("https://twitter.com/"), "https://twitter.com/", "", this.userAgent);

                if (AfterPostPageContent.Contains("signout-button"))
                {
                    string InvitePageContent = httpHelper.getHtmlfromUrl(new Uri(InviteUrl), "", "", this.userAgent);

                    if (InvitePageContent.Contains("This invite code is not valid"))
                    {
                        IsAccountCreated = false;
                        Log("[ " + DateTime.Now + " ] => [ This invite code is not valid " + PinEmail + " ]");
                        return(IsAccountCreated);
                    }

                    string InvitedPageContent = httpHelper.getHtmlfromUrl(new Uri("http://pinterest.com/twitter/?invited=1"), InviteUrl, "", this.userAgent);

                    if (InvitedPageContent.Contains("Logout"))
                    {
                        IsAccountCreated = true;
                        Log("[ " + DateTime.Now + " ] => [ This twitter account allready added with pinterest " + TwitterUsername + " ]");
                        return(IsAccountCreated);
                    }

                    Uri ResponseUri = httpHelper.GetResponseData();


                    if (!string.IsNullOrEmpty(ResponseUri.OriginalString))
                    {
                        if (ResponseUri.OriginalString.Contains("verify_captcha/?"))
                        {
                            //List<string> lstData = GetCapctha();
                            //string challenge = string.Empty;
                            //string response = string.Empty;


                            //challenge = lstData[0].ToString();
                            //response = lstData[1].ToString();
                            //response = response.Replace(" ", "+");
                            //string postUrl = "http://pinterest.com/verify_captcha/?src=register&return=%2Fwelcome%2F";
                            //string postData = "challenge=" + challenge + "&response=" + response;

                            //string POstResponse = httpHelper.postFormData(new Uri(postUrl), postData, "", string.Empty);

                            //string pageSrcWelcome = httpHelper.getHtmlfromUrl(new Uri("http://pinterest.com/welcome/"), postUrl, "");
                        }
                        if (ResponseUri.OriginalString.Contains("http://pinterest.com/twitter/?oauth_token"))
                        {
                            OAuthVerifier = ResponseUri.OriginalString;

                            int    FirstPointToken     = InvitedPageContent.IndexOf("csrfmiddlewaretoken");
                            string FirstTokenSubString = InvitedPageContent.Substring(FirstPointToken);

                            int SecondPointToken = FirstTokenSubString.IndexOf("/>");
                            PinToken = FirstTokenSubString.Substring(0, SecondPointToken).Replace("csrfmiddlewaretoken", string.Empty).Replace("value=", string.Empty).Replace("'", string.Empty).Trim();
                        }
                        if (ResponseUri.OriginalString.Contains("api.twitter.com/oauth/authenticate?oauth_token="))
                        {
                            int FirstAuthenticityPoint = InvitedPageContent.IndexOf("authenticity_token\" type=\"hidden\"");

                            string FirstSubAuthenticity = InvitedPageContent.Substring(FirstAuthenticityPoint);
                            OAuthenticityToken = FirstSubAuthenticity.Substring(FirstSubAuthenticity.IndexOf("value="), (FirstSubAuthenticity.IndexOf("/></div>")) - (FirstSubAuthenticity.IndexOf("value="))).Replace("value=", string.Empty).Replace("\"", string.Empty).Trim();

                            OAuthToken = ResponseUri.OriginalString.Replace("https://api.twitter.com/oauth/authenticate?oauth_token=", string.Empty).Replace("http://api.twitter.com/oauth/authenticate?oauth_token=", string.Empty);

                            string AcceptPostData = "authenticity_token=" + OAuthenticityToken + "&oauth_token=" + OAuthToken;

                            string OauthUrl = "https://twitter.com/oauth/authenticate?oauth_token=" + OAuthToken;

                            string AcceptedPageContent = httpHelper.postFormData(new Uri("https://twitter.com/oauth/authenticate"), AcceptPostData, OauthUrl, string.Empty, this.userAgent);

                            int FirstOAuthVerifierPoint = AcceptedPageContent.IndexOf("http://pinterest.com/twitter/?oauth_token=");

                            string FirstSuboAuth = AcceptedPageContent.Substring(FirstOAuthVerifierPoint);

                            OAuthVerifier = FirstSuboAuth.Substring(0, FirstSuboAuth.IndexOf(">")).Replace("\"", string.Empty).Trim();//.Replace("&oauth_verifier=", string.Empty).Trim();

                            string PinterestRegistrationPageContent = httpHelper.getHtmlfromUrl(new Uri(OAuthVerifier), string.Empty, string.Empty, this.userAgent);

                            if (!PinterestRegistrationPageContent.Contains("Oops! We are having some issues talking to Twitter. Please try again later"))
                            {
                                int    FirstPointToken     = PinterestRegistrationPageContent.IndexOf("csrfmiddlewaretoken");
                                string FirstTokenSubString = PinterestRegistrationPageContent.Substring(FirstPointToken);

                                int SecondPointToken = FirstTokenSubString.IndexOf("/>");
                                PinToken = FirstTokenSubString.Substring(0, SecondPointToken).Replace("csrfmiddlewaretoken", string.Empty).Replace("value=", string.Empty).Replace("'", string.Empty).Trim();
                            }
                            else
                            {
                                Log("[ " + DateTime.Now + " ] => [ We are having some issues talking to Twitter. Please try again later ]");
                                return(false);
                            }
                        }


                        //Checking For User Name
                        string CheckUserNameUrl = "http://pinterest.com/check_username/?check_username="******"&csrfmiddlewaretoken=" + PinToken;
                        string User             = httpHelper.getHtmlfromUrl(new Uri(CheckUserNameUrl), OAuthVerifier, PinToken, this.userAgent);

                        if (User.Contains("username is already"))
                        {
                            int num = RandomNumberGenerator.GenerateRandom(100, 1000);

                            PinUserName = PinUserName + num.ToString();

                            //Checking For User Name
                            CheckUserNameUrl = "http://pinterest.com/check_username/?check_username="******"&csrfmiddlewaretoken=" + PinToken;
                            User             = httpHelper.getHtmlfromUrl(new Uri(CheckUserNameUrl), OAuthVerifier, PinToken, this.userAgent);
                        }

                        ////Checking For User Name
                        //string CheckEmailUrl = "http://pinterest.com/check_username/?check_email=" + PinEmail + "&csrfmiddlewaretoken=" + PinToken;
                        //string Email = httpHelper.getHtmlfromUrl(new Uri(CheckEmailUrl), OAuthVerifier, PinToken);

                        //if (!Email.Contains("success"))
                        //{
                        //    //IsPinLoggedIn = true;
                        //    Log("This email not valid " + PinEmail);
                        //    return;
                        //}
                        string RegistrationPostData = "username="******"&email=" + PinEmail + "&password="******"&invite=" + InviteCode.Replace(" ", "").Replace("http://email.pinterest.com/wf/click&upn=", "") + "&twitter=1&csrfmiddlewaretoken=" + PinToken + "&user_image=http%3A%2F%2Fimg.tweetimag.es%2Fi%2FSocioPro_o";

                        string RegistredPageContent = httpHelper.postFormData(new Uri("http://pinterest.com/register/"), RegistrationPostData, OAuthVerifier, string.Empty, this.userAgent);

                        if (RegistredPageContent.Contains("recaptcha/api/js/recaptcha"))
                        {
                            List <string> lstData   = GetCapctha();
                            string        challenge = string.Empty;
                            string        response  = string.Empty;


                            challenge = lstData[0].ToString();
                            response  = lstData[1].ToString();
                            response  = response.Replace(" ", "+");
                            string postUrl   = "http://pinterest.com/verify_captcha/?src=register&return=/welcome/";
                            string postData1 = "challenge=" + challenge + "&response=" + response;

                            string POstResponse = httpHelper.postFormData(new Uri(postUrl), postData1, OAuthVerifier, PinToken, this.userAgent);

                            RegistredPageContent = httpHelper.getHtmlfromUrl(new Uri("http://pinterest.com/welcome/"), "", "", this.userAgent);
                        }
                        if (RegistredPageContent.Contains("architecture"))
                        {
                            IsAccountCreated = true;
                            Log("[ " + DateTime.Now + " ] => [ Account Created " + PinUserName + " ]");
                        }
                        else
                        {
                            IsAccountCreated = false;
                            Log("[ " + DateTime.Now + " ] => [ Account Not Created " + PinUserName + " ]");
                            return(IsAccountCreated);
                        }

                        string WelcomPageContent = httpHelper.postFormData(new Uri("http://pinterest.com/welcome/"), "", OAuthVerifier, PinToken, this.userAgent);

                        //Changed By  Gargi On 22nd May 2012 --> request from fiddler changed
                        //string CategoryPostData = "categories=architecture&user_follow=true";

                        string CategoryPostData = "categories=art%2Ccars_motorcycles%2Cdesign%2Cdiy_crafts%2Ceducation%2Carchitecture%2Cfitness";

                        string CategoryPageContent = httpHelper.postFormData(new Uri("http://pinterest.com/welcome/"), CategoryPostData, "http://pinterest.com/welcome/", PinToken, this.userAgent);

                        if (CategoryPageContent.Contains("success"))
                        {
                            IsAccountCreated = true;
                            Log("[ " + DateTime.Now + " ] => [ Initial Category Added " + PinUserName + " ]");
                        }

                        string AllowUserPostData = "follow_users%5B%5D=sharp&follow_users%5B%5D=neillehepworth&follow_users%5B%5D=miamalm&follow_users%5B%5D=kiluka&follow_users%5B%5D=gaileguevara&follow_users%5B%5D=jellway&follow_users%5B%5D=richard_larue&follow_users%5B%5D=rayestudio&follow_users%5B%5D=jdraper&follow_users%5B%5D=shashashasha";
                        //if (string.IsNullOrEmpty(ApplicationData.UsersToFollow))
                        //{
                        //    AllowUserPostData = "follow_users%5B%5D=sharp&follow_users%5B%5D=neillehepworth&follow_users%5B%5D=miamalm&follow_users%5B%5D=kiluka&follow_users%5B%5D=gaileguevara&follow_users%5B%5D=jellway&follow_users%5B%5D=richard_larue&follow_users%5B%5D=rayestudio&follow_users%5B%5D=jdraper&follow_users%5B%5D=shashashasha";
                        //}
                        //else
                        //{
                        //    AllowUserPostData = ApplicationData.UsersToFollow;
                        //}

                        string AlloweduserPostData = httpHelper.postFormData(new Uri("http://pinterest.com/welcome/"), AllowUserPostData, "http://pinterest.com/welcome/", PinToken, this.userAgent);

                        if (AlloweduserPostData.Contains("success"))
                        {
                            IsAccountCreated = true;
                            Log("[ " + DateTime.Now + " ] => [ Intial User Added " + PinUserName + " ]");
                        }

                        string BordPostData = "board_names%5B%5D=Products+I+Love&board_names%5B%5D=Favorite+Places+%26+Spaces&board_names%5B%5D=Books+Worth+Reading&board_names%5B%5D=My+Style&board_names%5B%5D=For+the+Home";

                        string BoardPostedPageContent = httpHelper.postFormData(new Uri("http://pinterest.com/welcome/"), BordPostData, "http://pinterest.com/welcome/", PinToken, this.userAgent);

                        if (BoardPostedPageContent.Contains("success"))
                        {
                            IsAccountCreated = true;
                            Log("[ " + DateTime.Now + " ] => [ Intial Board Added " + PinUserName + " ]");
                        }
                    }

                    return(IsAccountCreated);
                }
                else
                {
                    Log("[ " + DateTime.Now + " ] => [ Twitter Account Not Logged In :" + TwitterUsername + " ]");
                    return(IsAccountCreated);
                }
            }
            catch (Exception ex)
            {
                //Log("Error " + ex.Message);
                return(IsAccountCreated);
            }
        }
コード例 #23
0
ファイル: JoinSearchGroup.cs プロジェクト: ondrocks/inboard
        public string PostAddGroupUsingUrl(ref GlobusHttpHelper HttpHelper, Dictionary <string, Dictionary <string, string> > LinkdInContacts, string Screen_name, string pass, int mindelay, int maxdelay)
        {
            string postdata    = string.Empty;
            string postUrl     = string.Empty;
            string ResLogin    = string.Empty;
            string csrfToken   = string.Empty;
            string sourceAlias = string.Empty;

            string ReturnString = string.Empty;
            string GroupName    = string.Empty;

            try
            {
                string MessageText   = string.Empty;
                string PostedMessage = string.Empty;

                string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));
                if (pageSource.Contains("csrfToken"))
                {
                    csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50);
                    string[] Arr = csrfToken.Split('&');
                    csrfToken = Arr[0];
                    csrfToken = csrfToken.Replace(":", "%3A").Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty);
                    csrfToken = csrfToken.Trim();
                }

                if (pageSource.Contains("sourceAlias"))
                {
                    sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                    string[] Arr = sourceAlias.Split('"');
                    sourceAlias = Arr[2];
                }

                postUrl  = "https://www.linkedin.com/uas/login-submit";
                postdata = "session_key=" + Screen_name + "&session_password="******"&source_app=&trk=guest_home_login&session_redirect=&csrfToken=" + csrfToken + "&sourceAlias=" + sourceAlias;
                ResLogin = HttpHelper.postFormData(new Uri(postUrl), postdata);

                try
                {
                    foreach (KeyValuePair <string, Dictionary <string, string> > UserValue in LinkdInContacts)
                    {
                        foreach (KeyValuePair <string, string> GroupValue in UserValue.Value)
                        {
                            post_url = string.Empty;
                            post_url = (GroupValue.Key + ":" + GroupValue.Value);
                            try
                            {
                                string GoBack = "/%2Eanb_" + post_url.Split(':')[1];
                                LogGroupUrl("[ " + DateTime.Now + " ] => [ ID: " + Screen_name + " has Joining the Group: " + post_url.Split(':')[0] + " ]");
                                string pageGetreq = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/groupRegistration?gid=" + post_url.Split(':')[1] + "&csrfToken=" + csrfToken + "&trk=group-join-button"));


                                if (pageGetreq.Contains("Your request to join the"))
                                {
                                    ReturnString = "Your request to join the: " + post_url.Split(':')[0] + " group has been received.";
                                    LogGroupUrl("[ " + DateTime.Now + " ] => [ " + ReturnString + " ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + ReturnString, Globals.path_JoinSearchGroupSuccess);
                                }
                                else if (pageGetreq.Contains("Welcome to the"))
                                {
                                    ReturnString = "Welcome to the: " + post_url.Split(':')[0] + " group on LinkedIn.";
                                    LogGroupUrl("[ " + DateTime.Now + " ] => [ " + ReturnString + " ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + ReturnString, Globals.path_JoinSearchGroupSuccess);
                                }
                                else if (pageGetreq.Contains("You're already a member of the"))
                                {
                                    ReturnString = "You're already a member of the: " + post_url.Split(':')[0] + "";
                                    LogGroupUrl("[ " + DateTime.Now + " ] => [ " + ReturnString + " ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + ReturnString, Globals.path_JoinSearchGroupSuccess);
                                }
                                else if (pageGetreq.Contains("Your settings have been updated"))
                                {
                                    ReturnString = "Your request to join the: " + post_url.Split(':')[0] + " group has been received.";
                                    LogGroupUrl("[ " + DateTime.Now + " ] => [ " + ReturnString + " ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + ReturnString, Globals.path_JoinSearchGroupSuccess);
                                }
                                else if (pageGetreq.Contains("We’re sorry, this group has reached its maximum number of members allowed. If you have any questions, please contact the group manager for more information"))
                                {
                                    LogGroupUrl("[ " + DateTime.Now + " ] => [ We’re sorry, this group has reached its maximum number of members allowed. ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + "We’re sorry, this group has reached its maximum number of members allowed.", Globals.path_JoinSearchGroupFail);
                                }
                                else if (pageGetreq.Contains("reached or exceeded the maximum number of pending group applications."))
                                {
                                    LogGroupUrl("[ " + DateTime.Now + " ] => [ We’re sorry...You’ve reached or exceeded the maximum number of pending group applications. Please wait for your pending requests to be approved by a group manager or withdraw pending requests before joining new groups. ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + "We’re sorry...You’ve reached or exceeded the maximum number of pending group applications. Please wait for your pending requests to be approved by a group manager or withdraw pending requests before joining new groups. ", Globals.path_JoinSearchGroupFail);
                                }
                                else if (pageGetreq.Contains("reached or exceeded the maximum number of confirmed and pending groups."))
                                {
                                    ReturnString = "You’ve reached or exceeded the maximum number of confirmed and pending groups.";
                                    LogGroupUrl("[ " + DateTime.Now + " ] => [ You’ve reached or exceeded the maximum number of confirmed and pending groups.]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + ReturnString, Globals.path_JoinSearchGroupFail);
                                }
                                else if (pageGetreq.Contains("Error"))
                                {
                                    LogGroupUrl("[ " + DateTime.Now + " ] => [ Error In Joining Group ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + "Error In Joining Group", Globals.path_JoinSearchGroupFail);
                                }
                                else
                                {
                                    LogGroupUrl("[ " + DateTime.Now + " ] => [ Group Could Not Be Joined ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(Screen_name + ":" + "Group Could Not Be Joined", Globals.path_JoinSearchGroupFail);
                                }
                            }
                            catch { }

                            int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                            LogGroupUrl("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                            Thread.Sleep(delay * 1000);
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogGroupUrl(DateTime.Now + " [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> PostSearchGroupAddFinal() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> Add Search Groups --> PostSearchGroupAddFinal() >>>> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinAddSearchGroupErrorLogs);
                ReturnString = "Error";
            }
            return(ReturnString);
        }
コード例 #24
0
		public bool AddaPicture(ref GlobusHttpHelper HttpHelper, string Username, string Password, List<string> localImagePath, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, string targeturl, string message, ref string status, string pageSource_Home, string xhpc_targetid, string xhpc_composerid, string message_text, string fb_dtsg, string UsreId, string pageSource, ref int tempCountMain)        
		{


			int tempCount = 0;
			startAgain:

			bool isSentPicMessage = false;
		
			string photo_id = string.Empty;


			try
			{
			

				string composer_session_id = "";

				string tempresponse1 = "";
				///temp post
				{
					string source = "";
					string profile_id = "";
					string gridID = "";
					//  string qn = string.Empty;

					try
					{
						string Url = "https://www.facebook.com/ajax/composerx/attachment/media/upload/?composerurihash=1";
						string posturl1 = "fb_dtsg=" + fb_dtsg + "&composerid=" + xhpc_composerid + "&targetid=" + xhpc_targetid + "&loaded_components[0]=maininput&loaded_components[1]=cameraicon&loaded_components[2]=withtaggericon&loaded_components[3]=placetaggericon&loaded_components[4]=mainprivacywidget&loaded_components[5]=cameraicon&loaded_components[6]=mainprivacywidget&loaded_components[7]=withtaggericon&loaded_components[8]=placetaggericon&loaded_components[9]=maininput&nctr[_mod]=pagelet_group_composer&__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=i&phstamp=16581688688747595501";    //"fb_dtsg=" + fb_dtsg + "&composerid=" + xhpc_composerid + "&targetid=" + xhpc_targetid + "&istimeline=1&timelinelocation=composer&loaded_components[0]=maininput&loaded_components[1]=mainprivacywidget&loaded_components[2]=mainprivacywidget&loaded_components[3]=maininput&loaded_components[4]=explicitplaceinput&loaded_components[5]=hiddenplaceinput&loaded_components[6]=placenameinput&loaded_components[7]=hiddensessionid&loaded_components[8]=withtagger&loaded_components[9]=backdatepicker&loaded_components[10]=placetagger&loaded_components[11]=withtaggericon&loaded_components[12]=backdateicon&loaded_components[13]=citysharericon&nctr[_mod]=pagelet_timeline_recent&__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=18&phstamp=1658168111112559866679";
						// string PostUrl = "city_id=" + CityIDS1 + "&city_page_id=" + city_page_id + "&city_name=" + CityName1 + "&is_default=false&session_id=1362404125&__user="******"&__a=1&__dyn=798aD5z5ynU&__req=z&fb_dtsg=" + fb_dtsg + "&phstamp=1658168111112559866165";
						string res11 = HttpHelper.postFormData(new Uri(Url), posturl1);


						try
						{
							source = res11.Substring(res11.IndexOf("source\":"), (res11.IndexOf(",", res11.IndexOf("source\":")) - res11.IndexOf("source\":"))).Replace("source\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();

						}
						catch (Exception ex)
						{
							Console.WriteLine(ex.StackTrace);
						}
						if (string.IsNullOrEmpty(source))
						{
							source = GlobusHttpHelper.getBetween(res11, "source", "profile_id").Replace("\\\"","").Replace(",","").Replace(":","").Trim();

						}
						try
						{
							profile_id = res11.Substring(res11.IndexOf("profile_id\":"), (res11.IndexOf("}", res11.IndexOf("profile_id\":")) - res11.IndexOf("profile_id\":"))).Replace("profile_id\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
							if (profile_id.Contains(","))
							{
								profile_id = ParseEncodedJson(res11, "profile_id");
							}
							//"gridID":
						}
						catch (Exception ex)
						{
							Console.WriteLine(ex.StackTrace);
						}
						if (string.IsNullOrEmpty(profile_id))
						{
							profile_id = GlobusHttpHelper.getBetween(res11, "profile_id", "}").Replace("\\\"", "").Replace(",", "").Replace(":", "").Trim();
						}
						try
						{
							gridID = res11.Substring(res11.IndexOf("gridID\":"), (res11.IndexOf(",", res11.IndexOf("gridID\":")) - res11.IndexOf("gridID\":"))).Replace("gridID\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
						}
						catch (Exception ex)
						{
							Console.WriteLine(ex.StackTrace);
						}
						if (string.IsNullOrEmpty(gridID))
						{
							gridID = GlobusHttpHelper.getBetween(res11, "gridID", ",").Replace("\\\"", "").Replace(",", "").Replace(":", "").Trim(); ;
						}


						try
						{
							composer_session_id = res11.Substring(res11.IndexOf("composer_session_id\":"), (res11.IndexOf("}", res11.IndexOf("composer_session_id\":")) - res11.IndexOf("composer_session_id\":"))).Replace("composer_session_id\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();
						}
						catch (Exception ex)
						{
							Console.WriteLine(ex.StackTrace);
						}

						try
						{
							if (string.IsNullOrEmpty(composer_session_id))
							{
								composer_session_id = res11.Substring(res11.IndexOf("composerID\":"), (res11.IndexOf("}", res11.IndexOf("composerID\":")) - res11.IndexOf("composerID\":"))).Replace("composerID\":", string.Empty).Replace("<dd>", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim();

							}
						}
						catch (Exception ex)
						{
							Console.WriteLine(ex.StackTrace);
						}

						try
						{
							qn =GlobusHttpHelper.getBetween(res11, "qn", "/>");
							qn =qn.Replace("\\\\\\\"","@");
							qn =GlobusHttpHelper.getBetween(qn, "@ value=@", "@");
						}
						catch (Exception ex)
						{
							Console.WriteLine(ex.StackTrace);
						}
					}
					catch (Exception ex)
					{
						Console.WriteLine(ex.StackTrace);
					}

					NameValueCollection nvc1 = new NameValueCollection();
					try
					{
						//message = Uri.EscapeDataString(message);
					}
					catch (Exception ex)
					{
						Console.WriteLine(ex.StackTrace);
					}

				
					nvc1.Add("fb_dtsg", fb_dtsg);
					nvc1.Add("source", source);
					nvc1.Add("profile_id", profile_id);
					nvc1.Add("grid_id", gridID);
					nvc1.Add("upload_id", "1024");
					nvc1.Add("qn", qn);


					string _rev =GlobusHttpHelper.getBetween(pageSource, "svn_rev", ",");
					_rev = _rev.Replace("\":", string.Empty);


					string uploadURL = "https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=" + xhpc_targetid + "&__user="******"&__a=1&__dyn=7n88Oq9ccmqDxl2u5Fa8HzCqm5Aqbx2mbAKGiBAGm&__req=1t&fb_dtsg=" + fb_dtsg + "&__rev=" + _rev + "";
				   //  tempresponse1 = HttpHelper.HttpUploadFile_UploadPic_tempforsingle(ref HttpHelper, UsreId, uploadURL, "composer_unpublished_photo[]", "image/jpeg", localImagePath, nvc1, "", proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);

					if (tempresponse1.ToLower().Contains("errorsummary") && tempresponse1.ToLower().Contains("There was a problem with this request. We're working on getting it fixed as soon as we can".ToLower()))
					{
						if (tempCount < 2)
						{
							System.Threading.Thread.Sleep(15000);
							tempCount++;
							goto startAgain;
						}
						else
						{
							tempCountMain++;
							return false;
						}
					}



				}

				NameValueCollection nvc = new NameValueCollection();
				try
				{
					//message = Uri.EscapeDataString(message);
				}
				catch (Exception ex)
				{
					Console.WriteLine(ex.StackTrace);
				}
				nvc.Add("fb_dtsg", fb_dtsg);
				nvc.Add("xhpc_targetid", xhpc_targetid);
				nvc.Add("xhpc_context", "profile");
				nvc.Add("xhpc_ismeta", "1");
				nvc.Add("xhpc_fbx", "1");
				nvc.Add("xhpc_timeline", "");
				nvc.Add("xhpc_composerid", xhpc_composerid);
				nvc.Add("xhpc_message_text", message);
				nvc.Add("xhpc_message", message);
			


				string composer_unpublished_photo = "";
				try
				{
					string start_composer_unpublished_photo = Regex.Split(tempresponse1, "},\"")[1];// 



					int startIndex_composer_unpublished_photo = start_composer_unpublished_photo.IndexOf(",\"") + ",\"".Length;
					int endIndex_composer_unpublished_photo = start_composer_unpublished_photo.IndexOf("\"", startIndex_composer_unpublished_photo + 1);

					composer_unpublished_photo = start_composer_unpublished_photo.Substring(startIndex_composer_unpublished_photo, endIndex_composer_unpublished_photo - startIndex_composer_unpublished_photo);
				}
				catch (Exception ex)
				{
					Console.WriteLine(ex.StackTrace);
				}

				if (tempresponse1.Contains("composer_unpublished_photo"))
				{
					try
					{
						composer_unpublished_photo = tempresponse1.Substring(tempresponse1.IndexOf("composer_unpublished_photo[]"), tempresponse1.IndexOf("u003Cbutton") - tempresponse1.IndexOf("composer_unpublished_photo[]")).Replace("composer_unpublished_photo[]", "").Replace("value=", "").Replace("\\", "").Replace("\\", "").Replace("/>", "").Replace("\"", "").Trim();

					}
					catch (Exception ex)
					{
						Console.WriteLine(ex.StackTrace);
					}
				}
				///New test upload pic post
				string waterfallid = GlobusHttpHelper.ParseJson(pageSource_Home, "waterfallID");

				if (waterfallid.Contains("ar"))
				{
					waterfallid = qn;
				}


				string newpostURL = "https://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88QoAMNoBwXAw&__req=r&fb_dtsg=" + fb_dtsg + "";
				string newPostData = "";


				NameValueCollection newnvc = new NameValueCollection();
				try
				{
					//message = Uri.EscapeDataString(message);
				}
				catch (Exception ex)
				{
					Console.WriteLine(ex.StackTrace);
				}

				newnvc.Add("fb_dtsg", fb_dtsg);
				newnvc.Add("xhpc_targetid", xhpc_targetid);
				newnvc.Add("xhpc_context", "profile");
				newnvc.Add("xhpc_ismeta", "1");
				newnvc.Add("xhpc_fbx", "1");
				newnvc.Add("xhpc_timeline", "");
				newnvc.Add("xhpc_composerid", xhpc_composerid);
				newnvc.Add("xhpc_message_text", message);
				newnvc.Add("xhpc_message", message);

				newnvc.Add("composer_unpublished_photo[]", composer_unpublished_photo);
				newnvc.Add("album_type", "128");
				newnvc.Add("is_file_form", "1");
				newnvc.Add("oid", "");
				newnvc.Add("qn", waterfallid);
				newnvc.Add("application", "composer");
				newnvc.Add("is_explicit_place", "");
				newnvc.Add("composertags_place", "");
				newnvc.Add("composertags_place_name", "");
				newnvc.Add("composer_session_id", composer_session_id);
				newnvc.Add("composertags_city", "");
				newnvc.Add("vzdisable_location_sharing", "false");
				newnvc.Add("composer_predicted_city", "");



				string response =HttpHelper.HttpUploadFile_UploadPic(ref HttpHelper, UsreId, newpostURL, "file1", "image/jpeg", localImagePath, newnvc, targeturl, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);//HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "http://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88O49ccm9o-2Ki&__req=1c&fb_dtsg=" + fb_dtsg + "", "file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);


				if (response.Contains("post this because it has a blocked link"))
				{
					try
					{
						AddToLogger_GroupManager("-------blocked link-------");
						return false;

					}
					catch (Exception ex)
					{
						Console.WriteLine(ex.StackTrace);
					}

				}

			
				if (string.IsNullOrEmpty(response))
				{
					try
					{

						response = HttpHelper.HttpUploadFile_UploadPic(ref HttpHelper, UsreId, "https://upload.facebook.com/media/upload/photos/composer/?__user="******"&__a=1&__dyn=7n88O49ccm9o-2Ki&__req=1c&fb_dtsg=" + fb_dtsg + "", "file1", "image/jpeg", localImagePath, nvc, targeturl, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword);
					}
					catch (Exception ex)
					{
						Console.WriteLine(ex.StackTrace);
					}
				}
				string posturl = "https://www.facebook.com/ajax/places/city_sharer_reset.php";
				string postdata = "__user="******"&__a=1&fb_dtsg=" + fb_dtsg + "&phstamp=1658167761111108210145";
				string responsestring = HttpHelper.postFormData(new Uri(posturl), postdata);
				try	
				{
					string okay = HttpHelper.getHtmlfromUrl(new Uri("https://3-pct.channel.facebook.com/pull?channel=p_" + UsreId + "&seq=3&partition=69&clientid=70e140db&cb=8p7w&idle=8&state=active&mode=stream&format=json"),"","");
				}
				catch (Exception ex)
				{
					Console.WriteLine(ex.StackTrace);
				}

				if (!string.IsNullOrEmpty(response) && response.Contains("payload\":{\"photo_fbid"))//response.Contains("photo.php?fbid="))
				{

					try
					{

						if (!response.Contains("errorSummary") || !response.Contains("error"))
						{
							isSentPicMessage = true;
						}
						if (response.Contains("Your post has been submitted and is pending approval by an admin"))
						{
							Console.WriteLine("Your post has been submitted and is pending approval by an admin." + "GroupUrl >>>" + targeturl);

						}
					}
					catch (Exception ex)
					{
						Console.WriteLine(ex.StackTrace);
					}				

				}

			}
			catch (Exception ex)
			{
				Console.WriteLine(ex.StackTrace);
			}
			return isSentPicMessage;

		}
コード例 #25
0
        public static void LoginUsingGlobusHttp(ref FacebookUser facebookUser)
        {
            ///Sign In
            try
            {
                GlobusHttpHelper objGlobusHttpHelper = facebookUser.globusHttpHelper;
                #region Post variable

                string fbpage_id         = string.Empty;
                string fb_dtsg           = string.Empty;
                string __user            = string.Empty;
                string xhpc_composerid   = string.Empty;
                string xhpc_targetid     = string.Empty;
                string xhpc_composerid12 = string.Empty;
                #endregion

                int intProxyPort = 80;

                if (!string.IsNullOrEmpty(facebookUser.proxyport) && Utils.IdCheck.IsMatch(facebookUser.proxyport))
                {
                    intProxyPort = int.Parse(facebookUser.proxyport);
                }
                Console.WriteLine("Logging in with " + facebookUser.username);
                Console.WriteLine("Logging in with " + facebookUser.username);
                string pageSource = string.Empty;
                try
                {
                    pageSource = objGlobusHttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php"), "", "");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error : " + ex.StackTrace);
                }

                if (pageSource == null || string.IsNullOrEmpty(pageSource))
                {
                    pageSource = objGlobusHttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php"), "", "");
                }

                if (pageSource == null)
                {
                    pageSource = objGlobusHttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php"), "", "");
                    return;
                }

                string valueLSD      = GlobusHttpHelper.GetParamValue(pageSource, "lsd");
                string ResponseLogin = string.Empty;
                try
                {
                    ResponseLogin = objGlobusHttpHelper.postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + valueLSD + "&locale=en_US&email=" + facebookUser.username.Split('@')[0].Replace("+", "%2B") + "%40" + facebookUser.username.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + valueLSD + "", "", "", "", "", "");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error : " + ex.StackTrace);
                }
                if (string.IsNullOrEmpty(ResponseLogin))
                {
                    ResponseLogin = objGlobusHttpHelper.postFormData(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + valueLSD + "&locale=en_US&email=" + facebookUser.username.Split('@')[0].Replace("+", "%2B") + "%40" + facebookUser.username.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + valueLSD + "", "", "", "", "", "");           //"https://www.facebook.com/login.php?login_attempt=1"
                }
                if (ResponseLogin == null)
                {
                    return;
                }

                string loginStatus = "";
                if (CheckLogin(ResponseLogin, facebookUser.username, facebookUser.password, facebookUser.proxyip, facebookUser.proxyport, facebookUser.proxyusername, facebookUser.proxypassword, ref loginStatus))
                {
                    Console.WriteLine("Logged in with Username : "******"Logged in with Username : "******"Couldn't login with Username : "******"account has been disabled")
                    {
                        // GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_DisabledAccount);
                    }

                    if (loginStatus == "Please complete a security check")
                    {
                        //GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_SecurityCheckAccounts);
                    }


                    if (loginStatus == "Your account is temporarily locked")
                    {
                        //GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_TemporarilyLockedAccount);
                    }
                    if (loginStatus == "have been blocked")
                    {
                        //GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_havebeenblocked);
                    }
                    if (loginStatus == "For security reasons your account is temporarily locked")
                    {
                        // GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_SecurityCheckAccountsforsecurityreason);
                    }

                    if (loginStatus == "Account Not Confirmed")
                    {
                        //GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_AccountNotConfirmed);
                    }
                    if (loginStatus == "Temporarily Blocked for 30 Days")
                    {
                        // GlobusFileHelper.AppendStringToTextfileNewLine(Username + ":" + Password + ":" + proxyAddress + ":" + proxyPort + ":" + proxyUsername + ":" + proxyPassword, Globals.path_30daysBlockedAccount);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }
        }
コード例 #26
0
        public void PostFinalMsgGroupMember(ref GlobusHttpHelper HttpHelper, Dictionary <string, string> SlectedContacts, string msg, string body, string UserName, string FromemailId, string FromEmailNam, int mindelay, int maxdelay)
        {
            try
            {
                string postdata       = string.Empty;
                string postUrl        = string.Empty;
                string ResLogin       = string.Empty;
                string csrfToken      = string.Empty;
                string sourceAlias    = string.Empty;
                string ReturnString   = string.Empty;
                string PostMsgSubject = string.Empty;
                string PostMsgBody    = string.Empty;

                try
                {
                    string MessageText   = string.Empty;
                    string PostedMessage = string.Empty;

                    int totalSelectedItems = SlectedContacts.Count;
                    Log("[ " + DateTime.Now + " ] => [ Total Selected Members : " + totalSelectedItems + " ]");

                    IEnumerable <IEnumerable <KeyValuePair <string, string> > > partitioned = SlectedContacts.Partition(50);


                    foreach (var item in partitioned)
                    {
                        string FString     = string.Empty;
                        string Nstring     = string.Empty;
                        string connId      = string.Empty;
                        string FullName    = string.Empty;
                        string ContactName = string.Empty;

                        string pageSource = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/home?trk=hb_tab_home_top"));
                        if (pageSource.Contains("csrfToken"))
                        {
                            csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50);
                            string[] Arr = csrfToken.Split('&');
                            csrfToken = Arr[0];
                            csrfToken = csrfToken.Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty);
                            csrfToken = csrfToken.Trim();
                        }

                        if (pageSource.Contains("sourceAlias"))
                        {
                            sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                            string[] Arr = sourceAlias.Split('"');
                            sourceAlias = Arr[2];
                        }


                        try
                        {
                            foreach (KeyValuePair <string, string> itemChecked in item)
                            {
                                try
                                {
                                    string FName = string.Empty;
                                    string Lname = string.Empty;
                                    FullName = string.Empty;

                                    FName = itemChecked.Value.Split(' ')[0];
                                    Lname = itemChecked.Value.Split(' ')[1];

                                    FullName = FName + " " + Lname;
                                    try
                                    {
                                        ContactName = ContactName + "  :  " + FullName;

                                        if (ContactName.Contains("class="))
                                        {
                                            try
                                            {
                                                ContactName = ContactName.Substring(0, ContactName.IndexOf("class=")).Trim();
                                            }
                                            catch (Exception ex)
                                            {
                                            }
                                        }
                                    }
                                    catch { }
                                    Log("[ " + DateTime.Now + " ] => [ Adding Contact : " + FullName + " ]");

                                    string        ToCd         = itemChecked.Key;
                                    List <string> AddAllString = new List <string>();

                                    if (FString == string.Empty)
                                    {
                                        string CompString = "{" + "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                        FString = CompString;
                                    }
                                    else
                                    {
                                        string CompString = "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                        FString = CompString;
                                    }

                                    if (Nstring == string.Empty)
                                    {
                                        Nstring = FString;
                                        connId  = ToCd;
                                    }
                                    else
                                    {
                                        Nstring += "," + FString;
                                        connId  += " " + ToCd;
                                    }
                                }
                                catch { }
                            }
                            Nstring += "}";

                            try
                            {
                                string PostMessage;
                                string ResponseStatusMsg;
                                Log("[ " + DateTime.Now + " ] => [ Message Sending Process Running.. ]");
                                PostMessage       = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(body.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeints&fromName=" + FromEmailNam + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=" + Uri.EscapeUriString(Nstring) + "&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&goback=.smg_*1_*1_*1_*1_*1_*1_*1_*1_*1";
                                ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/msgToConns"), PostMessage);


                                if (ResponseStatusMsg.Contains("Your message was successfully sent."))
                                {
                                    Log("[ " + DateTime.Now + " ] => [ Subject Posted : " + msg + " ]");
                                    Log("[ " + DateTime.Now + " ] => [ Body Text Posted : " + body.ToString() + " ]");
                                    Log("[ " + DateTime.Now + " ] => [ Message Posted To  Accounts : " + item.Count() + " ] ");
                                    ReturnString = "Your message was successfully.";

                                    #region CSV
                                    string bdy = string.Empty;
                                    try
                                    {
                                        bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                    }
                                    catch { }
                                    if (string.IsNullOrEmpty(bdy))
                                    {
                                        bdy = body.ToString().Replace(",", ":");
                                    }
                                    string CSVHeader   = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                    string CSV_Content = UserName + "," + msg + "," + bdy.ToString() + "," + ContactName;
                                    CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageSentGroupMember);

                                    #endregion

                                    //GlobusFileHelper.AppendStringToTextfileNewLine("Subject Posted : " + textMsg.Text.ToString(), Globals.path_MessageGroupMember);
                                    //GlobusFileHelper.AppendStringToTextfileNewLine("Body Text Posted : " + txtBody.Text.ToString(), Globals.path_MessageGroupMember);
                                    //GlobusFileHelper.AppendStringToTextfileNewLine("Message Posted To All Selected Accounts", Globals.path_MessageGroupMember);
                                }
                                else if (ResponseStatusMsg.Contains("There was an unexpected problem that prevented us from completing your request.") || ResponseStatusMsg.Contains("You are no longer authorized to message this"))
                                {
                                    //Log("Error In Message Posting");
                                    Log("[ " + DateTime.Now + " ] => [ There was an unexpected problem that prevented us from completing your request ]");
                                    //string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                    //string CSV_Content = UserName + "," + msg + "," + body.ToString() + "," + ContactName;
                                    //CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_MessageSentGroupMember);

                                    GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", Globals.path_MessageGroupMember);
                                }
                            }
                            catch (Exception ex)
                            {
                                //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");

                                GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember);
                            }

                            int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                            Log("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                            Thread.Sleep(delay * 1000);
                        }
                        catch (Exception ex)
                        {
                            GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember);
                        }
                    }
                }
                catch (Exception ex)
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->  PostFinalMsgGroupMember() --> 1 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                    GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 1 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember);
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error -->  PostFinalMsgGroupMember() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
                GlobusFileHelper.AppendStringToTextfileNewLine("DateTime :- " + DateTime.Now + " :: Error --> PostFinalMsgGroupMember() --> 2 --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.path_MessageGroupMember);
            }
        }
コード例 #27
0
        public static void Scraper(ref FacebookUser fbUser, string Hash)
        {
            GlobusHttpHelper HttpHelper      = fbUser.globusHttpHelper;
            string           pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com"), "", "");


            string __user  = string.Empty;
            string fb_dtsg = string.Empty;
            string KeyWord = string.Empty;

            __user = GlobusHttpHelper.GetParamValue(pageSource_Home, "user");
            if (string.IsNullOrEmpty(__user))
            {
                __user = GlobusHttpHelper.ParseJson(pageSource_Home, "user");
            }


            fb_dtsg = GlobusHttpHelper.Get_fb_dtsg(pageSource_Home);



            string PostData     = "__user="******"&__a=1&__dyn=7nmanEyl2lm9o-t2u5bGya4Au74qbx2mbAKGiyEyut9LRwxBxem9V8CdwIhEyfyUnwPUS2O4K5e8GQ8GqcFoy8ACxtpm&__req=h&fb_dtsg=" + fb_dtsg + "&ttstamp=26581701181109510510483495368&__rev=1719057";
            string PostUrl      = "https://www.facebook.com/pubcontent/trending/see_more/?topic_ids[0]=105471716153186&topic_ids[1]=109659645720566&topic_ids[2]=108332329190557&position=3";
            string Pageresponce = HttpHelper.postFormData(new Uri(PostUrl), PostData);

            Pageresponce = Pageresponce.Replace("\\u003C", "<");


            string[] trendingArr = System.Text.RegularExpressions.Regex.Split(Pageresponce, "li data-topicid=");
            trendingArr = trendingArr.Skip(1).ToArray();
            foreach (var item_trendingArr in trendingArr)
            {
                string trendingId      = string.Empty;
                string trendingName    = string.Empty;
                string trendingLinkUrl = string.Empty;
                try
                {
                    try
                    {
                        trendingId = Utils.getBetween(item_trendingArr, "\\\"", "\\\"");
                    }
                    catch { }
                    try
                    {
                        trendingName = Utils.getBetween(item_trendingArr, "_5v0s _5my8\\\">", "<");
                    }
                    catch { };

                    string LinkUrl = Utils.getBetween(item_trendingArr, "_4qzh _5v0t _7ge\\\" href=\\\"", "\" id=").Replace("\\", string.Empty).Replace("amp;", string.Empty);
                    if (!LinkUrl.Contains("www.facebook.com/"))
                    {
                        trendingLinkUrl = "https://www.facebook.com" + LinkUrl;
                    }
                    else
                    {
                        trendingLinkUrl = LinkUrl;
                    }

                    if (trendingName.Contains(KeyWord))
                    {
                        string FindPageSource = string.Empty;


                        FindPageSource = HttpHelper.getHtmlfromUrl(new Uri(trendingLinkUrl));

                        string postID           = string.Empty;
                        string postName         = string.Empty;
                        string postImage        = string.Empty;
                        string postDescriptions = string.Empty;
                        string posttitle        = string.Empty;

                        string[] ContentArr = System.Text.RegularExpressions.Regex.Split(FindPageSource, "userContentWrapper _5pcr _3ccb");
                        ContentArr = ContentArr.Skip(1).ToArray();
                        foreach (var ContentArr_item in ContentArr)
                        {
                            try
                            {
                                postName = trendingName;
                                postID   = trendingId;
                                // class="_4-eo _2t9n"
                                postImage = Utils.getBetween(ContentArr_item, "scaledImageFitWidth img\" src=\"", "alt=").Replace("amp;", string.Empty).Replace("\"", string.Empty);
                            }
                            catch (Exception)
                            {
                            }
                            string   profileName  = posttitle;                                                                                                                                //2
                            string   Message      = Utils.getBetween(ContentArr_item, "<p>", "<").Replace("&#064;", "@").Replace("&amp;", "&").Replace("u0025", "%").Replace("&#039;", "'");; //7
                            string[] DetailedInfo = System.Text.RegularExpressions.Regex.Split(ContentArr_item, "<div class=\"_6m7\">");
                            string   detail       = "-" + DetailedInfo[1];                                                                                                                    //8
                            detail = Utils.getBetween(detail, "-", "</div>").Replace("&amp;", "&").Replace("u0025", "%").Replace("&#039;", "'");

                            if (detail.Contains("<a "))
                            {
                                string GetVisitUrl = Utils.getBetween(detail, "\">", "</a>");

                                detail = Utils.getBetween("$$$####" + detail, "$$$####", "<a href=") + "-" + GetVisitUrl;
                            }

                            string[] ArrDetail = System.Text.RegularExpressions.Regex.Split(ContentArr_item, "<div class=\"mbs _6m6\">");

                            string Titles             = Utils.getBetween(ArrDetail[1], ">", "</a>").Replace("&#064;", "@").Replace("&amp;", "&").Replace("u0025", "%").Replace("&#039;", "'");
                            string SiteRedirectionUrl = Utils.getBetween(ArrDetail[1], "LinkshimAsyncLink.swap(this, &quot;", ");");
                            SiteRedirectionUrl = Uri.UnescapeDataString(SiteRedirectionUrl).Replace("\\u0025", "%").Replace("\\", "");//4
                            string websiteUrl = Utils.getBetween(SiteRedirectionUrl, "//", "/");

                            string[] adImg          = System.Text.RegularExpressions.Regex.Split(ContentArr_item, "<img class=\"scaledImageFitWidth img\"");
                            string   redirectionImg = Utils.getBetween(adImg[1], "src=\"", "\"").Replace("&amp;", "&");

                            string[] profImg    = System.Text.RegularExpressions.Regex.Split(ContentArr_item, "<img class=\"_s0 5xib 5sq7 _rw img\"");
                            string   profileImg = Utils.getBetween(profImg[0], "src=\"", "\"").Replace("&amp;", "&");
                        }
                    }
                }
                catch { };
            }
        }
コード例 #28
0
        public void PostFinalMsgGroupMember_1By1(ref GlobusHttpHelper HttpHelper, Dictionary<string, string> SlectedContacts, List<string> GrpMemSubjectlist, List<string> GrpMemMessagelist, string msg, string body, string UserName, string FromemailId, string FromEmailNam, string SelectedGrpName, string grpId, bool mesg_with_tag, bool msg_spintaxt, int mindelay, int maxdelay, bool preventMsgSameGroup, bool preventMsgWithoutGroup, bool preventMsgGlobal)
        {
            try
            {
               // MsgGroupMemDbManager objMsgGroupMemDbMgr = new MsgGroupMemDbManager();

                string postdata = string.Empty;
                string postUrl = string.Empty;
                string ResLogin = string.Empty;
                string csrfToken = string.Empty;
                string sourceAlias = string.Empty;
                string ReturnString = string.Empty;
                string PostMsgSubject = string.Empty;
                string PostMsgBody = string.Empty;
                string FString = string.Empty;

                try
                {


                    string MessageText = string.Empty;
                    string PostedMessage = string.Empty;
                    string senderEmail = string.Empty;
                    string getComposeData = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/inbox/compose"));


                    if (!getComposeData.Contains("There was an error with the file upload. Please try again later."))
                    {
                        #region MyRegion
                        try
                        {
                            int startindex = getComposeData.IndexOf("\"senderEmail\" value=\"");
                            if (startindex < 0)
                            {
                                startindex = getComposeData.IndexOf("\"senderEmail\",\"value\":\"");
                            }
                            string start = getComposeData.Substring(startindex).Replace("\"senderEmail\" value=\"", string.Empty).Replace("\"senderEmail\",\"value\":\"", string.Empty);
                            int endindex = start.IndexOf("\"/>");
                            if (endindex < 0)
                            {
                                endindex = start.IndexOf("\",\"");
                            }
                            string end = start.Substring(0, endindex).Replace("\"/>", string.Empty).Replace("\",\"", string.Empty);
                            senderEmail = end.Trim();
                        }
                        catch (Exception ex)
                        {
                            senderEmail = Utils.getBetween(getComposeData, "<", ">");
                        }
                        string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/home?trk=hb_tab_home_top"));
                        if (pageSource.Contains("csrfToken"))
                        {
                            try
                            {
                                csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50);
                                string[] Arr = csrfToken.Split('<');
                                csrfToken = Arr[0];
                                csrfToken = csrfToken.Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("<script typ", string.Empty);
                                csrfToken = csrfToken.Trim();
                            }
                            catch (Exception ex)
                            {

                            }

                        }

                        if (pageSource.Contains("sourceAlias"))
                        {
                            try
                            {
                                sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                                string[] Arr = sourceAlias.Split('"');
                                sourceAlias = Arr[2];
                            }
                            catch (Exception ex)
                            {

                            }
                        }

                        if (pageSource.Contains("goback="))
                        {
                            try
                            {
                            }
                            catch (Exception ex)
                            {

                            }
                        }

                        foreach (KeyValuePair<string, string> itemChecked in SlectedContacts)
                        {
                            try
                            {
                                DataSet ds = new DataSet();
                                DataSet ds_bList = new DataSet();
                                string ContactName = string.Empty;
                                string Nstring = string.Empty;
                                string connId = string.Empty;
                                string FName = string.Empty;
                                string Lname = string.Empty;
                                string tempBody = string.Empty;
                                string tempsubject = string.Empty;
                                string n_ame1 = string.Empty;

                                //grpId = itemChecked.Key.ToString();

                                try
                                {
                                    // FName = itemChecked.Value.Split(' ')[0];
                                    // Lname = itemChecked.Value.Split(' ')[1];
                                    try
                                    {
                                        n_ame1 = itemChecked.Value.Split(']')[1].Trim(); ;
                                    }
                                    catch
                                    { }
                                    if (string.IsNullOrEmpty(n_ame1))
                                    {
                                        try
                                        {
                                            n_ame1 = itemChecked.Value;
                                        }
                                        catch
                                        { }
                                    }
                                    string[] n_ame = Regex.Split(n_ame1, " ");
                                    FName = " " + n_ame[0];
                                    Lname = n_ame[1];

                                    if (!string.IsNullOrEmpty(n_ame[2]))
                                    {
                                        Lname = Lname + n_ame[2];
                                    }
                                    if (!string.IsNullOrEmpty(n_ame[3]))
                                    {
                                        Lname = Lname + n_ame[3];
                                    }
                                    if (!string.IsNullOrEmpty(n_ame[4]))
                                    {
                                        Lname = Lname + n_ame[4];
                                    }
                                    if (!string.IsNullOrEmpty(n_ame[5]))
                                    {
                                        Lname = Lname + n_ame[5];
                                    }
                                }
                                catch (Exception ex)
                                {
                                }

                                try
                                {
                                    ContactName = FName + " " + Lname;
                                    ContactName = ContactName.Replace("%20", " ");
                                }
                                catch { }

                                
                                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Adding Contact : " + ContactName + " ]");

                                string ToCd = itemChecked.Key;
                                List<string> AddAllString = new List<string>();

                                if (FString == string.Empty)
                                {
                                    string CompString = "{" + "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                    FString = CompString;
                                }
                                else
                                {
                                    string CompString = "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                    FString = CompString;
                                }

                                if (Nstring == string.Empty)
                                {
                                    Nstring = FString;
                                    connId = ToCd;
                                }
                                else
                                {
                                    Nstring += "," + FString;
                                    connId += " " + ToCd;
                                }

                                Nstring += "}";
                                tempsubject = msg;
                                try
                                {
                                    string PostMessage = string.Empty;
                                    string ResponseStatusMsg = string.Empty;

                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Sending Process Running.. ]");
                                    if (mesg_with_tag == true)
                                    {
                                        tempsubject = msg;
                                    }
                                    if (msg_spintaxt == true)
                                    {
                                        try
                                        {
                                            msg = GrpMemSubjectlist[RandomNumberGenerator.GenerateRandom(0, GrpMemSubjectlist.Count - 1)];
                                            body = GrpMemMessagelist[RandomNumberGenerator.GenerateRandom(0, GrpMemMessagelist.Count - 1)];
                                        }
                                        catch
                                        {
                                        }
                                    }

                                    if (mesg_with_tag == true)
                                    {
                                        if (string.IsNullOrEmpty(FName))
                                        {
                                            tempBody = body.Replace("<Insert Name>", ContactName);
                                        }
                                        else
                                        {
                                          //  tempBody = GlobusSpinHelper.spinLargeText(new Random(), body);

                                           // if (lstSubjectReuse.Count == GrpMemSubjectlist.Count)
                                           // {
                                          //      lstSubjectReuse.Clear();
                                           // }
                                            //foreach (var itemSubject in GrpMemSubjectlist)
                                            //{
                                            //    if (string.IsNullOrEmpty(TemporarySubject))
                                            //    {
                                            //        TemporarySubject = itemSubject;
                                            //        tempsubject = itemSubject;
                                            //        lstSubjectReuse.Add(itemSubject);
                                            //        break;
                                            //    }
                                            //    else if (!lstSubjectReuse.Contains(itemSubject))
                                            //    {
                                            //        TemporarySubject = itemSubject;
                                            //        tempsubject = itemSubject;
                                            //        lstSubjectReuse.Add(itemSubject);
                                            //        break;
                                            //    }
                                            //    else
                                            //    {
                                            //        continue;
                                            //    }
                                            //}

                                            tempBody = tempBody.Replace("<Insert Name>", FName);

                                            tempsubject = tempsubject.Replace("<Insert Name>", FName);
                                        }
                                    }
                                    else
                                    {
                                        if (string.IsNullOrEmpty(FName))
                                        {
                                            tempBody = body.Replace("<Insert Name>", ContactName);
                                        }
                                        else
                                        {
                                            tempBody = body.Replace("<Insert Name>", FName);
                                        }
                                    }

                                    if (SelectedGrpName.Contains(":"))
                                    {
                                        try
                                        {
                                            string[] arrSelectedGrpName = Regex.Split(SelectedGrpName, ":");
                                            if (arrSelectedGrpName.Length > 1)
                                            {
                                                SelectedGrpName = arrSelectedGrpName[1];
                                            }
                                        }
                                        catch (Exception ex)
                                        {

                                        }
                                    }




                                    if (mesg_with_tag == true)
                                    {
                                        tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName);
                                        tempBody = tempBody.Replace("<Insert From Email>", FromEmailNam);
                                        tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);
                                    }
                                    else
                                    {
                                        tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName);
                                        tempBody = tempBody.Replace("<Insert From Email>", FromEmailNam);
                                        tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);
                                    }

                                    //Check BlackListed Accounts
                                    try
                                    {
                                        string Querystring = "Select ProfileID From tb_BlackListAccount Where ProfileID ='" + itemChecked.Key + "'";
                                        ds_bList = DataBaseHandler.SelectQuery(Querystring, "tb_BlackListAccount");
                                    }
                                    catch { }


                                    if (preventMsgSameGroup)
                                    {
                                        try
                                        {
                                            string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgGroupId = " + grpId + " and MsgToId = " + connId + "";
                                            ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                        }
                                        catch { }
                                    }

                                    if (preventMsgWithoutGroup)
                                    {
                                        try
                                        {
                                            string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgToId = " + connId + "";
                                            ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                        }
                                        catch { }
                                    }
                                    if (preventMsgGlobal)
                                    {
                                        try
                                        {
                                            string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgToId = " + connId + "";
                                            ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                        }
                                        catch { }
                                    }

                                    try
                                    {

                                        if (ds.Tables.Count > 0)
                                        {
                                            if (ds.Tables[0].Rows.Count > 0)
                                            {

                                                PostMessage = "";
                                                ResponseStatusMsg = "Already Sent";

                                            }
                                            else
                                            {
                                                if (ds_bList.Tables.Count > 0 && ds_bList.Tables[0].Rows.Count > 0)
                                                {
                                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]");
                                                    ResponseStatusMsg = "BlackListed";
                                                }
                                                else
                                                {

                                                    try
                                                    {
                                                        string Url_compose = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                                        string Responce = HttpHelper.getHtmlfromUrl(new Uri(Url_compose));
                                                        {

                                                            string PostUrlsssss = "https://www.linkedin.com/inbox/mailbox/message/send";


                                                            string PostDataFinal1 = "senderEmail=645883950&ccInput=&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Envoyer";
                                                            ResponseStatusMsg = HttpHelper.postFormData(new Uri(PostUrlsssss), PostDataFinal1);
                                                        }


                                                    }
                                                    catch (Exception ex)
                                                    {
                                                    }
                                                    if (ResponseStatusMsg.Contains("upload_error") && ResponseStatusMsg.Contains("There was an error with the file upload. Please try again later"))
                                                    {
                                                        PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                        ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                                    }


                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (ds_bList.Tables.Count > 0)
                                            {
                                                if (ds_bList.Tables[0].Rows.Count > 0)
                                                {

                                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]");
                                                    ResponseStatusMsg = "BlackListed";
                                                }
                                                else
                                                {
                                                    try
                                                    {
                                                        string Url_compose = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                                        string Responce = HttpHelper.getHtmlfromUrl(new Uri(Url_compose));
                                                        {

                                                            string PostUrlsssss = "https://www.linkedin.com/inbox/mailbox/message/send";


                                                            string PostDataFinal1 = "senderEmail=645883950&ccInput=&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Envoyer";
                                                            ResponseStatusMsg = HttpHelper.postFormData(new Uri(PostUrlsssss), PostDataFinal1);
                                                        }


                                                    }
                                                    catch (Exception ex)
                                                    {
                                                    }
                                                    if (ResponseStatusMsg.Contains("upload_error") && ResponseStatusMsg.Contains("There was an error with the file upload. Please try again later"))
                                                    {
                                                        PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                        ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                                    }


                                                    //  PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                    // ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                                }
                                            }
                                        }
                                    }
                                    catch (Exception)
                                    {
                                        // if (ResponseStatusMsg.Contains("upload_error") && ResponseStatusMsg.Contains("There was an error with the file upload. Please try again later"))
                                        {
                                            PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                            ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                        }

                                        //PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeintsfromName=" + Uri.EscapeDataString(FromEmailNam) + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                        //ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage);
                                    }

                                    if ((!ResponseStatusMsg.Contains("Your message was successfully sent.") && !ResponseStatusMsg.Contains("Already Sent")) && (!ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") && !ResponseStatusMsg.Contains("Ya ha sido enviada") && !ResponseStatusMsg.Contains("Uw bericht is verzonden")))
                                    {

                                        if (ResponseStatusMsg.Contains("Already Sent") || (ResponseStatusMsg.Contains("Ya ha sido enviada") || (ResponseStatusMsg.Contains("BlackListed"))))
                                        {
                                            continue;
                                        }

                                        try
                                        {
                                            pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/groups?viewMembers=&gid=" + grpId));

                                            if (pageSource.Contains("contentType="))
                                            {
                                                try
                                                {
                                                    string Url_compose = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                                    string Responce = HttpHelper.getHtmlfromUrl(new Uri(Url_compose));
                                                    {

                                                        string PostUrlsssss = "https://www.linkedin.com/inbox/mailbox/message/send";


                                                        string PostDataFinal1 = "senderEmail=645883950&ccInput=&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Envoyer";
                                                        ResponseStatusMsg = HttpHelper.postFormData(new Uri(PostUrlsssss), PostDataFinal1);
                                                    }
                                                    if (ResponseStatusMsg.Contains("upload_error") && ResponseStatusMsg.Contains("There was an error with the file upload. Please try again later"))
                                                    {
                                                        PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                        ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                                    }


                                                }
                                                catch (Exception ex)
                                                {
                                                }

                                                //try
                                                //{
                                                //    string contentType = pageSource.Substring(pageSource.IndexOf("contentType="), pageSource.IndexOf("&", pageSource.IndexOf("contentType=")) - pageSource.IndexOf("contentType=")).Replace("contentType=", string.Empty).Replace("contentType=", string.Empty).Trim();

                                                //    string pageSource2 = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/groupMsg?displayCreate=&contentType=" + contentType + "&connId=" + connId + "&groupID=" + grpId + ""));

                                                //    //  PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeints&fromName=" + FromEmailNam + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=" + Uri.EscapeUriString(Nstring) + "&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=" + contentType + "&groupID=" + grpId + "";

                                                //    string postData_Message_posting = "senderEmail=914640570&ccInput=&subject=hi&body=hello&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=313092875&recipientNames=%5B%7B%22memberId%22%3A313092875%2C%22fullName%22%3A%22SibghatUllah+K.+Khan%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Send+Message";
                                                //    string postUrlll = "https://www.linkedin.com/inbox/mailbox/message/send";
                                                //    ResponseStatusMsg = HttpHelper.postFormData(new Uri(postUrlll), postData_Message_posting);
                                                //}
                                                //catch (Exception ex)
                                                //{
                                                //}
                                            }


                                            // ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                        }
                                        catch (Exception ex)
                                        {

                                        }
                                    }

                                    if ((ResponseStatusMsg.Contains("Your message was successfully sent.")) || (ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") || (ResponseStatusMsg.Contains("Uw bericht is verzonden"))))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Subject Posted : " + tempsubject + " ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Body Text Posted : " + tempBody.ToString() + " ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Posted To Account: " + ContactName + " ]");
                                        ReturnString = "Your message was successfully sent.";

                                        #region CSV
                                        string bdy = string.Empty;
                                        try
                                        {
                                            bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                        }
                                        catch { }
                                        if (string.IsNullOrEmpty(bdy))
                                        {
                                            bdy = tempBody.ToString().Replace(",", ":");
                                        }
                                        string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                        string CSV_Content = UserName + "," + tempsubject + "," + bdy.ToString() + "," + ContactName;
                                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, FilePath.path_MessageSentGroupMember);

                                        try
                                        {
                                            InsertMsgGroupMemData(UserName, Convert.ToInt32(connId), ContactName, Convert.ToInt32(grpId), SelectedGrpName, msg, tempBody);
                                        }
                                        catch { }

                                        #endregion

                                    }
                                    else if (ResponseStatusMsg.Contains("There was an unexpected problem that prevented us from completing your request"))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ There was an unexpected problem that prevented us from completing your request ! ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", FilePath.path_MessageGroupMember);
                                    }
                                    else if (ResponseStatusMsg.Contains("You are no longer authorized to message this"))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ You are no longer authorized to message this ! ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", FilePath.path_MessageGroupMember);
                                    }
                                    else if ((ResponseStatusMsg.Contains("Already Sent")) || (ResponseStatusMsg.Contains("Ya ha sido enviada")))
                                    {
                                        string bdy = string.Empty;
                                        try
                                        {
                                            bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                        }
                                        catch { }
                                        if (string.IsNullOrEmpty(bdy))
                                        {
                                            bdy = tempBody.ToString().Replace(",", ":");
                                        }
                                        string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                        string CSV_Content = UserName + "," + msg + "," + bdy.ToString() + "," + ContactName;
                                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, FilePath.path_MessageAlreadySentGroupMember);

                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Not Posted To Account: " + ContactName + " because it has sent the same message]");
                                    }
                                    else if ((ResponseStatusMsg.Contains("Votre message a bien")) || ResponseStatusMsg.Contains("class=\"alert success") || (ResponseStatusMsg.Contains("Ya ha sido enviada")))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Subject Posted : " + tempsubject + " ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Body Text Posted : " + tempBody.ToString() + " ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Posted To Account: " + ContactName + " ]");
                                        ReturnString = "Your message was successfully sent.";


                                        string bdy = string.Empty;
                                        try
                                        {
                                            bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                        }
                                        catch { }
                                        if (string.IsNullOrEmpty(bdy))
                                        {
                                            bdy = tempBody.ToString().Replace(",", ":");
                                        }
                                        string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                        string CSV_Content = UserName + "," + tempsubject + "," + bdy.ToString() + "," + ContactName;
                                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, FilePath.path_MessageSentGroupMember);

                                        try
                                        {
                                            InsertMsgGroupMemData(UserName, Convert.ToInt32(connId), ContactName, Convert.ToInt32(grpId), SelectedGrpName, msg, tempBody);
                                        }
                                        catch { }
                                    }
                                    else
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Error In Message Posting ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", FilePath.path_MessageGroupMember);
                                    }

                                    int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                                    Thread.Sleep(delay * 1000);

                                }
                                catch (Exception ex)
                                {
                                    //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, FilePath.path_MessageGroupMember);
                                }
                            }
                            catch (Exception ex)
                            {
                                //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace);
                                GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, FilePath.path_MessageGroupMember);
                            }
                        }
                        #endregion
                    }
                    else
                    {

                        try
                        {
                            int startindex = getComposeData.IndexOf("\"senderEmail\" value=\"");
                            if (startindex < 0)
                            {
                                startindex = getComposeData.IndexOf("\"senderEmail\",\"value\":\"");
                            }
                            string start = getComposeData.Substring(startindex).Replace("\"senderEmail\" value=\"", string.Empty).Replace("\"senderEmail\",\"value\":\"", string.Empty);
                            int endindex = start.IndexOf("\"/>");
                            if (endindex < 0)
                            {
                                endindex = start.IndexOf("\",\"");
                            }
                            string end = start.Substring(0, endindex).Replace("\"/>", string.Empty).Replace("\",\"", string.Empty);
                            senderEmail = end.Trim();
                        }
                        catch (Exception ex)
                        {
                            senderEmail = Utils.getBetween(getComposeData, "<", ">");
                        }





                        string pageSource = HttpHelper.getHtmlfromUrl(new Uri("https://www.linkedin.com/home?trk=hb_tab_home_top"));
                        if (pageSource.Contains("csrfToken"))
                        {
                            try
                            {
                                csrfToken = pageSource.Substring(pageSource.IndexOf("csrfToken"), 50);
                                string[] Arr = csrfToken.Split('<');
                                csrfToken = Arr[0];
                                csrfToken = csrfToken.Replace("csrfToken", "").Replace("\"", string.Empty).Replace("value", string.Empty).Replace("cs", string.Empty).Replace("id", string.Empty).Replace("=", string.Empty).Replace("\n", string.Empty).Replace(">", string.Empty).Replace("<script typ", string.Empty);
                                csrfToken = csrfToken.Trim();
                            }
                            catch (Exception ex)
                            {

                            }

                        }

                        if (pageSource.Contains("sourceAlias"))
                        {
                            try
                            {
                                sourceAlias = pageSource.Substring(pageSource.IndexOf("sourceAlias"), 100);
                                string[] Arr = sourceAlias.Split('"');
                                sourceAlias = Arr[2];
                            }
                            catch (Exception ex)
                            {

                            }
                        }

                        if (pageSource.Contains("goback="))
                        {
                            try
                            {
                            }
                            catch (Exception ex)
                            {

                            }
                        }

                        foreach (KeyValuePair<string, string> itemChecked in SlectedContacts)
                        {
                            try
                            {
                                DataSet ds = new DataSet();
                                DataSet ds_bList = new DataSet();
                                string ContactName = string.Empty;
                                string Nstring = string.Empty;
                                string connId = string.Empty;
                                string FName = string.Empty;
                                string Lname = string.Empty;
                                string tempBody = string.Empty;
                                string tempsubject = string.Empty;
                                string n_ame1 = string.Empty;

                                //grpId = itemChecked.Key.ToString();



                                try
                                {
                                    // FName = itemChecked.Value.Split(' ')[0];
                                    // Lname = itemChecked.Value.Split(' ')[1];
                                    try
                                    {
                                        n_ame1 = itemChecked.Value.Split(']')[1].Trim(); ;
                                    }
                                    catch
                                    { }
                                    if (string.IsNullOrEmpty(n_ame1))
                                    {
                                        try
                                        {
                                            n_ame1 = itemChecked.Value;
                                        }
                                        catch
                                        { }
                                    }
                                    string[] n_ame = Regex.Split(n_ame1, " ");
                                    FName = " " + n_ame[0];
                                    Lname = n_ame[1];

                                    if (!string.IsNullOrEmpty(n_ame[2]))
                                    {
                                        Lname = Lname + n_ame[2];
                                    }
                                    if (!string.IsNullOrEmpty(n_ame[3]))
                                    {
                                        Lname = Lname + n_ame[3];
                                    }
                                    if (!string.IsNullOrEmpty(n_ame[4]))
                                    {
                                        Lname = Lname + n_ame[4];
                                    }
                                    if (!string.IsNullOrEmpty(n_ame[5]))
                                    {
                                        Lname = Lname + n_ame[5];
                                    }
                                }
                                catch (Exception ex)
                                {
                                }

                                try
                                {
                                    ContactName = FName + " " + Lname;
                                    ContactName = ContactName.Replace("%20", " ");
                                }
                                catch { }

                                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Adding Contact : " + ContactName + " ]");

                                string ToCd = itemChecked.Key;
                                List<string> AddAllString = new List<string>();

                                if (FString == string.Empty)
                                {
                                    string CompString = "{" + "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                    FString = CompString;
                                }
                                else
                                {
                                    string CompString = "\"" + "_" + ToCd.Trim() + "\"" + ":" + "{" + "\"" + "memberId" + "\"" + ":" + "\"" + ToCd.Trim() + "\"" + "," + "\"" + "firstName" + "\"" + ":" + "\"" + FName + "\"" + "," + "\"" + "lastName" + "\"" + ":" + "\"" + Lname + "\"" + "}";
                                    FString = CompString;
                                }

                                if (Nstring == string.Empty)
                                {
                                    Nstring = FString;
                                    connId = ToCd;
                                }
                                else
                                {
                                    Nstring += "," + FString;
                                    connId += " " + ToCd;
                                }

                                Nstring += "}";
                                tempsubject = msg;
                                string full_name = string.Empty;
                                try
                                {
                                    string PostMessage = string.Empty;
                                    string ResponseStatusMsg = string.Empty;

                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Sending Process Running.. ]");
                                    if (mesg_with_tag == true)
                                    {
                                        tempsubject = msg;
                                    }
                                    if (msg_spintaxt == true)
                                    {
                                        try
                                        {
                                            msg = GrpMemSubjectlist[RandomNumberGenerator.GenerateRandom(0, GrpMemSubjectlist.Count - 1)];
                                            body = GrpMemMessagelist[RandomNumberGenerator.GenerateRandom(0, GrpMemMessagelist.Count - 1)];
                                        }
                                        catch
                                        {
                                        }
                                    }

                                    if (mesg_with_tag == true)
                                    {
                                        if (string.IsNullOrEmpty(FName))
                                        {
                                            tempBody = body.Replace("<Insert Name>", ContactName);
                                        }
                                        else
                                        {
                                            //tempBody = GlobusSpinHelper.spinLargeText(new Random(), body);

                                            //if (lstSubjectReuse.Count == GrpMemSubjectlist.Count)
                                            //{
                                            //    lstSubjectReuse.Clear();
                                            //}
                                            //foreach (var itemSubject in GrpMemSubjectlist)
                                            //{
                                            //    if (string.IsNullOrEmpty(TemporarySubject))
                                            //    {
                                            //        TemporarySubject = itemSubject;
                                            //        tempsubject = itemSubject;
                                            //        lstSubjectReuse.Add(itemSubject);
                                            //        break;
                                            //    }
                                            //    else if (!lstSubjectReuse.Contains(itemSubject))
                                            //    {
                                            //        TemporarySubject = itemSubject;
                                            //        tempsubject = itemSubject;
                                            //        lstSubjectReuse.Add(itemSubject);
                                            //        break;
                                            //    }
                                            //    else
                                            //    {
                                            //        continue;
                                            //    }
                                            //}

                                            tempBody = tempBody.Replace("<Insert Name>", FName);

                                            tempsubject = tempsubject.Replace("<Insert Name>", FName);
                                        }
                                    }
                                    else
                                    {
                                        if (string.IsNullOrEmpty(FName))
                                        {
                                            tempBody = body.Replace("<Insert Name>", ContactName);
                                        }
                                        else
                                        {
                                            tempBody = body.Replace("<Insert Name>", FName);
                                        }
                                    }

                                    if (SelectedGrpName.Contains(":"))
                                    {
                                        try
                                        {
                                            string[] arrSelectedGrpName = Regex.Split(SelectedGrpName, ":");
                                            if (arrSelectedGrpName.Length > 1)
                                            {
                                                SelectedGrpName = arrSelectedGrpName[1];
                                            }
                                        }
                                        catch (Exception ex)
                                        {

                                        }
                                    }
                                    try
                                    {
                                        full_name = Utils.getBetween("####" + ContactName, "####", "(");
                                    }
                                    catch
                                    { }
                                    #region To insert Full Name

                                    if (mesg_with_tag == true)
                                    {
                                        try
                                        {
                                            if (tempsubject.Contains("<Insert Full Name>"))
                                            {
                                                tempsubject = tempsubject.Replace("<Insert Full Name>", full_name);
                                            }
                                            if (tempBody.Contains("<Insert Full Name>"))
                                            {
                                                tempBody = tempBody.Replace("<Insert Full Name>", full_name);
                                            }

                                        }
                                        catch { }

                                    }


                                    #endregion

                                    if (mesg_with_tag == true)
                                    {
                                        tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName);
                                        tempBody = tempBody.Replace("<Insert From Email>", senderEmail);
                                        tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);

                                        tempsubject = tempsubject.Replace("<Insert Group>", SelectedGrpName);
                                        tempsubject = tempsubject.Replace("<Insert From Email>", senderEmail);
                                        tempsubject = tempsubject.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);
                                    }
                                    else
                                    {
                                        tempBody = tempBody.Replace("<Insert Group>", SelectedGrpName);
                                        tempBody = tempBody.Replace("<Insert From Email>", FromEmailNam);
                                        tempBody = tempBody.Replace("<Insert Name>", string.Empty).Replace("<Insert Group>", string.Empty).Replace("<Insert From Email>", string.Empty);
                                    }

                                    //Check BlackListed Accounts
                                    try
                                    {
                                        string Querystring = "Select ProfileID From tb_BlackListAccount Where ProfileID ='" + itemChecked.Key + "'";
                                        ds_bList = DataBaseHandler.SelectQuery(Querystring, "tb_BlackListAccount");
                                    }
                                    catch { }


                                    if (preventMsgSameGroup)
                                    {
                                        try
                                        {
                                            string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgGroupId = " + grpId + " and MsgToId = " + connId + "";
                                            ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                        }
                                        catch { }
                                    }

                                    if (preventMsgWithoutGroup)
                                    {
                                        try
                                        {
                                            string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgFrom ='" + UserName + "' and MsgToId = " + connId + "";
                                            ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                        }
                                        catch { }
                                    }
                                    if (preventMsgGlobal)
                                    {
                                        try
                                        {
                                            string Querystring = "Select MsgFrom,MsgToId,MsgTo,MsgGroupId,MsgGroupName,MsgSubject,MsgBody From tb_ManageMsgGroupMem Where MsgToId = " + connId + "";
                                            ds = DataBaseHandler.SelectQuery(Querystring, "tb_ManageMsgGroupMem");
                                        }
                                        catch { }
                                    }

                                    try
                                    {

                                        if (ds.Tables.Count > 0)
                                        {
                                            if (ds.Tables[0].Rows.Count > 0)
                                            {

                                                PostMessage = "";
                                                ResponseStatusMsg = "Already Sent";

                                            }
                                            else
                                            {
                                                if (ds_bList.Tables.Count > 0 && ds_bList.Tables[0].Rows.Count > 0)
                                                {
                                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]");
                                                    ResponseStatusMsg = "BlackListed";
                                                }
                                                else
                                                {
                                                    #region send InMail
                                                    if (IssendInMail)
                                                    {
                                                        try
                                                        {
                                                            string csrfToken_inmail = string.Empty;
                                                            string Referer_InMail = string.Empty;
                                                            string authToken = string.Empty;

                                                            string url = "https://www.linkedin.com/premium/inmail/compose?destID=" + ToCd;
                                                            string responce_Inmail = HttpHelper.getHtmlfromUrl(new Uri(url));
                                                            if (!string.IsNullOrEmpty(responce_Inmail))
                                                            {
                                                                try
                                                                {
                                                                    csrfToken_inmail = Utils.getBetween(responce_Inmail, "csrfToken=", "\">");
                                                                }
                                                                catch { }
                                                            }

                                                            string subject_InMail = tempsubject.Replace(" ", "+");
                                                            string body_InMail = tempBody.Replace(" ", "+");
                                                            Referer_InMail = "https://www.linkedin.com/premium/inmail/compose?destID=" + ToCd;
                                                            string Action_url_InMail = "https://www.linkedin.com/premium/inmail/send?csrfToken=" + csrfToken_inmail;
                                                            // Referer_InMail = "https://www.linkedin.com/premium/inmail/compose?destID=" + ToCd + "&creationType=DC&authToken=" + authToken + "&authType=name&utm_source=Profile_inmail&utm_medium=onsite&utm_campaign=Subs";
                                                            string postData_InMail = "title=" + subject_InMail + "&document=" + body_InMail + "&destID=" + ToCd + "&creationType=DC&proposalType=" + category_to_send_inmail + "&authType=&authToken=";
                                                            ResponseStatusMsg = HttpHelper.postDataFormessagePosting(new Uri(Action_url_InMail), postData_InMail, Referer_InMail);


                                                        }
                                                        catch
                                                        { }



                                                    }
                                                    #endregion

                                                    #region direct message
                                                    else
                                                    {
                                                        try
                                                        {
                                                            string Url_compose = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                                            string Responce = HttpHelper.getHtmlfromUrl(new Uri(Url_compose));

                                                            string url = "https://www.linkedin.com/inbox/compose?connId=" + ToCd + "&groupId=" + grpId;
                                                            string emailSender = string.Empty;
                                                            string resp = HttpHelper.getHtmlfromUrl(new Uri(url));
                                                            try
                                                            {
                                                                emailSender = Utils.getBetween(resp, "senderEmail-composeForm", "recipientNames");
                                                                emailSender = Utils.getBetween(emailSender, "value\":\"", "\"}");
                                                                if (string.IsNullOrEmpty(emailSender))
                                                                {
                                                                    try
                                                                    {
                                                                        emailSender = Utils.getBetween(resp, "senderEmail", "selected\":true");
                                                                        emailSender = Utils.getBetween(emailSender, "\"value\":\"", "\",");
                                                                    }
                                                                    catch
                                                                    { }
                                                                }

                                                            }
                                                            catch
                                                            { }

                                                            try
                                                            {
                                                                ContactName = ContactName.Trim();
                                                                ContactName = Utils.getBetween("###" + ContactName, "###", "(");
                                                                ContactName = ContactName.Replace(" ", "+");
                                                            }
                                                            catch
                                                            { }

                                                            string postUrlFinal = "https://www.linkedin.com/inbox/mailbox/message/send";
                                                            string PostDataFinal = "senderEmail=" + emailSender + "&ccInput=&subject=" + tempsubject.Replace(" ", "+") + "&body=" + tempBody.Replace(" ", "+") + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Send+Message";


                                                            ResponseStatusMsg = HttpHelper.postFormData(new Uri(postUrlFinal), PostDataFinal);
                                                        }
                                                        catch
                                                        {
                                                        }
                                                    }
                                                    #endregion
                                                    if (!ResponseStatusMsg.Contains("Your message was successfully sent"))
                                                    {
                                                        //string Url_compose1 = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                                        //string Responce1 = HttpHelper.getHtmlfromUrl(new Uri(Url_compose1));

                                                        //string postUrlFinal1 = "https://www.linkedin.com/inbox/mailbox/message/send";
                                                        //string PostDataFinal1 = "senderEmail=914640570&ccInput=&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Send+Message";


                                                        //ResponseStatusMsg = HttpHelper.postFormData(new Uri(postUrlFinal1), PostDataFinal1);

                                                        //if (ResponseStatusMsg.Contains("upload_error") && ResponseStatusMsg.Contains("There was an error with the file upload. Please try again later"))
                                                        //{
                                                        //    PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                        //    ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                                        //}
                                                    }
                                                    //Comment By ajay 
                                                    //PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                    //ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (ds_bList.Tables.Count > 0)
                                            {
                                                if (ds_bList.Tables[0].Rows.Count > 0)
                                                {

                                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ User: "******" is Added BlackListed List For Send Messages Pls Check ]");
                                                    ResponseStatusMsg = "BlackListed";
                                                }
                                                else
                                                {

                                                    #region  wriiten by sharan

                                                    #region Send InMail
                                                    if (IssendInMail)
                                                    {
                                                        try
                                                        {
                                                            string csrfToken_inmail = string.Empty;
                                                            string Referer_InMail = string.Empty;
                                                            string authToken = string.Empty;

                                                            string url = "https://www.linkedin.com/premium/inmail/compose?destID=" + ToCd;
                                                            string responce_Inmail = HttpHelper.getHtmlfromUrl(new Uri(url));
                                                            if (!string.IsNullOrEmpty(responce_Inmail))
                                                            {
                                                                csrfToken_inmail = Utils.getBetween(responce_Inmail, "csrfToken=", "\">");
                                                                // Referer_InMail = Utils.getBetween(responce_Inmail, "X-FS-Origin-Request\":\"", "\"");



                                                            }

                                                            string subject_InMail = tempsubject.Replace(" ", "+");
                                                            string body_InMail = tempBody.Replace(" ", "+");
                                                            Referer_InMail = "https://www.linkedin.com/premium/inmail/compose?destID=" + ToCd;
                                                            string Action_url_InMail = "https://www.linkedin.com/premium/inmail/send?csrfToken=" + csrfToken_inmail;
                                                            // Referer_InMail = "https://www.linkedin.com/premium/inmail/compose?destID=" + ToCd + "&creationType=DC&authToken=" + authToken + "&authType=name&utm_source=Profile_inmail&utm_medium=onsite&utm_campaign=Subs";
                                                            string postData_InMail = "title=" + subject_InMail + "&document=" + body_InMail + "&destID=" + ToCd + "&creationType=DC&proposalType=" + category_to_send_inmail + "&authType=&authToken=";
                                                            ResponseStatusMsg = HttpHelper.postDataFormessagePosting(new Uri(Action_url_InMail), postData_InMail, Referer_InMail);


                                                        }
                                                        catch
                                                        { }


                                                    }
                                                    #endregion

                                                    #region directMessage
                                                    else
                                                    {
                                                        try
                                                        {
                                                            string Url_compose = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                                            string Responce = HttpHelper.getHtmlfromUrl(new Uri(Url_compose));

                                                            string url = "https://www.linkedin.com/inbox/compose?connId=" + ToCd + "&groupId=" + grpId;
                                                            string emailSender = string.Empty;
                                                            string resp = HttpHelper.getHtmlfromUrl(new Uri(url));
                                                            try
                                                            {
                                                                emailSender = Utils.getBetween(resp, "senderEmail-composeForm", "recipientNames");
                                                                emailSender = Utils.getBetween(emailSender, "value\":\"", "\"}");
                                                                if (string.IsNullOrEmpty(emailSender))
                                                                {
                                                                    try
                                                                    {
                                                                        emailSender = Utils.getBetween(resp, "senderEmail", "selected\":true");
                                                                        emailSender = Utils.getBetween(emailSender, "\"value\":\"", "\",");
                                                                    }
                                                                    catch
                                                                    { }
                                                                }
                                                            }
                                                            catch
                                                            { }

                                                            try
                                                            {
                                                                ContactName = ContactName.Trim();
                                                                ContactName = Utils.getBetween("###" + ContactName, "###", "(");
                                                                ContactName = ContactName.Replace(" ", "+");
                                                            }
                                                            catch
                                                            { }

                                                            string postUrlFinal = "https://www.linkedin.com/inbox/mailbox/message/send";
                                                            string PostDataFinal = "senderEmail=" + emailSender + "&ccInput=&subject=" + tempsubject.Replace(" ", "+") + "&body=" + tempBody.Replace(" ", "+") + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Send+Message";


                                                            ResponseStatusMsg = HttpHelper.postFormData(new Uri(postUrlFinal), PostDataFinal);
                                                        }
                                                        catch
                                                        {
                                                        }
                                                    }

                                                    #endregion

                                                    if (ResponseStatusMsg.Contains("Sorry, you have reached a limit for directly messaging group members"))
                                                    {
                                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Sorry, you have reached a limit for directly messaging group members]");
                                                        return;
                                                    }

                                                    if (!ResponseStatusMsg.Contains("Your message was successfully sent"))
                                                    {
                                                        try
                                                        {
                                                            //string action_url = "https://www.linkedin.com/premium/inmail/send?csrfToken=" + csrfToken;
                                                            //string referer = "https://www.linkedin.com/premium/inmail/compose?destID=" + ToCd + "&creationType=OPEN_LINK&authToken=mdaI&authType=name&utm_source=Profile_inmail&utm_medium=onsite&utm_campaign=Subs";
                                                            //string pd = "title=" + tempsubject.Replace(" ", "+") + "&document=" + tempBody.Replace(" ", "+") + "&destID=" + ToCd + "&creationType=OPEN_LINK&proposalType=JOB_OFFER&senderEmail=&authType=name&authToken=llYo";
                                                            //ResponseStatusMsg = HttpHelper.postDataFormessagePosting(new Uri(action_url), pd, referer);
                                                        }
                                                        catch
                                                        { }
                                                    }
                                                    #endregion


                                                    //string Url_compose = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                                    //string Responce = HttpHelper.getHtmlfromUrl(new Uri(Url_compose));

                                                    //string postUrlFinal = "https://www.linkedin.com/inbox/mailbox/message/send";
                                                    //string PostDataFinal = "senderEmail=913067065&ccInput=&subject=" + Uri.EscapeDataString(tempsubject) + "+&body=" + Uri.EscapeDataString(tempBody) + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName.Replace(" ", "+") + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Send+Message";

                                                    //ResponseStatusMsg = HttpHelper.postFormData(new Uri(postUrlFinal), PostDataFinal);

                                                    //if (ResponseStatusMsg.Contains("upload_error") && ResponseStatusMsg.Contains("There was an error with the file upload. Please try again later"))
                                                    //{
                                                    //    PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                                    //    ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                                    //}






                                                }
                                            }
                                        }
                                    }
                                    catch (Exception)
                                    {
                                        //PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(msg.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&showRecipeints=showRecipeintsfromName=" + Uri.EscapeDataString(FromEmailNam) + "&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                        //ResponseStatusMsg = HttpHelper.postFormData(new Uri("http://www.linkedin.com/groupMsg"), PostMessage);
                                    }
                                    #region commented for null response
                                    //if (string.IsNullOrEmpty(ResponseStatusMsg))
                                    //{
                                    //    try
                                    //    {
                                    //        string action_url = "https://www.linkedin.com/messaging/compose?connId="+ToCd+"&groupId="+grpId;
                                    //        string referer = "https://www.linkedin.com/grp/members?gid="+grpId;
                                    //        string get_response = HttpHelper.getHtmlfromUrl(new Uri(action_url));

                                    //        if (get_response.Contains("memberProfile"))
                                    //        {
                                    //            string all_details = Utils.getBetween(get_response, "<code id", "<script>");
                                    //            string[] arr = Regex.Split(all_details, "recipients");
                                    //            string recipient_details = string.Empty;
                                    //            string authToken = string.Empty;

                                    //            foreach (string item in arr)
                                    //            {
                                    //                if (item.Contains(ToCd))
                                    //                {
                                    //                    recipient_details = item;
                                    //                    break;
                                    //                }
                                    //            }

                                    //            authToken = Utils.getBetween(recipient_details, "authToken", "\"}");



                                    //            string s1 = Utils.getBetween("###" + authToken, "###", "profileId");
                                    //            string first_last_name = Utils.getBetween("###" + s1, "", "profileId");
                                    //            first_last_name = first_last_name + "profileId\":\"";


                                    //        }

                                    //    }
                                    //    catch
                                    //    { }
                                    //}
                                    #endregion

                                    #region commented by sharan after LI update

                                    //if ((!ResponseStatusMsg.Contains("Your message was successfully sent.") && !ResponseStatusMsg.Contains("Already Sent")) && (!ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") && !ResponseStatusMsg.Contains("Ya ha sido enviada") && !ResponseStatusMsg.Contains("Uw bericht is verzonden")))
                                    //{

                                    //    if (ResponseStatusMsg.Contains("Already Sent") || (ResponseStatusMsg.Contains("Ya ha sido enviada") || (ResponseStatusMsg.Contains("BlackListed"))))
                                    //    {
                                    //        continue;
                                    //    }

                                    //    try
                                    //    {
                                    //        pageSource = HttpHelper.getHtmlfromUrl1(new Uri("https://www.linkedin.com/groups?viewMembers=&gid=" + grpId));

                                    //        if (pageSource.Contains("contentType="))
                                    //        {
                                    //            try
                                    //            {
                                    //                string Url_compose = "https://www.linkedin.com/inbox/#compose?connId=" + ToCd + "&groupId=" + grpId;
                                    //                string Responce = HttpHelper.getHtmlfromUrl(new Uri(Url_compose));

                                    //                string postUrlFinal = "https://www.linkedin.com/inbox/mailbox/message/send";
                                    //                string PostDataFinal = "senderEmail=914640570&ccInput=&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&persist=true&showRecipients=showRecipients&isReply=&isForward=&itemId=&recipients=" + ToCd + "&recipientNames=%5B%7B%22memberId%22%3A" + ToCd + "%2C%22fullName%22%3A%22" + ContactName + "%22%7D%5D&groupId=" + grpId + "&csrfToken=" + csrfToken + "&sourceAlias=0_3mbGc9okCQbybxvc2A5Vz5&submit=Send+Message";


                                    //                ResponseStatusMsg = HttpHelper.postFormData(new Uri(postUrlFinal), PostDataFinal);

                                    //                if (ResponseStatusMsg.Contains("upload_error") && ResponseStatusMsg.Contains("There was an error with the file upload. Please try again later"))
                                    //                {
                                    //                    PostMessage = "csrfToken=" + csrfToken + "&subject=" + Uri.EscapeDataString(tempsubject.ToString()) + "&body=" + Uri.EscapeDataString(tempBody.ToString()) + "&submit=Send+Message&fromName=" + Uri.EscapeDataString(FromEmailNam) + "&showRecipeints=showRecipeints&fromEmail=" + FromemailId + "&connectionIds=" + connId + "&connectionNames=&allowEditRcpts=true&addMoreRcpts=false&openSocialAppBodySuffix=&st=&viewerDestinationUrl=&contentType=MEBC&groupID=" + grpId + "";
                                    //                    ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                    //                }

                                    //                #region MyRegion

                                    //                #endregion
                                    //            }
                                    //            catch (Exception ex)
                                    //            {
                                    //            }
                                    //        }


                                    //        ResponseStatusMsg = HttpHelper.postFormData(new Uri("https://www.linkedin.com/groupMsg"), PostMessage);
                                    //    }
                                    //    catch (Exception ex)
                                    //    {

                                    //    }
                                    //}

                                    #endregion

                                    if ((ResponseStatusMsg.Contains("Your message was successfully sent.")) || (ResponseStatusMsg.Contains("Se ha enviado tu mensaje satisfactoriamente") || (ResponseStatusMsg.Contains("Uw bericht is verzonden")) || ResponseStatusMsg.Contains("success")) || ResponseStatusMsg.Contains("inmCategory"))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Subject Posted : " + tempsubject + " ]");
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Body Text Posted : " + tempBody.ToString() + " ]");
                                        if (IssendInMail)
                                        {
                                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ InMail  Posted To Account: " + ContactName + " ]");
                                        }
                                        else
                                        {
                                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Posted To Account: " + ContactName + " ]");
                                        }

                                        ReturnString = "Your message was successfully sent.";

                                        #region CSV
                                        string bdy = string.Empty;
                                        try
                                        {
                                            bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                        }
                                        catch { }
                                        if (string.IsNullOrEmpty(bdy))
                                        {
                                            bdy = tempBody.ToString().Replace(",", ":");
                                        }
                                        string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                        string CSV_Content = UserName + "," + tempsubject + "," + bdy.ToString() + "," + ContactName;
                                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, FilePath.path_MessageSentGroupMember);

                                        try
                                        {
                                            InsertMsgGroupMemData(UserName, Convert.ToInt32(connId), ContactName, Convert.ToInt32(grpId), SelectedGrpName, msg, tempBody);
                                        }
                                        catch { }

                                        #endregion

                                    }
                                    else if (ResponseStatusMsg.Contains("There was an unexpected problem that prevented us from completing your request"))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ There was an unexpected problem that prevented us from completing your request ! ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", FilePath.path_MessageGroupMember);
                                    }
                                    else if (ResponseStatusMsg.Contains("You are no longer authorized to message this"))
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ You are no longer authorized to message this ! ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", FilePath.path_MessageGroupMember);
                                    }
                                    else if ((ResponseStatusMsg.Contains("Already Sent")) || (ResponseStatusMsg.Contains("Ya ha sido enviada")))
                                    {
                                        string bdy = string.Empty;
                                        try
                                        {
                                            bdy = body.ToString().Replace("\r", string.Empty).Replace("\n", " ").Replace(",", " ");
                                        }
                                        catch { }
                                        if (string.IsNullOrEmpty(bdy))
                                        {
                                            bdy = tempBody.ToString().Replace(",", ":");
                                        }
                                        string CSVHeader = "UserName" + "," + "Subject" + "," + "Body Text" + "," + "ContactName";
                                        string CSV_Content = UserName + "," + msg + "," + bdy.ToString() + "," + ContactName;
                                        CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, FilePath.path_MessageAlreadySentGroupMember);

                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message Not Posted To Account: " + ContactName + " because it has sent the same message]");
                                    }
                                    else
                                    {
                                        GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Error In Message Posting ]");
                                        GlobusFileHelper.AppendStringToTextfileNewLine("Error In Message Posting", FilePath.path_MessageGroupMember);
                                    }

                                    int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay for : " + delay + " Seconds ]");
                                    Thread.Sleep(delay * 1000);

                                }
                                catch (Exception ex)
                                {
                                    //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace + " ]");
                                    GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, FilePath.path_MessageGroupMember);
                                }
                            }
                            catch (Exception ex)
                            {
                                //Log("[ " + DateTime.Now + " ] => [ Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace);
                                GlobusFileHelper.AppendStringToTextfileNewLine(" Error:" + ex.Message + "StackTrace --> >>>" + ex.StackTrace, FilePath.path_MessageGroupMember);
                            }
                        }

                    }

                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Info("Exception ex : " + ex);
                }



            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Info("Exception : " + ex);
            }

        }
コード例 #29
0
        public void DM_SendMessage(ref InstagramUser Obj_DMessage)
        {
            try
            {
                lstThreadsDirectmessagePoster.Add(Thread.CurrentThread);
                lstThreadsDirectmessagePoster.Distinct();
                Thread.CurrentThread.IsBackground = true;
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
            string PPagesource  = string.Empty;
            string res_postdata = string.Empty;

            GlobusHttpHelper obj           = Obj_DMessage.globusHttpHelper;
            string           res_secondURL = obj.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGTestURL), "");

            try
            {
                foreach (string username in ClGlobul.DM_UserList)
                {
                    //foreach (string message in ClGlobul.DM_Messagelist)
                    //{
                    string message  = ClGlobul.DM_Messagelist[RandomNumberGenerator.GenerateRandom(0, ClGlobul.DM_Messagelist.Count)];
                    string Icon_url = IGGlobals.Instance.IGiconosquareAuthorizeurl;
                    PPagesource = obj.getHtmlfromUrl(new Uri(Icon_url), "");
                    string responce_icon  = obj.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGiconosquareviewUrl), "");
                    string responce1_icon = obj.getHtmlfromUrl(new Uri(IGGlobals.Instance.IGiconsquarecommentUrl), "");
                    if (!(PPagesource == ""))
                    {
                        string mesaagePageUrl  = IGGlobals.Instance.IGiconsquaremessageUrl;
                        string referer         = IGGlobals.Instance.IGiconosquareviewUrl;
                        string firstPagesource = obj.getHtmlfromUrl(new Uri(mesaagePageUrl), referer);

                        string messagePopupUrl  = IGGlobals.Instance.IGiconsquaremessagepostUrl;
                        string refererForPopup  = IGGlobals.Instance.IGiconsquaremessageUrl;
                        string secondPagesource = obj.getHtmlfromUrl(new Uri(messagePopupUrl), refererForPopup);

                        string finalPostData = "action=save-dm&username="******"&message=" + message;
                        string finalUrl      = IGGlobals.Instance.IGiconsquarecontrollerUrl;



                        string finalpagesource = obj.postFormData(new Uri(finalUrl), finalPostData, refererForPopup, "");

                        string checkmsg        = IGGlobals.Instance.IGiconsquaremesagecontactUrl;
                        string referercheckmsg = IGGlobals.Instance.IGiconsquaremessageUrl;

                        string finalcheckmsg = obj.getHtmlfromUrl(new Uri(checkmsg), referercheckmsg);

                        if (string.IsNullOrEmpty(finalpagesource))
                        {
                            DataBaseHandler.InsertQuery("insert into tbl_AccountReport(ModuleName,Account_User,DateTime UserName, Message,Status) values('" + "DirectMessage" + "','" + Obj_DMessage.username + "','" + DateTime.Now + "','" + username + "','" + message + "','" + status + "')", "tbl_AccountReport");
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Message send To : " + username + " ]");
                        }
                        else
                        {
                            GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ We Can't Send Message To This User]");
                        }
                    }
                    if (minDelayDirectmessagePoster != 0)
                    {
                        mindelay = minDelayDirectmessagePoster;
                    }
                    if (maxDelayDirectmessagePoster != 0)
                    {
                        maxdelay = maxDelayDirectmessagePoster;
                    }

                    int delay = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay);
                    GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Delay For " + delay + " Seconds For " + Obj_DMessage.username + " ]");
                    Thread.Sleep(delay * 1000);

                    //}
                }
                GlobusLogHelper.log.Info("[ " + DateTime.Now + " ] => [ Process Completed ]");
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
コード例 #30
0
        /// <summary>
        /// Makes Http Request to Confirmation URL from Mail, also requests other JS, CSS URLs
        /// </summary>
        /// <param name="ConfirmationUrl"></param>
        /// <param name="gif"></param>
        /// <param name="logpic"></param>
        public void EmailVerificationMultithreaded(string ConfirmationUrl, string gif, string logpic, string email, string password, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, ref GlobusHttpHelper HttpHelper)
        {
            int intProxyPort = 80;
            Regex IdCheck = new Regex("^[0-9]*$");

            if (!string.IsNullOrEmpty(proxyPort) && IdCheck.IsMatch(proxyPort))
            {
                intProxyPort = int.Parse(proxyPort);
            }

            string pgSrc_ConfirmationUrl = HttpHelper.getHtmlfromUrlProxy(new Uri(ConfirmationUrl), proxyAddress, intProxyPort, proxyUsername, proxyPassword);

            string valueLSD = "name=" + "\"lsd\"";
            string pgSrc_Login = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/login.php"));

            int startIndex = pgSrc_Login.IndexOf(valueLSD) + 18;
            string value = pgSrc_Login.Substring(startIndex, 5);

            //Log("Logging in with " + Username);

            string ResponseLogin = HttpHelper.postFormDataProxy(new Uri("https://www.facebook.com/login.php?login_attempt=1"), "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "&locale=en_US&email=" + email.Split('@')[0] + "%40" + email.Split('@')[1] + "&pass="******"&persistent=1&default_persistent=1&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=" + value + "", proxyAddress, intProxyPort, proxyUsername, proxyPassword);

            pgSrc_ConfirmationUrl = HttpHelper.getHtmlfromUrl(new Uri(ConfirmationUrl));

            try
            {
                string pgSrc_Gif = HttpHelper.getHtmlfromUrl(new Uri(gif));
            }
            catch { }
            try
            {
                string pgSrc_Logpic = HttpHelper.getHtmlfromUrl(new Uri(logpic + "&s=a"));
            }
            catch { }
            try
            {
                string pgSrc_Logpic = HttpHelper.getHtmlfromUrl(new Uri(logpic));
            }
            catch { }

            //** User Id ***************//////////////////////////////////
            string UsreId = string.Empty;
            if (string.IsNullOrEmpty(UsreId))
            {
                UsreId = GlobusHttpHelper.ParseJson(ResponseLogin, "user");
            }

            //*** Post Data **************//////////////////////////////////
            string fb_dtsg = GlobusHttpHelper.GetParamValue(ResponseLogin, "fb_dtsg");//pageSourceHome.Substring(pageSourceHome.IndexOf("fb_dtsg") + 16, 8);
            if (string.IsNullOrEmpty(fb_dtsg))
            {
                fb_dtsg = GlobusHttpHelper.ParseJson(ResponseLogin, "fb_dtsg");
            }

            string post_form_id = GlobusHttpHelper.GetParamValue(ResponseLogin, "post_form_id");//pageSourceHome.Substring(pageSourceHome.IndexOf("post_form_id"), 200);
            if (string.IsNullOrEmpty(post_form_id))
            {
                post_form_id = GlobusHttpHelper.ParseJson(ResponseLogin, "post_form_id");
            }

            string pgSrc_email_confirmed = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/?email_confirmed=1"));

            string pgSrc_contact_importer = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=contact_importer"));


            #region Skipping Code

            ///Code for skipping additional optional Page
            try
            {
                string phstamp = "165816812085115" + RandomNumberGenerator.GenerateRandom(10848130, 10999999);

                string postDataSkipFirstStep = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=friend_requests&next_step_name=contact_importer&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=" + phstamp;

                string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), postDataSkipFirstStep);
                Thread.Sleep(1000);
            }
            catch { }

            pgSrc_contact_importer = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted/?step=contact_importer"));


            //** FB Account Check email varified or not ***********************************************************************************//
            #region  FB Account Check email varified or not

            //string pageSrc1 = string.Empty;
            string pageSrc2 = string.Empty;
            string pageSrc3 = string.Empty;
            string pageSrc4 = string.Empty;
            string substr1 = string.Empty;

            //if (pgSrc_contact_importer.Contains("Are your friends already on Facebook?") && pgSrc_contact_importer.Contains("Skip this step"))
            if (true)
            {
                string phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954);

                string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=contact_importer&next_step_name=classmates_coworkers&previous_step_name=friend_requests&skip=Skip%20this%20step&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=" + phstamp + "";
                string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData);

                pgSrc_contact_importer = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=classmates_coworkers"));

                Thread.Sleep(1000);

                //pgSrc_contact_importer = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted/?step=classmates_coworkers"));
            }
            //if ((pgSrc_contact_importer.Contains("Fill out your Profile Info") || pgSrc_contact_importer.Contains("Fill out your Profile info")) && pgSrc_contact_importer.Contains("Skip"))
            if (true)
            {
                string phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954);

                string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer&current_pane=info&hs[school][id][0]=&hs[school][text][0]=&hs[start_year][text][0]=-1&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[start_year][text][0]=-1&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=" + phstamp + "";
                string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData);

                ///Post Data Parsing
                Dictionary<string, string> lstfriend_browser_id = new Dictionary<string, string>();

                string[] initFriendArray = Regex.Split(postRes, "FriendStatus.initFriend");

                int tempCount = 0;
                foreach (string item in initFriendArray)
                {
                    if (tempCount == 0)
                    {
                        tempCount++;
                        continue;
                    }
                    if (tempCount > 0)
                    {
                        int startIndx = item.IndexOf("(\\") + "(\\".Length + 1;
                        int endIndx = item.IndexOf("\\", startIndx);
                        string paramValue = item.Substring(startIndx, endIndx - startIndx);
                        lstfriend_browser_id.Add("friend_browser_id[" + (tempCount - 1) + "]=", paramValue);
                        tempCount++;
                    }
                }

                string partPostData = string.Empty;
                foreach (var item in lstfriend_browser_id)
                {
                    partPostData = partPostData + item.Key + item.Value + "&";
                }

                phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954);

                string newPostData1 = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer&current_pane=pymk&hs[school][id][0]=&hs[school][text][0]=&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&" + partPostData + "phstamp=" + phstamp + "";//"post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=classmates_coworkers&next_step_name=upload_profile_pic&previous_step_name=contact_importer&current_pane=pymk&friend_browser_id[0]=100002869910855&friend_browser_id[1]=100001857152486&friend_browser_id[2]=575678600&friend_browser_id[3]=100003506761599&friend_browser_id[4]=563402235&friend_browser_id[5]=1268675170&friend_browser_id[6]=1701838026&friend_browser_id[7]=623640106&friend_browser_id[8]=648873235&friend_browser_id[9]=100000151781814&friend_browser_id[10]=657007597&friend_browser_id[11]=1483373867&friend_browser_id[12]=778266161&friend_browser_id[13]=1087830021&friend_browser_id[14]=100001333876108&friend_browser_id[15]=100000534308531&friend_browser_id[16]=1213205246&friend_browser_id[17]=45608778&friend_browser_id[18]=100003080150820&friend_browser_id[19]=892195716&friend_browser_id[20]=100001238774509&friend_browser_id[21]=45602360&friend_browser_id[22]=100000054900916&friend_browser_id[23]=100001308090108&friend_browser_id[24]=100000400766182&friend_browser_id[25]=100001159247338&friend_browser_id[26]=1537081666&friend_browser_id[27]=100000743261988&friend_browser_id[28]=1029373920&friend_browser_id[29]=1077680976&friend_browser_id[30]=100000001266475&friend_browser_id[31]=504487658&friend_browser_id[32]=82600225&friend_browser_id[33]=1023509811&friend_browser_id[34]=100000128061486&friend_browser_id[35]=100001853125513&friend_browser_id[36]=576201748&friend_browser_id[37]=22806492&friend_browser_id[38]=100003232772830&friend_browser_id[39]=1447942875&friend_browser_id[40]=100000131241521&friend_browser_id[41]=100002076794734&friend_browser_id[42]=1397169487&friend_browser_id[43]=1457321074&friend_browser_id[44]=1170969536&friend_browser_id[45]=18903839&friend_browser_id[46]=695329369&friend_browser_id[47]=1265734280&friend_browser_id[48]=698096805&friend_browser_id[49]=777678515&friend_browser_id[50]=529685319&hs[school][id][0]=&hs[school][text][0]=&hs[year][text][0]=-1&hs[entry_id][0]=&college[entry_id][0]=&college[school][id][0]=0&college[school][text][0]=&college[year][text][0]=-1&college[type][0]=college&work[employer][id][0]=0&work[employer][text][0]=&work[entry_id][0]=&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user=100003556207009&phstamp=1658167541109987992266";
                string postRes1 = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData1);

                pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic"));

                Thread.Sleep(1000);

                //pageSrc2 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic"));

                string image_Get = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/images/wizard/nuxwizard_profile_picture.gif"));

                try
                {
                    phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954);
                    string newPostData2 = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step=upload_profile_pic&step_name=upload_profile_pic&previous_step_name=classmates_coworkers&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=" + phstamp + "";
                    string postRes2 = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData2);
                }
                catch { }
                try
                {
                    phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954);
                    string newPostData3 = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step=upload_profile_pic&step_name=upload_profile_pic&previous_step_name=classmates_coworkers&submit=Save%20%26%20Continue&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=" + phstamp + "";
                    string postRes3 = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData3);
                }
                catch { }

            }
            if (pageSrc2.Contains("Set your profile picture") && pageSrc2.Contains("Skip"))
            {
                string phstamp = "16581677684757" + RandomNumberGenerator.GenerateRandom(5104244, 9999954);
                string newPostData = "post_form_id=" + post_form_id + "&fb_dtsg=" + fb_dtsg + "&step_name=upload_profile_pic&previous_step_name=classmates_coworkers&skip=Skip&lsd&post_form_id_source=AsyncRequest&__user="******"&phstamp=" + phstamp + "";
                try
                {
                    string postRes = HttpHelper.postFormData(new Uri("http://www.facebook.com/ajax/growth/nux/wizard/steps.php?__a=1"), newPostData);

                    pageSrc3 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/gettingstarted.php?step=summary"));
                    pageSrc3 = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php?ref=wizard"));
                }
                catch { }

            }
            #endregion
            if (pageSrc3.Contains("complete the sign-up process"))
            {
            }
            if (pgSrc_contact_importer.Contains("complete the sign-up process"))
            {
            }
            #endregion

            ////**Post Message For User***********************/////////////////////////////////////////////////////

            try
            {

                string pageSourceHome = HttpHelper.getHtmlfromUrl(new Uri("http://www.facebook.com/home.php"));

                if (pageSourceHome.Contains("complete the sign-up process"))
                {
                    Console.WriteLine("Account is not verified for : " + email);
                }
                else
                {
                }
            }
            catch { }

            AddToListBox("Email verification completed for : " + email);
            //LoggerVerify("Email verification completed for : " + Email);
        }
コード例 #31
0
ファイル: frmMain_NewUI.cs プロジェクト: ahmetDostr/twtboard
        private void ThreadMethod_CheckEmails(object parameters)
        {
            try
            {
                Array paramsArray = new object[2];
                paramsArray = (Array)parameters;

                string Email = string.Empty;//"*****@*****.**";

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

                string emailData = (string)paramsArray.GetValue(0);
                string Proxy = (string)paramsArray.GetValue(1);

                Email = emailData.Split(':')[0];

                if (!string.IsNullOrEmpty(Proxy))
                {
                    try
                    {
                        string[] ProxyData = Proxy.Split(':');
                        if (ProxyData.Count() == 2)
                        {
                            proxyAddress = ProxyData[0];
                            proxyPort = ProxyData[1];
                        }
                        if (ProxyData.Count() == 4)
                        {
                            proxyAddress = ProxyData[0];
                            proxyPort = ProxyData[1];
                            proxyUsername = ProxyData[2];
                            proxyPassword = ProxyData[3];
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
                GlobusHttpHelper gHttpHelpr = new GlobusHttpHelper();

                string res_MainPage = gHttpHelpr.getHtmlfromUrlProxy(new Uri("https://twitter.com/account/resend_password"), "", proxyAddress, proxyPort, proxyUsername, proxyPassword);

                string postAuthenticityToken = TweetAccountManager.PostAuthenticityToken(res_MainPage, "postAuthenticityToken");

                string postData = "authenticity_token=" + postAuthenticityToken + "&email_or_phone=" + Uri.EscapeDataString(Email) + "&screen_name=";

                string postResponse = gHttpHelpr.postFormData(new Uri("https://twitter.com/account/resend_password"), postData, "", "", "", "", "");

                string responseURL = gHttpHelpr.gResponse.ResponseUri.AbsoluteUri;

                responseURL = responseURL.ToLower();

                //if (responseURL.Contains(DateTime.Now + " twitter.com/account/password_reset_sent ]"))
                if (responseURL.Contains("twitter.com/account/password_reset_sent"))
                {
                    //has account
                    GlobusFileHelper.AppendStringToTextfileNewLine(Email, Globals.path_DesktopFolder + "\\ExistingEmail_EmailChecker.txt");
                    AddToListAccountsLogs("[ " + DateTime.Now + " ] => [ Existing Email : " + Email + " ]");
                }
                else if (responseURL.Contains("captcha") || responseURL.Contains("security"))
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine(Email, Globals.path_DesktopFolder + "\\AskingSecurityEmail_EmailChecker.txt");
                    AddToListAccountsLogs("[ " + DateTime.Now + " ] => [ Asking Security with Email : " + Email + " ]");
                }
                else if (responseURL.Contains("twitter.com/account/resend_password") && postResponse.Contains("robots"))
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine(Email, Globals.path_DesktopFolder + "\\TemporarilyLocked_EmailChecker.txt");
                    AddToListAccountsLogs("[ " + DateTime.Now + " ] => [ We've temporarily locked your ability to reset passwords. Please chillax for a few, then try again. : " + Email + " ]");
                }
                else if (postResponse.Contains("प्रतीत होता है की आपने एक अबैध ईमेल पता या फ़ोन नंबर भरा है. कृपया पुनः प्रयास करें.") || postResponse.Contains("It looks like you entered an invalid email address or phone number. Please try again."))
                {
                    GlobusFileHelper.AppendStringToTextfileNewLine(Email, Globals.path_DesktopFolder + "\\TemporarilyLocked_EmailChecker.txt");
                    AddToListAccountsLogs("[ " + DateTime.Now + " ] => [ invalid email address: " + Email + " ]");
                }
                else
                {
                    //no account
                    GlobusFileHelper.AppendStringToTextfileNewLine(Email, Globals.path_DesktopFolder + "\\NonExistingEmail_EmailChecker.txt");
                    AddToListAccountsLogs("[ " + DateTime.Now + " ] => [ NON Existing Email : " + Email + " ]");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
コード例 #32
0
        public void SignupMultiThreaded(object parameters)
        {
            Array paramsArray = new object[3];

            paramsArray = (Array)parameters;

            string Email    = string.Empty;
            string Password = string.Empty;

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

            string emailData = (string)paramsArray.GetValue(0);
            string username  = (string)paramsArray.GetValue(1);
            string name      = (string)paramsArray.GetValue(2);

            try
            {
                Email    = emailData.Split(':')[0];
                Password = emailData.Split(':')[1];
            }
            catch (Exception ex) { AddToListBox(ex.Message); }

            if (emailData.Split(':').Length > 5)
            {
                proxyAddress  = emailData.Split(':')[2];
                proxyPort     = emailData.Split(':')[3];
                proxyUsername = emailData.Split(':')[4];
                proxyPassword = emailData.Split(':')[5];
            }
            else if (emailData.Split(':').Length == 4)
            {
                proxyAddress = emailData.Split(':')[2];
                proxyPort    = emailData.Split(':')[3];
            }

            try
            {
                if (!(username.Count() < 15 || Password.Count() > 6))
                {
                    if (username.Count() > 15)
                    {
                        AddToListBox("Username Must Not be greater than 15 char");
                    }
                    else if (Password.Count() < 6)
                    {
                        AddToListBox("Password Must Not be less than 6 char");
                    }
                }
            }
            catch { }

            Random randm     = new Random();
            double cachestop = randm.NextDouble();

            string textUrl     = globusHelper.getHtmlfromUrlProxy(new Uri("https://twitter.com/signup"), proxyAddress, proxyPort, proxyUsername, proxyPassword, "", "");
            string pagesource1 = globusHelper.getHtmlfromUrl(new Uri("https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"), "", "");
            string pagesource2 = globusHelper.getHtmlfromUrl(new Uri("https://www.google.com/recaptcha/api/challenge?k=6LfbTAAAAAAAAE0hk8Vnfd1THHnn9lJuow6fgulO&ajax=1&cachestop=" + cachestop + "&lang=en"), "", "");

            try
            {
                int    IndexStart = pagesource2.IndexOf("challenge :");
                string Start      = pagesource2.Substring(IndexStart);
                int    IndexEnd   = Start.IndexOf("',");
                string End        = Start.Substring(0, IndexEnd).Replace("challenge :", "").Replace("'", "").Replace(" ", "");
                capcthavalue = End;
                ImageURL     = "https://www.google.com/recaptcha/api/image?c=" + End;
            }
            catch (Exception ex)
            {
                Console.WriteLine("1 :" + ex.StackTrace);
            }

            WebClient webclient = new WebClient();

            webclient.DownloadFile(ImageURL, Application.LocalUserAppDataPath + "\\Image.jpg");

            try
            {
                int    StartIndex = textUrl.IndexOf("phx-signup-form");
                string Start      = textUrl.Substring(StartIndex);
                int    EndIndex   = Start.IndexOf("name=\"authenticity_token");
                string End        = Start.Substring(0, EndIndex).Replace("phx-signup-form", "").Replace("method=\"POST\"", "").Replace("action=\"https://twitter.com/account/create\"", "");
                authenticitytoken = End.Replace("class=\"\">", "").Replace("<input type=\"hidden\"", "").Replace("class=\"\">", "").Replace("value=\"", "").Replace("\n", "").Replace("\"", "").Replace(" ", "");
            }
            catch (Exception ex)
            {
                Console.WriteLine("2 :" + ex.StackTrace);
            }
            try
            {
                bool   Created       = true;
                string url           = "https://twitter.com/users/email_available?suggest=1&username=&full_name=&email=" + Email.Replace("@", "%40").Replace(" ", "") + "&suggest_on_username=true&context=signup";
                string EmailCheck    = globusHelper.getHtmlfromUrl(new Uri(url), "https://twitter.com/signup", "");
                string Usernamecheck = globusHelper.getHtmlfromUrl(new Uri("https://twitter.com/users/username_available?suggest=1&username="******"&full_name=" + name + "&email=&suggest_on_username=true&context=signup"), "https://twitter.com/signup", "");

                if (EmailCheck.Contains("Email has already been taken. An email can only be used on one Twitter account at a time"))
                {
                    Created = false;
                }
                else if (Usernamecheck.Contains("Username has already been taken"))
                {
                    Created = false;
                }
                else if (EmailCheck.Contains("You cannot have a blank email address"))
                {
                    Created = false;
                }

                if (Created)
                {
                    byte[] args = webclient.DownloadData(ImageURL);

                    string[] arr1 = new string[] { "indianbill007", "sumit1234", "" };

                    string captchaText             = DecodeDBC(arr1, args);
                    string postdata                = "authenticity_token=" + authenticitytoken + "&user%5Bname%5D=" + name + "&user%5Bemail%5D=" + Email.Replace(" ", "") + "&user%5Buser_password%5D=" + Password + "&user%5Bscreen_name%5D=" + username + "&user%5Bremember_me_on_signup%5D=1&user%5Bremember_me_on_signup%5D=&context=&recaptcha_challenge_field=" + capcthavalue + "&recaptcha_response_field=" + HttpUtility.UrlEncode(captchaText) + "&user%5Bdiscoverable_by_email%5D=1&user%5Bsend_email_newsletter%5D=1";
                    string AccountcraetePageSource = globusHelper.postFormData(new Uri("https://twitter.com/account/create"), postdata, "https://twitter.com/signup", "", "", "", "");

                    if (AccountcraetePageSource.Contains("id=\"signout-form\"") && AccountcraetePageSource.Contains("/logout"))
                    {
                        MessageBox.Show("Account created");
                    }


                    if (Created)
                    {
                        ClsEmailActivator EmailActivate = new ClsEmailActivator();
                        bool verified = EmailActivate.EmailVerification(Email.Replace(" ", ""), Password, ref globusHelper);
                        if (verified)
                        {
                            AddToListBox("Account Verified");
                        }
                    }
                }
                else
                {
                    if (EmailCheck.Contains("Email has already been taken. An email can only be used on one Twitter account at a time"))
                    {
                        AddToListBox("Email has already been taken. An email can only be used on one Twitter account at a time");
                    }
                    else if (Usernamecheck.Contains("Username has already been taken"))
                    {
                        AddToListBox("Username has already been taken");
                    }
                    else if (EmailCheck.Contains("You cannot have a blank email address"))
                    {
                        AddToListBox("You cannot have a blank email address");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("3 :" + ex.StackTrace);
            }
        }
コード例 #33
0
ファイル: AccountManager.cs プロジェクト: shah8701/faceboard
        private bool CheckTemporarilyAccount(ref FacebookUser fbUser, ref GlobusHttpHelper HttpHelper)
        {

            try
            {
                string fb_dtsg = "";
                string strPageSource = HttpHelper.getHtmlfromUrl(new Uri(FBGlobals.Instance.AccountVerificationCheckpointUrl));     //"https://www.facebook.com/checkpoint/")
                if (strPageSource.Contains("It looks like someone else may have accessed your account, so we've temporarily locked it to keep it safe. For your privacy"))
                {
                    try
                    {
                        fb_dtsg = GlobusHttpHelper.Get_fb_dtsg(strPageSource);
                        fb_dtsg = Uri.EscapeDataString(fb_dtsg);
                        string temp_nh = strPageSource.Substring(strPageSource.IndexOf("name=\"nh\" value="), (strPageSource.IndexOf(">", strPageSource.IndexOf("name=\"nh\" value=")) - strPageSource.IndexOf("name=\"nh\" value="))).Replace("name=\"nh\" value=", string.Empty).Trim().Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("/", string.Empty).Trim();
                        string tempPostUrl = FBGlobals.Instance.AccountVerificationCheckpointUrl;                 //"https://www.facebook.com/checkpoint/";

                        string postdata = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&submit%5BContinue%5D=Continue";
                        string tempresponse = HttpHelper.postFormData(new Uri(tempPostUrl), postdata, FBGlobals.Instance.AccountVerificationCheckpointUrl);    //"https://www.facebook.com/checkpoint/"

                        if (tempresponse.Contains("In order to regain access to your account, please log in from a computer you have used before"))
                        {
                            try
                            {
                                string postseconddata = "fb_dtsg=" + fb_dtsg + "&nh=" + temp_nh + "&submit%5Bprovide_id%5D%5Bprovide%2Bidentification%2Bto%2Bregain%2Baccess%5D=provide+identification+to+regain+access";
                                string secondResponse = HttpHelper.postFormData(new Uri(tempPostUrl), postseconddata, FBGlobals.Instance.AccountVerificationCheckpointUrl);   //"https://www.facebook.com/checkpoint/"
                                if (secondResponse.Contains("Upload a photo ID"))
                                {
                                    GlobusFileHelper.AppendStringToTextfileNewLine(fbUser.username + ":" + fbUser.password + ":" + fbUser.proxyip + ":" + fbUser.proxyport + ":" + fbUser.proxyusername + ":" + fbUser.password, exportFilePathAccountVerification + "\\SecurityAccountWithPhotoVerify.txt");
                                    GlobusLogHelper.log.Info("Your Account Need PhotoId : " + fbUser.username);
                                    GlobusLogHelper.log.Debug("Your Account Need PhotoId : " + fbUser.username);

                                    return true;
                                }
                            }
                            catch (Exception ex)
                            {
                                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }
                }
                else
                {
                    return false;

                }
                return false;
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
            return false;
        }