Untitled

 avatar
unknown
plain_text
2 years ago
7.9 kB
23
Indexable
 try
                {
                    pro.Status = "Load trang đăng nhập";
                    row.Status = "Load trang đăng nhập";
                    string loginID = pro.UID;
                    string datalogin = "{\"locale\":\"en_US\",\"format\":\"json\",\"email\":\""+ loginID + "\",\"password\":\""+ pro.Password + "\",\"access_token\":\"350685531728|62f8ce9f74b12f84c123cc23437a4a32\",\"generate_session_cookies\":true}";


                    string temp = PostJson($"https://graph.facebook.com/auth/login", datalogin).Result;
                    if (string.IsNullOrEmpty(temp))
                    {
                        pro.Status = "Lỗi mạng";
                        row.Status = "Lỗi mạng";
                        return;
                    }
                    if (temp.IsContains("Invalid username or password"))
                    {
                        pro.Status = "Invalid username or password";
                        row.Status = "Invalid username or password";
                        return;
                    }
                    temp = temp.Replace("  ", " ").Replace(" \"", "\"").Replace("\" ", "\"").Replace("\r", "").Replace("\n", "").Replace(": ", ":");
                    string token = RegexMatch(temp, "access_token\":\"(.*?)\"").Groups[1].Value;
                    if (string.IsNullOrEmpty(token))
                    {
                        if (temp.IsContains("first_factor\":\""))
                        {
                            if (!string.IsNullOrEmpty(pro.SecrectKey))
                            {
                                var tfa = new TwoFactorAuth();
                                string code = tfa.GetCode(pro.SecrectKey.Replace(" ", "").ToUpper());
                                pro.Status = "Gửi 2FA : " + code;
                                row.Status = "Gửi 2FA : " + code;
                                UID = RegexMatch(temp, "\"uid\":(\\d+)").Groups[1].Value;
                                string factor = RegexMatch(temp, "first_factor\":\"(.*?)\"").Groups[1].Value;
                                string data2fa = "{\"locale\":\"en_US\",\"format\": \"json\",\"email\": \""+loginID+"\",\"password\":\""+ code + "\",\"credentials_type\":\"two_factor\",\"userid\":"+ UID+",\"twofactor_code\":\""+code+"\",\"first_factor\": \""+ factor + "\",\"access_token\":\"350685531728|62f8ce9f74b12f84c123cc23437a4a32\",\"generate_session_cookies\": true,\"generate_machine_id\": true}";
                                temp = PostJson($"https://graph.facebook.com/auth/login", data2fa).Result;
                                temp = temp.Replace(" \"", "\"").Replace("\" ", "\"").Replace("\r", "").Replace("\n", "").Replace("  ", " ");
                                token = RegexMatch(temp, "access_token\":\"(.*?)\"").Groups[1].Value;
                             
                                if (temp.IsContains("Invalid username or password") && string.IsNullOrEmpty(token))
                                {
                                    pro.Status = "Nhập sai 2FA";
                                    row.Status = "Nhập sai 2FA";
                                    return;
                                }
                            }
                        }
                    }
                    if (string.IsNullOrEmpty(token))
                    {
                        string er = RegexMatch(temp, "\"error_user_title\":\"(.*?)\"").Groups[1].Value;
                        if (string.IsNullOrEmpty(er)) er = temp;
                        er = RegexUnescape(er);
                        pro.Status = er;
                        row.Status = er;
                        return;
                    }
                    //check token live
                    string checktoken = Get($"https://graph.facebook.com/me/?fields=id,name,birthday,gender&access_token={token}").Result;
                    if (!string.IsNullOrEmpty(checktoken))
                        checktoken = checktoken.Replace("  ", " ").Replace(" \"", "\"").Replace("\" ", "\"").Replace("\r", "").Replace("\n", "");
                    string co = "";
                    if (checktoken.IsContains("828281030927956"))
                    {
                        pro.Status = "CP 956";
                        row.Status = "CP 956";
                        pro.Token = token;
                        tokenss = token;
                        try
                        {
                            dynamic stuff = JsonConvert.DeserializeObject(temp);
                            foreach (var no in stuff.session_cookies)
                            {
                                string name = no.name;
                                string value = no.value;
                                if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(value)) co += $"{name}={value};";
                            }
                        }
                        catch { }
                        pro.Cookie = co;
                        pro.Live = "CP 956";
                        SaveOneProfile(filedata, pro);
                        return;
                    }
                    if (checktoken.IsContains("1501092823525282"))
                    {
                        pro.Status = "CP 282";
                        row.Status = "CP 282";
                        pro.Token = token;
                        tokenss = token;
                        try
                        {
                            dynamic stuff = JsonConvert.DeserializeObject(temp);
                            foreach (var no in stuff.session_cookies)
                            {
                                string name = no.name;
                                string value = no.value;
                                if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(value)) co += $"{name}={value};";
                            }
                        }
                        catch { }
                        pro.Cookie = co;
                        pro.Live = "CP 282";
                        SaveOneProfile(filedata, pro);
                        return;
                    }
                    if (!checktoken.IsContains("\"id\":\""))
                    {
                        pro.Status = "Get Token thất bại";
                        row.Status = "Get Token thất bại";
                        return;
                    }
                    pro.Status = "Đăng nhập thành công";
                    pro.Token = token;
                    tokenss = token;
                    string birthday = RegexMatch(checktoken, "\"birthday\":\"(.*?)\"").Groups[1].Value;
                    if (!string.IsNullOrEmpty(birthday)) pro.Birthday = birthday;
                    string fullname = RegexMatch(checktoken, "\"name\":\"(.*?)\"").Groups[1].Value;
                    if (!string.IsNullOrEmpty(fullname)) pro.Fullname = RegexUnescape(fullname);
                    string gender = RegexMatch(checktoken, "\"gender\":\"(.*?)\"").Groups[1].Value;
                    if (!string.IsNullOrEmpty(gender)) pro.Gender = gender.ToUpper();
                    try
                    {
                        dynamic stuff = JsonConvert.DeserializeObject(temp);
                        foreach (var no in stuff.session_cookies)
                        {
                            string name = no.name;
                            string value = no.value;
                            if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(value)) co += $"{name}={value};";
                        }
                    }
                    catch { }
                    
                }
                catch { }
Editor is loading...