Exemple #1
0
        private ThreadStart LoginAndChangeInfo(DataGridViewRow row, string nowIP)
        {
            return((ThreadStart)(() => {
                string uid = row.Cells["uid"].Value.ToString();
                string password = row.Cells["password"].Value.ToString();;
                string passNew = txtPassNew.Text.Trim();
                string html;

                ProfileInfo profileInfo = new ProfileInfo();
                JObject o = new JObject();
                string profilePathStore = Application.StartupPath + "/profiles/" + profileInfo.uid;
                profileInfo.uid = uid;
                profileInfo.password = password;

                row.Cells["message"].Value = "Đang chờ đăng nhập !";

                Controllers.KChromeExtension kChromeExtension = new Controllers.KChromeExtension();
                ChromeOptions options = kChromeExtension.LoadOptionChrome(profilePathStore);

                ChromeDriver ch = new ChromeDriver(options);
                IJavaScriptExecutor jsRun = (IJavaScriptExecutor)ch;

                o = kChromeExtension.LoginFacebookByUserAndPassword(ch, uid, password);
                if (!o.ContainsKey("success"))
                {
                    row.Cells["message"].Value = "Sai mật khẩu hoặc checkpoint rồi";
                    ch.Close();
                    ch.Quit();
                    return;
                }
                else
                {
                    profileInfo.cookie = o["cookie"].ToString();
                    profileInfo.status = 1;
                    profileInfo.name = o["name"].ToString();

                    System.IO.File.WriteAllText($"{Application.StartupPath}\\profiles\\{profileInfo.uid}\\info.txt", JsonConvert.SerializeObject(profileInfo));


                    if (cbChangePass.Checked)
                    {
                        if ((bool)o["newskin"])
                        {
                            NewSkinChangePass(ch, profileInfo, kChromeExtension);
                            Debug.WriteLine(o["cquick_token"].ToString());
                        }

                        profileInfo.password_old = password;
                        profileInfo.password = txtPassNew.Text.Trim();
                    }
                }
                Debug.WriteLine(profileInfo.name);
            }));
        }
Exemple #2
0
        private void NewSkinChangePass(ChromeDriver ch, ProfileInfo profileInfo, Controllers.KChromeExtension kChromeExtension)
        {
            string passNew = txtPassNew.Text.Trim();

            ch.Navigate().GoToUrl("https://www.facebook.com/settings?tab=security");
            string cquick_token = Regex.Match(ch.PageSource, @"compat_iframe_token"":""(.*?)""").Groups[1].Value;


            ch.Navigate().GoToUrl("https://www.facebook.com/settings?tab=security&section=password&view&cquick=jsc_c_e&cquick_token=" + cquick_token + "&ctarget=https%3A%2F%2Fwww.facebook.com");
            //ch.FindElementByName("password_old").SendKeys(profileInfo.password);
            kChromeExtension.waitForPageElementIsVisible(ch, By.Name("password_old")).SendKeys(profileInfo.password);
            System.Threading.Thread.Sleep(100);
            ch.FindElementByName("password_new").SendKeys(passNew);
            System.Threading.Thread.Sleep(100);
            ch.FindElementByName("password_confirm").SendKeys(passNew);
            System.Threading.Thread.Sleep(100);
            ch.FindElementByXPath("//input[@type='submit']").Click();
        }