Untitled

 avatar
unknown
plain_text
a year ago
12 kB
38
Indexable
 public static string GetRandom(this List<string> list)
        {
            if (list == null) return "";
            if (list.Count == 0) return "";
            try
            {
                return list.OrderBy(_ => Guid.NewGuid()).FirstOrDefault();
            }
            catch { return ""; }

        }

using (RequestFb request = new RequestFb("", listUserAgent.GetRandom(), proxyUrl)) 
                                {
                                    request.SetCookiesDomain("mid=Z" + RandomString(27), "instagram.com");
                                    row.Status = "Load trang Insta";
                                    string getwall = request.GetInsta("https://www.instagram.com/accounts/emailsignup/").Result;
                                    request.referer = "https://www.instagram.com/";
                                    if (string.IsNullOrEmpty(getwall))
                                    {
                                        row.Status = $"Lỗi mạng do proxy";
                                        row.Log = $"Lỗi mạng do proxy";
                                        return;
                                    }

                                    string client_id = Regex.Match(getwall, "name=\"client_id\" value=\"(.*?)\"").Groups[1].Value;
                                    string name = listName.GetRandom();
                                    string namef = name.GetAllNode(" ")[0];
                                    string namel = name.IsReplace(namef + " ", "");
                                    string password = pass + RandomString(8);
                                    string username = name.RemoveSign4VietnameseString().IsReplace(" ","") + RandomNumber(6);
                                    row.StoryID = password;
                                    string birthday_day = StaticRandom.Next(1, 29).ToString();
                                    string birthday_month = StaticRandom.Next(1, 13).ToString();
                                    string birthday_year = StaticRandom.Next(1990, 2005).ToString();
                                    row.Status = "Điền thông tin";
                                    string encpass = $"#PWD_INSTAGRAM_BROWSER:0:{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}:{password}";
                                    string reg1 = request.PostStringInsta("https://www.instagram.com/api/v1/web/accounts/web_create_ajax/attempt/", $"enc_password={WebUtility.UrlEncode(encpass)}&first_name={name}&phone_number={phone}&username={username.ToLower()}&client_id={request.Client_id_Insta}&seamless_login_enabled=1&opt_into_one_tap=false").Result;
                                    if(reg1.ClearJson().IsContains("\"status\":\"ok\""))
                                    {
                                        string checkd = request.PostStringInsta("https://www.instagram.com/api/v1/web/consent/check_age_eligibility/", $"day={birthday_day}&month={birthday_month}&year={birthday_year}").Result;

                                        string codecaptcha = "";
                                        Captcha any = new Captcha();
                                        int trycaptcha = 0;
                                        while (string.IsNullOrEmpty(codecaptcha) && trycaptcha < 3)
                                        {
                                            if (isStopRegCloneInsta) return;
                                            row.Status = $"Đang giải mã captcha lần {trycaptcha + 1}";
                                            any.RecaptchaV2Proxyless("6Lc9qjcUAAAAADTnJq5kJMjN9aD1lxpRLMnCS2TR", "https://www.fbsbx.com/captcha/recaptcha/iframe");
                                            codecaptcha = any.Result;
                                            trycaptcha++;
                                        }
                                        if (string.IsNullOrEmpty(codecaptcha))
                                        {                                            
                                            row.Status = "Lỗi giải mã captcha";
                                            row.Log = "Lỗi giải mã captcha";
                                            return;
                                        }
                                        row.Status = "Giải mã captcha thành công. Gửi Code về sim...";
                                    guilai:;
                                        string sendcode = request.PostStringInsta("https://www.instagram.com/api/v1/web/accounts/send_signup_sms_code_ajax/", $"captcha_token={codecaptcha}&client_id={request.Client_id_Insta}&phone_number={phone}").Result;
                                        if(sendcode.IsContains("\"sms_sent\":true"))
                                        {
                                            row.Status = "Gửi Code về sim thành công vào site đợi code...";
                                            sim.GetCode().Wait();
                                            string code = sim.Code;
                                            if (!string.IsNullOrEmpty(code))
                                            {
                                                row.Status = "Nhận được Code : " + code;
                                                row.Status1 = code;
                                                encpass = $"#PWD_INSTAGRAM_BROWSER:0:{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}:{password}";
                                                string reg2 = request.PostStringInsta("https://www.instagram.com/api/v1/web/accounts/web_create_ajax/", $"enc_password={encpass}&day=23&first_name={WebUtility.UrlEncode(name)}&month={birthday_month}&phone_number={phone}&username={username}&year={birthday_year}&sms_code={code}&client_id={request.Client_id_Insta}&seamless_login_enabled=1&tos_version=row").Result;
                                                string user_id = Regex.Match(reg2, "\"user_id\":\"(\\d+)").Groups[1].Value;
                                                if (!string.IsNullOrEmpty(user_id))
                                                {
                                                    row.Status = "Xác thực code thành công";
                                                    row.Log = "Thành công";
                                                    row.UID = user_id;

                                                    string cookie = request.GetCookie("https://www.instagram.com/");
                                                    File.AppendAllText(pathfile, $"{user_id}|{password}|{cookie}|{birthday_day}/{birthday_month}/{birthday_year}\r\n");
                                                }
                                                else 
                                                {
                                                    string mess = Regex.Match(reg2.ClearJson(), "[[]\"([^\"]+)\"[]]").Groups[1].Value;
                                                    if (string.IsNullOrEmpty(mess)) mess = reg2.ClearJson();
                                                    row.Status = "Xác thực code lỗi : " + Regex.Unescape(mess);
                                                    row.Log = "Xác thực code lỗi : " + Regex.Unescape(mess);
                                                }
                                            }
                                            else
                                            {       
                                                row.Status = "Không nhận được Code";
                                                row.Log = "Không nhận được Code";
                                                if (thulai < 3)
                                                {
                                                    thulai++; goto reglai;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            string mess = Regex.Match(sendcode.ClearJson(), "\"message\":\"(.*?)\"").Groups[1].Value;
                                            if (string.IsNullOrEmpty(mess)) mess = sendcode.ClearJson();
                                            row.Log = "Không gửi được Code (chờ 60s thử lại) : " + Regex.Unescape(mess);
                                            for(int i1=0;i1<60;i1++)
                                            {
                                                Task.Delay(1000).Wait();
                                                row.Status = $"Không gửi được Code chờ {60 -i1}s rồi thử lại";
                                            }                                                
                                            if (thulai < 3)
                                            {
                                                thulai++; goto guilai;
                                            }
                                        }

                                    } 
                                    else
                                    {
                                        string mess = Regex.Match(reg1.ClearJson(), "\"message\":\"(.*?)\"").Groups[1].Value;
                                        if (string.IsNullOrEmpty(mess)) mess = reg1.ClearJson();
                                        row.Status = "Reg Lỗi : " + Regex.Unescape(mess);
                                        row.Log = "Reg Lỗi : " + Regex.Unescape(mess);
                                        if (thulai <3)
                                        {
                                            thulai++; goto reglai;
                                        }    
                                    }
                                }


public async Task<string> PostStringInsta(string url, string data, string referer = "https://www.instagram.com/")
        {
            try
            {
                RestRequest request = new RestRequest(url); //request.Timeout = _Timeout;
                request.AddHeader("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
                request.AddHeader("sec-fetch-site", "same-origin");
                request.AddHeader("sec-fetch-dest", "empty");
                request.AddHeader("accept-language", "en-US,en;q=0.9");
                request.AddHeader("sec-fetch-mode", "cors");
                request.AddHeader("X-Ig-App-Id", "936619743392459");
                request.AddHeader("referer", referer);
                request.AddHeader("sec-ch-ua-platform", "\"Windows\"");
                request.AddHeader("User-Agent", UA);
                if (!string.IsNullOrEmpty(Csrftoken_Insta))
                    request.AddHeader("X-Csrftoken", Csrftoken_Insta);
                if (!string.IsNullOrEmpty(data))
                    request.AddStringBody(data, "application/x-www-form-urlencoded");
                request.Method = Method.Post;
                var res = await Client.ExecuteAsync(request);
                try
                {
                    if (res.ResponseUri != null)
                        ResponseURI = res.ResponseUri.OriginalString;
                }
                catch { }
                html = res?.Content;
                string error = GetError(html);
                if (!string.IsNullOrEmpty(error)) return error;
                return res?.Content;
            }
            catch { return ""; }
        }
Editor is loading...
Leave a Comment