Quynh

mail@pastecode.io avatar
unknown
csharp
a year ago
14 kB
4
Indexable
private void Click_btnTutrieng(object sender, RoutedEventArgs e)
        {
            List<string> listUid = txt_listUidUnlock956.Text.GetAllLines();
            List<string> apiproxy = txt_listProxyUnlock956.Text.GetAllLines();
            List<Profile> listWork = MainDataGrid.GetProfiles(listUid);
            string typelogin = cb_loginUnlock956.Text;
            string typeMailunlock = cb_typemailUnlock956.Text;
            string type2fa = cb_type2fa.Text;
            string newpass = txt_newpassUnlock956.Text;
            string cbwebproxy = cb_webproxyUnlock956.Text;
            int soluongreg = txt_soluongUnlock956.Text.ToInt(1);
            List<string> newapiproxy = new List<string>();
            //var check = soluongreg % sokeyproxy;
            if (cbwebproxy != "Không Đổi IP")
            {
                int sokeyproxy = apiproxy.Count;
                if (soluongreg % sokeyproxy == 0)
                {
                    int n = soluongreg / sokeyproxy;
                    for (int i = 0; i < n; i++)
                    {
                        newapiproxy.AddRange(apiproxy);
                    }
                }
                if (soluongreg % sokeyproxy != 0)
                {
                    int n = soluongreg / sokeyproxy;
                    for (int i = 0; i < n + 1; i++)
                    {
                        newapiproxy.AddRange(apiproxy);
                    }
                }
            }
            btnStartUnlock956.IsEnabled = false; // khi start, nút start sẽ bị đen
            isStopUnlock956 = false;
            DataUnlock956Mail = new ObservableCollection<GridRow>();
            Task tk = new Task(() =>
            {
                ParallelOptions options = new ParallelOptions();
                options.MaxDegreeOfParallelism = soluongreg;

                Parallel.ForEach(listWork, options, pro =>
                {
                    GridRow row = new GridRow();
                    this.Dispatcher.Invoke(() =>
                    {
                        row.ID = DataUnlock956Mail.Count + 1;
                        DataUnlock956Mail.Add(row);
                        row.UID = pro.UID;
                        row.Status = "Bắt đầu Unlock 956";
                    });
                    string proxy = "";
                    string keyapi = newapiproxy.GetRandom();
                    newapiproxy.Remove(keyapi);
                    WebProxyApi webproxy = new WebProxyApi(keyapi);
                    //code xử lý 1 luồng
                    switch (cbwebproxy)
                    {
                        case "TinsoftProxy.Com":
                            if (string.IsNullOrEmpty(webproxy.proxyurl))
                                proxy = webproxy.GetNewProxyTinsoft();
                            else
                            {
                                webproxy.CheckProxyTinsoft();
                                if (webproxy.next_change <= 0) { proxy = webproxy.GetNewProxyTinsoft(); }
                                else
                                {
                                    Task.Delay(webproxy.next_change * 1000).Wait();
                                    proxy = webproxy.GetNewProxyTinsoft();
                                }
                            }
                            pro.ProxyUrl = proxy;
                            break;
                        case "proxy.shoplike.vn":
                            if (string.IsNullOrEmpty(webproxy.proxyurl))
                                proxy = webproxy.GetNewProxyShoplike();
                            else
                            {
                                webproxy.CheckProxyShoplike();
                                if (webproxy.next_change <= 0) { proxy = webproxy.GetNewProxyShoplike(); }
                                else
                                {
                                    Task.Delay(webproxy.next_change * 1000).Wait();
                                    proxy = webproxy.GetNewProxyShoplike();
                                }
                            }
                            pro.ProxyUrl = proxy;
                            break;
                        case "Không Đổi IP":
                            break;
                    }
                    row.IP = proxy;
                    
                    //start CODE LOGIN = 2FA RỒI GET COOKIE
                    #region CODE LOGIN = 2FA RỒI GET COOKIE
                    if (pro.Cookie == null)
                    {
                        RequestHTTP requestlogin = new RequestHTTP("", pro.ProxyUrl);
                        row.Status = "Bắt Đầu Gỡ CP";
                        string html = requestlogin.Get("https://mbasic.facebook.com/").Result;
                        if (string.IsNullOrEmpty(html))
                        {
                            row.Status = "Lỗi mạng";
                            return;
                        }
                        string datapost = getdata(html);
                        string clicklogin = requestlogin.PostAsync("https://mbasic.facebook.com/login/device-based/regular/login/?refsrc=deprecated&lwv=100&refid=8", $"email={pro.UID}&pass={pro.Password}" + datapost);
                        if (clicklogin.Contains("signup-button"))
                        {
                            row.Status = "Lỗi Đăng Nhập!";
                            return;
                        }
                        datapost = getdata(clicklogin);
                        if (clicklogin.Contains("action_upload_image"))
                        {
                            row.Status = "Checkpoin 282!";
                            return;
                        }
                        if (clicklogin.Contains("country_code"))
                        {
                            row.Status = "282 Phone!";
                            return;
                        }
                        string clickContinue = requestlogin.PostAsync("https://mbasic.facebook.com/login/checkpoint/", $"&checkpoint_data=&submit%5BContinue%5D=Continue" + datapost);
                        string clickUnlockmail = requestlogin.PostAsync("https://mbasic.facebook.com/login/checkpoint/", $"&checkpoint_data=&verification_method=37&submit%5BContinue%5D=Continue" + datapost);
                        string selectEmail = Regex.Match(clickUnlockmail, ".com\" value=\"(.*?)\" selected=\"1\"><div").Groups[1].Value;
                        if (string.IsNullOrEmpty(selectEmail))
                        {
                            row.Status = "Checkpoin Chưa Về Mail";
                            return;
                        }
                        string ResultselectEmail = selectEmail.Replace("&#064;", "@");
                        string clickSelectmail = requestlogin.PostAsync("https://mbasic.facebook.com/login/checkpoint/", $"&checkpoint_data=&send_code=1&eindex={ResultselectEmail}&submit%5BContinue%5D=Continue" + datapost);
                        row.Status = "Đang đợi code";
                        string[] trimemail1 = pro.Email.ToString().Split(new char[]
                                    {
                                                '@'
                                    });
                        int demCountcode1 = 0;
                        string nameemail1 = trimemail1[0];
                        string domainemail1 = trimemail1[1];
                        RequestHTTP requesttempmail1 = new RequestHTTP();
                        requesttempmail1.Get("https://temp-mail.io/en");
                        string temptest1 = requesttempmail1.PostJson("https://api.internal.temp-mail.io/api/v3/email/new", "{\"name\":\"" + nameemail1 + "\",\"domain\":\"" + domainemail1 + "\"}");
                    getcodeemail1:;
                        string getmail1 = requesttempmail1.Get($"https://api.internal.temp-mail.io/api/v3/email/{pro.Email}/messages").Result;
                        //Task.Delay(60000).Wait();
                        if (getmail1 == "[]\n")
                        {
                            Task.Delay(30000).Wait();
                            demCountcode1++;
                            if (demCountcode1 == 6)
                            {
                                row.Status = "Không Có Code";
                                return;
                            }
                            goto getcodeemail1;
                        }
                        if (getmail1.Contains("Email not found"))
                        {
                            row.Status = "Site Không Có Mail này";
                            return;
                        }
                        var listidEmail1 = Regex.Matches(getmail1, "id\":\"(.*?)\",\"from\":\"(.*?)Facebook");
                        var soluongEmail1 = listidEmail1.Count;
                        var idEmailnew1 = listidEmail1[soluongEmail1 - 1].Groups[1].Value;
                        string getInfo_idEmail1 = requesttempmail1.Get($"https://api.internal.temp-mail.io/api/v3/message/{idEmailnew1}").Result;
                        string gettimeEmail = Regex.Match(getInfo_idEmail1, "created_at\":\"(.*?)\"").Groups[1].Value;
                        string[] trimTime = gettimeEmail.Split(new char[]
                         {
                                            '.'
                         });
                        string timeEmail = trimTime[0];
                        DateTime dateTime = DateTime.ParseExact(timeEmail, "yyyy-MM-dd'T'HH:mm:ss", CultureInfo.InvariantCulture); // chuyển qua dạng thời gian
                        TimeSpan timeDifference1 = DateTime.UtcNow - dateTime; // tính thời gian chênh lệch
                        int checkTimeEmailseconds = (int)timeDifference1.TotalSeconds; //chuyển thời gian chênh lệch qua giây
                        if (checkTimeEmailseconds > 120)
                        {
                            Task.Delay(30000).Wait();
                            goto getcodeemail1;
                        }
                        string codeemail = Regex.Match(getInfo_idEmail1, ": (\\d{8})").Groups[1].Value;
                        while (string.IsNullOrEmpty(codeemail))
                        {
                            Task.Delay(30000).Wait();
                            demCountcode1++;
                            if (demCountcode1 == 6)
                            {
                                row.Status = "Không Có Code";
                                return;
                            }
                            goto getcodeemail1;
                        }
                        row.Status = $"Lấy code thành công {codeemail}";
                        string clickSendcode = requestlogin.PostAsync("https://mbasic.facebook.com/login/checkpoint/", $"&checkpoint_data=&captcha_response={codeemail}&submit%5BContinue%5D=Continue" + datapost);
                        if (clickSendcode.Contains("submit[Yes]"))
                        {
                            string clickconfirmIP = requestlogin.PostAsync("https://mbasic.facebook.com/login/checkpoint/", $"&checkpoint_data=&submit%5BYes%5D=Yes" + datapost);
                            string clickContuni = requestlogin.PostAsync("https://mbasic.facebook.com/login/checkpoint/", $"&checkpoint_data=&submit%5BContinue%5D=Continue" + datapost);
                            string clickChangepass = requestlogin.PostAsync("https://mbasic.facebook.com/login/checkpoint/", $"&checkpoint_data=&password_new={newpass}&submit%5BNext%5D=Next" + datapost);
                        }
                        string clickGohome = requestlogin.PostAsync("https://mbasic.facebook.com/login/checkpoint/", $"&checkpoint_data=&submit%5BContinue%5D=Continue&" + datapost);
                        if (clickGohome.Contains("action_upload_image"))
                        {
                            row.Status = "Xong - 282 Image!";
                        }
                        else if (clickGohome.Contains("country_code"))
                        {
                            row.Status = "Xong - 282 Phone!";

                        }
                        else
                        {
                            row.Status = "Gỡ Thất Bại!";
                            return;
                        }
                    }

                    #endregion
                    // end CODE LOGIN = 2FA RỒI GET COOKIE

                    //RequestHTTP requestfb = new RequestHTTP(pro.Cookie);
                    //string checklogin = requestfb.Get("https://www.facebook.com/me").Result;
                    //if (checklogin.Contains($"{pro.UID}"))
                    //{
                    //    row.Status = "Log ok";
                    //}
                    //else
                    //{
                    //    row.Status = "Log fail";

                    //}

                });

                this.Dispatcher.Invoke((Action)(() => {
                    MessageBox.Show("Gỡ 956 Xong");
                    btnStartUnlock956.IsEnabled = true;
                }));
            }); tk.Start();
        }