Beispiel #1
0
        public override void Login(string Username, string Password, string twofa)
        {
            string error = "";

            ClientHandlr = new HttpClientHandler {
                UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null
            };
            Client = new HttpClient(ClientHandlr)
            {
                BaseAddress = new Uri("https://www.bitsler.com/")
            };
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
            Client.DefaultRequestHeaders.Add("User-Agent", "DiceBot");

            try
            {
                string actual2fa = "";
                if (twofa.Contains("&"))
                {
                    string[] pars = twofa.Split('&');
                    actual2fa = pars[1];
                    twofa     = pars[0];
                }
                HttpResponseMessage resp = Client.GetAsync("https://www.bitsler.com").Result;
                string s1 = "";

                if (resp.IsSuccessStatusCode)
                {
                    s1 = resp.Content.ReadAsStringAsync().Result;
                }
                else
                {
                    if (resp.StatusCode == HttpStatusCode.ServiceUnavailable)
                    {
                        s1 = resp.Content.ReadAsStringAsync().Result;
                        //cflevel = 0;
                        System.Threading.Tasks.Task.Factory.StartNew(() =>
                        {
                            System.Windows.Forms.MessageBox.Show(Name + " has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                        });
                        if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, "www.bitsler.com"))
                        {
                            return;
                        }
                    }
                    else
                    {
                    }
                }
                List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
                pairs.Add(new KeyValuePair <string, string>("username", Username));
                pairs.Add(new KeyValuePair <string, string>("password", Password));
                //pairs.Add(new KeyValuePair<string, string>("api_key", "0b2edbfe44e98df79665e52896c22987445683e78"));
                if (!string.IsNullOrWhiteSpace(actual2fa))
                {
                    pairs.Add(new KeyValuePair <string, string>("twofactor", actual2fa));
                }
                pairs.Add(new KeyValuePair <string, string>("api_key", twofa));
                FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                HttpResponseMessage   tmpresp = Client.PostAsync("api/login", Content).Result;

                byte[] bytes         = tmpresp.Content.ReadAsByteArrayAsync().Result;
                string sEmitResponse = tmpresp.Content.ReadAsStringAsync().Result;

                //getuserstats
                bsloginbase bsbase = json.JsonDeserialize <bsloginbase>(sEmitResponse.Replace("\"return\":", "\"_return\":"));

                if (bsbase != null)
                {
                    if (bsbase._return != null)
                    {
                        if (bsbase._return.success == "true")
                        {
                            accesstoken = bsbase._return.access_token;
                            IsBitsler   = true;
                            lastupdate  = DateTime.Now;


                            pairs = new List <KeyValuePair <string, string> >();
                            pairs.Add(new KeyValuePair <string, string>("access_token", accesstoken));
                            Content       = new FormUrlEncodedContent(pairs);
                            sEmitResponse = Client.PostAsync("api/getuserstats", Content).Result.Content.ReadAsStringAsync().Result;
                            bsStatsBase bsstatsbase = json.JsonDeserialize <bsStatsBase>(sEmitResponse.Replace("\"return\":", "\"_return\":"));
                            if (bsstatsbase != null)
                            {
                                if (bsstatsbase._return != null)
                                {
                                    if (bsstatsbase._return.success == "true")
                                    {
                                        switch (Currency.ToLower())
                                        {
                                        case "btc": balance = bsstatsbase._return.btc_balance;
                                            profit          = bsstatsbase._return.btc_profit;
                                            wagered         = bsstatsbase._return.btc_wagered; break;

                                        case "ltc": balance = bsstatsbase._return.ltc_balance;
                                            profit          = bsstatsbase._return.ltc_profit;
                                            wagered         = bsstatsbase._return.ltc_wagered; break;

                                        case "doge": balance = bsstatsbase._return.doge_balance;
                                            profit           = bsstatsbase._return.doge_profit;
                                            wagered          = bsstatsbase._return.doge_wagered; break;

                                        case "eth": balance = bsstatsbase._return.eth_balance;
                                            profit          = bsstatsbase._return.eth_profit;
                                            wagered         = bsstatsbase._return.eth_wagered; break;

                                        case "burst":
                                            balance = bsstatsbase._return.burst_balance;
                                            profit  = bsstatsbase._return.burst_profit;
                                            wagered = bsstatsbase._return.burst_wagered; break;

                                        case "dash":
                                            balance = bsstatsbase._return.dash_balance;
                                            profit  = bsstatsbase._return.dash_profit;
                                            wagered = bsstatsbase._return.dash_wagered; break;

                                        case "zec":
                                            balance = bsstatsbase._return.zec_balance;
                                            profit  = bsstatsbase._return.zec_profit;
                                            wagered = bsstatsbase._return.zec_wagered; break;

                                        case "bch":
                                            balance = bsstatsbase._return.bch_balance;
                                            profit  = bsstatsbase._return.bch_profit;
                                            wagered = bsstatsbase._return.bch_wagered; break;

                                        case "xmr":
                                            balance = bsstatsbase._return.xmr_balance;
                                            profit  = bsstatsbase._return.xmr_profit;
                                            wagered = bsstatsbase._return.xmr_wagered; break;

                                        case "etc":
                                            balance = bsstatsbase._return.etc_balance;
                                            profit  = bsstatsbase._return.etc_profit;
                                            wagered = bsstatsbase._return.etc_wagered; break;
                                        }
                                        bets   = int.Parse(bsstatsbase._return.bets == null?"0": bsstatsbase._return.bets);
                                        wins   = int.Parse(bsstatsbase._return.wins == null ? "0" : bsstatsbase._return.wins);
                                        losses = int.Parse(bsstatsbase._return.losses == null ? "0" : bsstatsbase._return.losses);

                                        Parent.updateBalance(balance);
                                        Parent.updateBets(bets);
                                        Parent.updateLosses(losses);
                                        Parent.updateProfit(profit);
                                        Parent.updateWagered(wagered);
                                        Parent.updateWins(wins);
                                        this.username = Username;
                                    }
                                    else
                                    {
                                        if (bsstatsbase._return.value != null)
                                        {
                                            Parent.updateStatus(bsstatsbase._return.value);
                                        }
                                    }
                                }
                            }


                            IsBitsler = true;
                            Thread t = new Thread(GetBalanceThread);
                            t.Start();
                            finishedlogin(true);
                            return;
                        }
                        else
                        {
                            if (bsbase._return.value != null)
                            {
                                Parent.updateStatus(bsbase._return.value);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Parent.DumpLog(e.ToString(), 0);
            }
            finishedlogin(false);
        }
Beispiel #2
0
        void GetBalanceThread()
        {
            while (IsBitsler)
            {
                if ((DateTime.Now - lastupdate).TotalSeconds > 60 || ForceUpdateStats)
                {
                    lastupdate = DateTime.Now;
                    try
                    {
                        List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
                        pairs.Add(new KeyValuePair <string, string>("access_token", accesstoken));
                        FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                        HttpResponseMessage   resp    = Client.PostAsync("api/getuserstats", Content).Result;

                        string s1            = "";
                        string sEmitResponse = "";// resp.Content.ReadAsStringAsync().Result;

                        if (resp.IsSuccessStatusCode)
                        {
                            sEmitResponse = resp.Content.ReadAsStringAsync().Result;
                        }
                        else
                        {
                            sEmitResponse = "";
                            if (resp.StatusCode == HttpStatusCode.ServiceUnavailable)
                            {
                                s1 = resp.Content.ReadAsStringAsync().Result;
                                //cflevel = 0;
                                System.Threading.Tasks.Task.Factory.StartNew(() =>
                                {
                                    System.Windows.Forms.MessageBox.Show(Name + " has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                                });
                                if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, "www.bitsler.com"))
                                {
                                    //return;
                                }
                            }
                            else
                            {
                            }
                        }
                        if (sEmitResponse != "")
                        {
                            bsStatsBase bsstatsbase = json.JsonDeserialize <bsStatsBase>(sEmitResponse.Replace("\"return\":", "\"_return\":"));
                            if (bsstatsbase != null)
                            {
                                if (bsstatsbase._return != null)
                                {
                                    if (bsstatsbase._return.success == "true")
                                    {
                                        switch (Currency.ToLower())
                                        {
                                        case "btc":
                                            balance = bsstatsbase._return.btc_balance;
                                            profit  = bsstatsbase._return.btc_profit;
                                            wagered = bsstatsbase._return.btc_wagered; break;

                                        case "ltc":
                                            balance = bsstatsbase._return.ltc_balance;
                                            profit  = bsstatsbase._return.ltc_profit;
                                            wagered = bsstatsbase._return.ltc_wagered; break;

                                        case "doge":
                                            balance = bsstatsbase._return.doge_balance;
                                            profit  = bsstatsbase._return.doge_profit;
                                            wagered = bsstatsbase._return.doge_wagered; break;

                                        case "eth":
                                            balance = bsstatsbase._return.eth_balance;
                                            profit  = bsstatsbase._return.eth_profit;
                                            wagered = bsstatsbase._return.eth_wagered; break;

                                        case "burst":
                                            balance = bsstatsbase._return.burst_balance;
                                            profit  = bsstatsbase._return.burst_profit;
                                            wagered = bsstatsbase._return.burst_wagered; break;

                                        case "dash":
                                            balance = bsstatsbase._return.dash_balance;
                                            profit  = bsstatsbase._return.dash_profit;
                                            wagered = bsstatsbase._return.dash_wagered; break;

                                        case "zec":
                                            balance = bsstatsbase._return.zec_balance;
                                            profit  = bsstatsbase._return.zec_profit;
                                            wagered = bsstatsbase._return.zec_wagered; break;

                                        case "bch":
                                            balance = bsstatsbase._return.bch_balance;
                                            profit  = bsstatsbase._return.bch_profit;
                                            wagered = bsstatsbase._return.bch_wagered; break;

                                        case "xmr":
                                            balance = bsstatsbase._return.xmr_balance;
                                            profit  = bsstatsbase._return.xmr_profit;
                                            wagered = bsstatsbase._return.xmr_wagered; break;

                                        case "etc":
                                            balance = bsstatsbase._return.etc_balance;
                                            profit  = bsstatsbase._return.etc_profit;
                                            wagered = bsstatsbase._return.etc_wagered; break;
                                        }
                                        bets   = int.Parse(bsstatsbase._return.bets);
                                        wins   = int.Parse(bsstatsbase._return.wins);
                                        losses = int.Parse(bsstatsbase._return.losses);

                                        Parent.updateBalance(balance);
                                        Parent.updateBets(bets);
                                        Parent.updateLosses(losses);
                                        Parent.updateProfit(profit);
                                        Parent.updateWagered(wagered);
                                        Parent.updateWins(wins);
                                    }
                                    else
                                    {
                                        if (bsstatsbase._return.value != null)
                                        {
                                            Parent.updateStatus(bsstatsbase._return.value);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch { }
                }
                Thread.Sleep(1000);
            }
        }
Beispiel #3
0
        public override void Login(string Username, string Password, string twofa)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                                                   | SecurityProtocolType.Tls11
                                                   | SecurityProtocolType.Tls12
                                                   | SecurityProtocolType.Ssl3;
            ClientHandlr = new HttpClientHandler {
                UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null
            };
            Client = new HttpClient(ClientHandlr)
            {
                BaseAddress = new Uri(URL + "/api/v1/")
            };
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
            Client.DefaultRequestHeaders.Add("UserAgent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36");
            Client.DefaultRequestHeaders.Add("Origin", "https://wolf.bet");
            Client.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
            try
            {
                HttpResponseMessage resp1 = Client.GetAsync("").Result;
                string s1 = "";
                if (resp1.IsSuccessStatusCode)
                {
                    s1 = resp1.Content.ReadAsStringAsync().Result;
                    //Parent.DumpLog("BE login 2.1", 7);
                }
                else
                {
                    //Parent.DumpLog("BE login 2.2", 7);
                    if (resp1.StatusCode == HttpStatusCode.ServiceUnavailable)
                    {
                        s1 = resp1.Content.ReadAsStringAsync().Result;
                        //cflevel = 0;
                        System.Threading.Tasks.Task.Factory.StartNew(() =>
                        {
                            System.Windows.Forms.MessageBox.Show($"{Name} has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                        });
                        if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, URL.Replace("https://", "")))
                        {
                            finishedlogin(false);
                            return;
                        }
                    }
                    //Parent.DumpLog("BE login 2.3", 7);
                }
                Client.DefaultRequestHeaders.Add("X-Requested-With", "XMLHttpRequest");
                string      mfa         = twofa == ""?"": $",\"code\":\"{twofa}\"";
                string      LoginString = $"{{\"login\":\"{Username}\",\"password\":\"{Password}\"{mfa}}}";
                HttpContent cont        = new StringContent(LoginString);
                cont.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
                HttpResponseMessage resp2 = Client.PostAsync("login", cont).Result;

                if (resp2.IsSuccessStatusCode)
                {
                }
                string       sEmitResponse = resp2.Content.ReadAsStringAsync().Result;
                WolfBetLogin LoginResponse = json.JsonDeserialize <WolfBetLogin>(sEmitResponse);
                if (LoginResponse.access_token != null)
                {
                    Client.DefaultRequestHeaders.Add("authorization", "Bearer " + LoginResponse.access_token);
                }
                sEmitResponse = Client.GetStringAsync("user/profile").Result;
                try
                {
                    WolfBetProfile tmpProfile = json.JsonDeserialize <WolfBetProfile>(sEmitResponse);
                    if (tmpProfile.user != null)
                    {
                        //set balance here
                        foreach (Balance x in tmpProfile.user.balances)
                        {
                            if (x.currency.ToLower() == Currency.ToLower())
                            {
                                this.balance = decimal.Parse(x.amount, System.Globalization.NumberFormatInfo.InvariantInfo);
                                Parent.updateBalance(balance);
                            }
                        }
                        //get stats
                        //set stats
                        sEmitResponse = Client.GetStringAsync("user/stats/bets").Result;
                        WolfBetStats tmpStats = json.JsonDeserialize <WolfBetStats>(sEmitResponse);
                        UpdateStats(tmpStats);
                        ispd       = true;
                        lastupdate = DateTime.Now;
                        new Thread(new ThreadStart(GetBalanceThread)).Start();
                        this.finishedlogin(true);
                        return;
                    }
                }
                catch (Exception e)
                {
                    Parent.DumpLog(e.ToString(), -1);
                    Parent.DumpLog(sEmitResponse, -1);
                    Parent.updateStatus("Error: " + sEmitResponse);
                }
            }
            catch (Exception e)
            {
                Parent.DumpLog(e.ToString(), -1);
            }
            this.finishedlogin(false);
        }
Beispiel #4
0
        public override void Login(string Username, string Password, string twofa)
        {
            try
            {
                /*ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                 | SecurityProtocolType.Tls11
                 | SecurityProtocolType.Tls12
                 | SecurityProtocolType.Ssl3;*/
                cookies      = new CookieContainer();
                ClientHandlr = new HttpClientHandler
                {
                    UseCookies             = true,
                    CookieContainer        = cookies,
                    AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip,
                    Proxy    = (IWebProxy)this.Prox,
                    UseProxy = this.Prox != null
                };
                WebClient = new HttpClient(ClientHandlr)
                {
                    BaseAddress = new Uri("https://fortunejack.com/")
                };
                WebClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
                WebClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
                WebClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("br"));
                WebClient.DefaultRequestHeaders.Host = "fortunejack.com";
                WebClient.DefaultRequestHeaders.Add("Origin", "https://fortunejack.com");
                WebClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0");
                string tmps = json.ToDateString(DateTime.UtcNow);

                /*HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://fortunejack.com/");
                 *  if (Prox != null)
                 *      betrequest.Proxy = Prox;
                 *  betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                 *  betrequest.CookieContainer = Cookies;
                 * HttpWebResponse EmitResponse;*/
                string s1 = "";
                try
                {
                    HttpResponseMessage resp = WebClient.GetAsync("").Result;
                    if (resp.IsSuccessStatusCode)
                    {
                        s1 = resp.Content.ReadAsStringAsync().Result;
                    }
                    else
                    {
                        if (resp.StatusCode == HttpStatusCode.ServiceUnavailable)
                        {
                            s1 = resp.Content.ReadAsStringAsync().Result;
                            //cflevel = 0;
                            System.Threading.Tasks.Task.Factory.StartNew(() =>
                            {
                                System.Windows.Forms.MessageBox.Show("fortunejack.com has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                            });
                            if (!Cloudflare.doCFThing(s1, WebClient, ClientHandlr, 0, "fortunejack.com"))
                            {
                                finishedlogin(false);
                                return;
                            }
                        }
                    }
                }
                catch (AggregateException e)
                {
                    finishedlogin(false);
                    return;
                }
                Cookie c = new Cookie();
                foreach (Cookie tc in ClientHandlr.CookieContainer.GetCookies(new Uri("https://fortunejack.com")))
                {
                    if (tc.Name == "__cfduid")
                    {
                        c = tc;
                        break;
                    }
                }

                /*betrequest = (HttpWebRequest)HttpWebRequest.Create("https://fortunejack.com/");
                *  if (Prox != null)
                *   betrequest.Proxy = Prox;
                *  betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                *  betrequest.CookieContainer = Cookies;
                *
                *  EmitResponse = (HttpWebResponse)betrequest.GetResponse();
                *  sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd();*/
                HttpResponseMessage resp1 = WebClient.GetAsync("").Result;
                if (resp1.IsSuccessStatusCode)
                {
                    s1 = resp1.Content.ReadAsStringAsync().Result;
                }
                else
                {
                    if (resp1.StatusCode == HttpStatusCode.Forbidden)
                    {
                        s1 = resp1.Content.ReadAsStringAsync().Result;
                        //cflevel = 0;
                        System.Threading.Tasks.Task.Factory.StartNew(() =>
                        {
                            System.Windows.Forms.MessageBox.Show("fortunejack.com has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                        });
                        if (!Cloudflare.doCFThing(s1, WebClient, ClientHandlr, 0, "fortunejack.com"))
                        {
                            finishedlogin(false);
                            return;
                        }
                    }
                }
                string           phpsess = "";
                CookieCollection tmp     = ClientHandlr.CookieContainer.GetCookies(new Uri("https://fortunejack.com"));
                List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
                FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                string sEmitResponse          = WebClient.PostAsync("ajax/time.php", Content).Result.Content.ReadAsStringAsync().Result;
                //https://fortunejack.com/ajax/gamesSearch.php
                pairs         = new List <KeyValuePair <string, string> >();
                Content       = new FormUrlEncodedContent(pairs);
                sEmitResponse = WebClient.PostAsync("ajax/gamesSearch.php", Content).Result.Content.ReadAsStringAsync().Result;

                pairs         = new List <KeyValuePair <string, string> >();
                Content       = new FormUrlEncodedContent(pairs);
                sEmitResponse = WebClient.PostAsync("ajax/time.php", Content).Result.Content.ReadAsStringAsync().Result;


                tmp = ClientHandlr.CookieContainer.GetCookies(new Uri("https://fortunejack.com"));

                pairs = new List <KeyValuePair <string, string> >();
                pairs.Add(new KeyValuePair <string, string>("logName", Username));
                pairs.Add(new KeyValuePair <string, string>("logPassword", Password));
                //1456046111067
                pairs.Add(new KeyValuePair <string, string>("nocache", tmps));
                WebClient.DefaultRequestHeaders.Add("X-Requested-With", "XMLHttpRequest");

                Content = new FormUrlEncodedContent(pairs);

                try
                {
                    sEmitResponse = WebClient.PostAsync("ajax/login.php", Content).Result.Content.ReadAsStringAsync().Result;
                    if (!sEmitResponse.Contains("success"))
                    {
                        finishedlogin(false); return;
                    }
                }
                catch (AggregateException e)
                { finishedlogin(false); return; }

                sEmitResponse = WebClient.GetStringAsync("user.php").Result;
                sEmitResponse = WebClient.GetStringAsync("games/dice/").Result;
                GetChatToken(sEmitResponse);
                pairs   = new List <KeyValuePair <string, string> >();
                Content = new FormUrlEncodedContent(pairs);
                KeepAlive();
                sEmitResponse = WebClient.PostAsync("ajax/time.php", Content).Result.Content.ReadAsStringAsync().Result;
                sEmitResponse = WebClient.GetStringAsync("api/dice4/diceutils.php?act=rooms").Result;
                try
                {
                    FJCurrency[] tmpCurs = json.JsonDeserialize <FJCurrency[]>(sEmitResponse);
                    foreach (FJCurrency tc in tmpCurs)
                    {
                        Curs.Add(tc.currency_name.ToLower(), tc.currency_id);
                        Rooms.Add(tc.currency_name.ToLower(), tc.room_id);
                    }
                }
                catch
                { finishedlogin(false); return; }
                //get stats
                try
                {
                    string   stats     = WebClient.GetStringAsync("api/dice3/utils.php?stats&rnd=" + R.Next(0, int.MaxValue)).Result;
                    string[] StatsVals = stats.Split('|');
                    wagered = decimal.Parse(StatsVals[0], System.Globalization.NumberFormatInfo.InvariantInfo);
                    profit  = decimal.Parse(StatsVals[1], System.Globalization.NumberFormatInfo.InvariantInfo);
                    bets    = int.Parse(StatsVals[2], System.Globalization.NumberFormatInfo.InvariantInfo);
                    wins    = int.Parse(StatsVals[3], System.Globalization.NumberFormatInfo.InvariantInfo);
                    losses  = int.Parse(StatsVals[4], System.Globalization.NumberFormatInfo.InvariantInfo);
                }
                catch
                {
                    finishedlogin(false);
                    return;
                }


                StartSocket();
                while (Client.State == WebSocketState.Connecting)
                {
                    Thread.Sleep(100);
                }
                IsFJ = true;
                new Thread(new ThreadStart(KeepAliveThread)).Start();
                finishedlogin(true);
                IsLoggedIn = true;
                return;
                //Client.Send("67,2");
            }
            catch (AggregateException e)
            {
                finishedlogin(false);
                return;
            }
            finishedlogin(false);
            return;
        }
Beispiel #5
0
        public override void Login(string Username, string Password, string twofa)
        {
            //https://bit-exo.com/
            CookieContainer cookies = new CookieContainer();

            ClientHandlr = new HttpClientHandler {
                UseCookies = true, CookieContainer = cookies, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null
            };
            ServicePointManager.ServerCertificateValidationCallback +=
                (sender, cert, chain, sslPolicyErrors) => true;
            Client = new HttpClient(ClientHandlr)
            {
                BaseAddress = new Uri("https://" + url + "/")
            };
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
            Client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36");
            Parent.DumpLog("BE login 1", 8);

            try
            {
                accesstoken = Password;
                string s1 = "";
                HttpResponseMessage resp = Client.GetAsync("").Result;
                Parent.DumpLog("BE login 2", 8);
                if (resp.IsSuccessStatusCode)
                {
                    s1 = resp.Content.ReadAsStringAsync().Result;
                    Parent.DumpLog("BE login 2.1", 7);
                }
                else
                {
                    Parent.DumpLog("BE login 2.2", 7);
                    if (resp.StatusCode == HttpStatusCode.ServiceUnavailable)
                    {
                        s1 = resp.Content.ReadAsStringAsync().Result;
                        //cflevel = 0;
                        System.Threading.Tasks.Task.Factory.StartNew(() =>
                        {
                            System.Windows.Forms.MessageBox.Show("bit-exo has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                        });
                        if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, "bit-exo.com"))
                        {
                            finishedlogin(false);
                            return;
                        }
                    }
                    Parent.DumpLog("BE login 2.3", 7);
                }
                string response = Client.GetStringAsync("socket.io/?EIO=3&transport=polling&t=" + CurrentDate()).Result;
                Parent.DumpLog("BE login 3", 7);
                string c =
                    response.Substring(response.IndexOf("sid\":\"") + "sid\":\"".Length);
                c = c.Substring(0, c.IndexOf("\""));
                Parent.DumpLog("BE login 4", 7);
                foreach (Cookie c3 in cookies.GetCookies(new Uri("https://" + url)))
                {
                    if (c3.Name == "io")
                    {
                        c = c3.Value;
                    }

                    /*if (c3.Name == "__cfduid")
                     *  c2 = c3;*/
                }
                Parent.DumpLog("BE login 5", 7);
                string chatinit = "420[\"chat_init\",{\"app_id\":" + APPId + ",\"access_token\":\"" + accesstoken + "\",\"subscriptions\":[\"CHAT\",\"DEPOSITS\",\"BETS\"]}]";
                chatinit = chatinit.Length + ":" + chatinit;
                var content = new StringContent(chatinit, Encoding.UTF8, "application/octet-stream");
                response = Client.PostAsync("socket.io/?EIO=3&transport=polling&t=" + CurrentDate() + "&sid=" + c, content).Result.Content.ReadAsStringAsync().Result;
                Parent.DumpLog("BE login 5", 7);
                List <KeyValuePair <string, string> > Cookies = new List <KeyValuePair <string, string> >();
                List <KeyValuePair <string, string> > Headers = new List <KeyValuePair <string, string> >();
                Headers.Add(new KeyValuePair <string, string>("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"));
                foreach (Cookie x in cookies.GetCookies(new Uri("https://" + url)))
                {
                    Cookies.Add(new KeyValuePair <string, string>(x.Name, x.Value));
                }
                Cookies.Add(new KeyValuePair <string, string>("io", c));
                Parent.DumpLog("BE login 6", 7);
                WSClient                  = new WebSocket("wss://" + url + "/socket.io/?EIO=3&transport=websocket&sid=" + c, null, Cookies, Headers, "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36", "https://" + url, WebSocketVersion.Rfc6455, null, System.Security.Authentication.SslProtocols.Tls | System.Security.Authentication.SslProtocols.Tls11 | System.Security.Authentication.SslProtocols.Tls12);
                WSClient.Closed          += WSClient_Closed;
                WSClient.DataReceived    += WSClient_DataReceived;
                WSClient.Error           += WSClient_Error;
                WSClient.MessageReceived += WSClient_MessageReceived;
                WSClient.Opened          += WSClient_Opened;
                WSClient.Open();
                while (WSClient.State == WebSocketState.Connecting)
                {
                    Thread.Sleep(100);
                }
                if (WSClient.State == WebSocketState.Open)
                {
                    Parent.DumpLog("BE login 7.1", 7);
                    ispd = true;

                    lastupdate = DateTime.Now;
                    new Thread(new ThreadStart(GetBalanceThread)).Start();
                    finishedlogin(true); return;
                }
                else
                {
                    Parent.DumpLog("BE login 7.2", 7);
                    finishedlogin(false);
                    return;
                }
            }
            catch (AggregateException ER)
            {
                Parent.DumpLog(ER.ToString(), -1);
                finishedlogin(false);
                return;
            }
            catch (Exception ERR)
            {
                Parent.DumpLog(ERR.ToString(), -1);
                finishedlogin(false);
                return;
            }
            finishedlogin(false);
            return;
        }
Beispiel #6
0
        public override void Login(string Username, string Password, string twofa)
        {
            ClientHandlr = new HttpClientHandler {
                UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null
            };
            Client = new HttpClient(ClientHandlr)
            {
                BaseAddress = new Uri("https://freebitco.in/")
            };
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
            ClientHandlr.CookieContainer = Cookies;
            try
            {
                string s1 = "";
                HttpResponseMessage resp = Client.GetAsync("").Result;
                if (resp.IsSuccessStatusCode)
                {
                    s1 = resp.Content.ReadAsStringAsync().Result;
                }
                else
                {
                    if (resp.StatusCode == HttpStatusCode.ServiceUnavailable)
                    {
                        s1 = resp.Content.ReadAsStringAsync().Result;
                        //cflevel = 0;
                        System.Threading.Tasks.Task.Factory.StartNew(() =>
                        {
                            System.Windows.Forms.MessageBox.Show("freebitcoin has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                        });
                        if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, "freebitco.in"))
                        {
                            finishedlogin(false);
                            return;
                        }
                    }
                }
                foreach (Cookie x in Cookies.GetCookies(new Uri("https://freebitco.in")))
                {
                    if (x.Name == "csrf_token")
                    {
                        csrf = x.Value;
                    }
                }
                List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
                pairs.Add(new KeyValuePair <string, string>("csrf_token", csrf));
                pairs.Add(new KeyValuePair <string, string>("op", "login_new"));
                pairs.Add(new KeyValuePair <string, string>("btc_address", Username));
                pairs.Add(new KeyValuePair <string, string>("password", Password));
                pairs.Add(new KeyValuePair <string, string>("tfa_code", twofa));
                FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                var EmitResponse = Client.PostAsync("" + accesstoken, Content).Result;

                if (EmitResponse.IsSuccessStatusCode)
                {
                    string   s        = EmitResponse.Content.ReadAsStringAsync().Result;
                    string[] messages = s.Split(':');
                    if (messages.Length > 2)
                    {
                        address     = messages[1];
                        accesstoken = messages[2];
                        Cookies.Add(new Cookie("btc_address", address, "/", "freebitco.in"));
                        Cookies.Add(new Cookie("password", accesstoken, "/", "freebitco.in"));
                        Cookies.Add(new Cookie("have_account", "1", "/", "freebitco.in"));

                        s = Client.GetStringAsync("https://freebitco.in/cgi-bin/api.pl?op=get_user_stats").Result;
                        FreebtcStats stats = json.JsonDeserialize <FreebtcStats>(s);
                        if (stats != null)
                        {
                            this.balance = stats.balance / 100000000m;
                            bets         = (int)stats.rolls_played;
                            wins         = losses = 0;
                            profit       = stats.dice_profit / 100000000m;
                            wagered      = stats.wagered / 100000000m;
                            Parent.updateBalance(balance);
                            Parent.updateBets(bets);
                            Parent.updateWins(wins);
                            Parent.updateLosses(losses);
                            Parent.updateWagered(wagered);
                            Parent.updateProfit(profit);
                            lastupdate = DateTime.Now;
                            ispd       = true;
                            Thread t = new Thread(GetBalanceThread);
                            t.Start();
                            finishedlogin(true);
                            return;
                        }
                        finishedlogin(false);
                        return;
                    }
                    finishedlogin(false);
                    return;
                }


                //Lastbet = DateTime.Now;
            }
            catch (Exception e)
            {
                Parent.DumpLog(e.ToString(), 1);
            }
            finishedlogin(false);
            return;
        }
Beispiel #7
0
        void GetBalanceThread()
        {
            while (ispd)
            {
                try
                {
                    if (accesstoken != "" && ((DateTime.Now - lastupdate).TotalSeconds > 10 || ForceUpdateStats))
                    {
                        lastupdate       = DateTime.Now;
                        ForceUpdateStats = false;
                        List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
                        pairs.Add(new KeyValuePair <string, string>("c", "99999999"));
                        pairs.Add(new KeyValuePair <string, string>("g[]", "999999999"));
                        pairs.Add(new KeyValuePair <string, string>("k", "0"));
                        pairs.Add(new KeyValuePair <string, string>("m", "99999899"));
                        pairs.Add(new KeyValuePair <string, string>("u", "0"));
                        pairs.Add(new KeyValuePair <string, string>("self_only", "1"));

                        HttpResponseMessage resp1 = Client.GetAsync("").Result;
                        string s1 = "";
                        if (resp1.IsSuccessStatusCode)
                        {
                            s1 = resp1.Content.ReadAsStringAsync().Result;
                            //Parent.DumpLog("BE login 2.1", 7);
                        }
                        else
                        {
                            //Parent.DumpLog("BE login 2.2", 7);
                            if (resp1.StatusCode == HttpStatusCode.ServiceUnavailable)
                            {
                                s1 = resp1.Content.ReadAsStringAsync().Result;
                                //cflevel = 0;
                                System.Threading.Tasks.Task.Factory.StartNew(() =>
                                {
                                    System.Windows.Forms.MessageBox.Show("Bitvest.io has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                                });
                                if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, "bitvest.io"))
                                {
                                    finishedlogin(false);
                                    return;
                                }
                            }
                            //Parent.DumpLog("BE login 2.3", 7);
                        }

                        FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                        string sEmitResponse          = Client.PostAsync("https://bitvest.io/update.php", Content).Result.Content.ReadAsStringAsync().Result;
                        sEmitResponse = sEmitResponse.Replace("r-", "r_").Replace("n-", "n_");

                        BivestGetBalanceRoot tmpbase = json.JsonDeserialize <BivestGetBalanceRoot>(sEmitResponse);
                        if (tmpbase != null)
                        {
                            if (tmpbase.data != null)
                            {
                                switch (Currency.ToLower())
                                {
                                case "bitcoins":
                                    balance = tmpbase.data.balance; break;

                                case "ethers":
                                    balance = tmpbase.data.ether_balance; break;

                                case "litecoins":
                                    balance = tmpbase.data.litecoin_balance; break;

                                case "dogecoins":
                                    balance = tmpbase.data.balance_dogecoin; break;

                                case "bcash":
                                    balance = tmpbase.data.balance_bcash; break;

                                default:
                                    balance = tmpbase.data.token_balance; break;
                                }

                                /*if (Currency.ToLower() == "bitcoins")
                                 * {
                                 *  balance = decimal.Parse(tmpbase.data.balance, System.Globalization.NumberFormatInfo.InvariantInfo);
                                 * }
                                 * else
                                 * {
                                 *  balance = decimal.Parse(tmpbase.data.token_balance, System.Globalization.NumberFormatInfo.InvariantInfo);
                                 * }if (Currency.ToLower() == "bitcoins")
                                 * {
                                 * balance = decimal.Parse(tmplogin.balance, System.Globalization.NumberFormatInfo.InvariantInfo);
                                 * }
                                 * else if (Currency.ToLower() == "ethereum")
                                 * {
                                 * balance = decimal.Parse(tmplogin.token_balance, System.Globalization.NumberFormatInfo.InvariantInfo);
                                 * }
                                 * else if (Currency.ToLower() == "litecoin")
                                 * {
                                 * balance = decimal.Parse(tmplogin.token_balance, System.Globalization.NumberFormatInfo.InvariantInfo);
                                 * }
                                 * else
                                 * {
                                 * balance = decimal.Parse(tmplogin.token_balance, System.Globalization.NumberFormatInfo.InvariantInfo);
                                 * }*/
                                Parent.updateBalance(balance);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Parent.DumpLog(e.ToString(), -1);
                }
                Thread.Sleep(1000);
            }
        }
Beispiel #8
0
        public override void Login(string Username, string Password, string twofa)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                                                   | SecurityProtocolType.Tls11
                                                   | SecurityProtocolType.Tls12
                                                   | SecurityProtocolType.Ssl3;
            ClientHandlr = new HttpClientHandler {
                UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null
            };
            Client = new HttpClient(ClientHandlr)
            {
                BaseAddress = new Uri("https://nitrogensports.eu/")
            };
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
            Client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0");


            try
            {
                string s1 = "";
                HttpResponseMessage resp = Client.GetAsync("").Result;
                if (resp.IsSuccessStatusCode)
                {
                    s1 = resp.Content.ReadAsStringAsync().Result;
                }
                else
                {
                    if (resp.StatusCode == HttpStatusCode.ServiceUnavailable)
                    {
                        s1 = resp.Content.ReadAsStringAsync().Result;
                        //cflevel = 0;
                        System.Threading.Tasks.Task.Factory.StartNew(() =>
                        {
                            System.Windows.Forms.MessageBox.Show("nitrogensports.eu has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                        });
                        if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, "nitrogensports.eu"))
                        {
                            finishedlogin(false);
                            return;
                        }
                    }
                }
                List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();

                pairs.Add(new KeyValuePair <string, string>("username", Username));
                pairs.Add(new KeyValuePair <string, string>("password", Password));
                pairs.Add(new KeyValuePair <string, string>("captcha_code", ""));
                pairs.Add(new KeyValuePair <string, string>("otp", twofa /*==""?"undefined":twofa*/));
                FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                string  sEmitResponse         = Client.PostAsync("php/login/login.php", Content).Result.Content.ReadAsStringAsync().Result;
                NSLogin tmpLogin = json.JsonDeserialize <NSLogin>(sEmitResponse);
                if (tmpLogin.errno != 0)
                {
                    finishedlogin(false);
                    return;
                }
                else
                {
                    this.balance = decimal.Parse(tmpLogin.balance, System.Globalization.NumberFormatInfo.InvariantInfo);
                    token        = tmpLogin.csrf_token;
                    ConnectSocket();
                    balance = decimal.Parse(tmpLogin.balance, System.Globalization.NumberFormatInfo.InvariantInfo);
                    Parent.updateBalance(balance);
                    GetStats();
                    this.password = Password;
                    return;
                }
            }
            catch (AggregateException e)
            {
            }
            catch (Exception e)
            {
            }
            finishedlogin(false);
        }
Beispiel #9
0
        void ConnectSocket()
        {
            string s1 = "";

            HttpResponseMessage resp = Client.GetAsync("").Result;

            Parent.DumpLog("BE login 2", 8);
            if (resp.IsSuccessStatusCode)
            {
                s1 = resp.Content.ReadAsStringAsync().Result;
                Parent.DumpLog("BE login 2.1", 7);
            }
            else
            {
                Parent.DumpLog("BE login 2.2", 7);
                if (resp.StatusCode == HttpStatusCode.ServiceUnavailable)
                {
                    s1 = resp.Content.ReadAsStringAsync().Result;
                    //cflevel = 0;
                    System.Threading.Tasks.Task.Factory.StartNew(() =>
                    {
                        System.Windows.Forms.MessageBox.Show("bit-exo has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                    });
                    if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, "bit-exo.com"))
                    {
                        finishedlogin(false);
                        return;
                    }
                }
                Parent.DumpLog("BE login 2.3", 7);
            }
            string response = Client.GetStringAsync("socket.io/?EIO=3&transport=polling&t=" + json.CurrentDate()).Result;

            Parent.DumpLog("BE login 3", 7);
            sid = response.Substring(response.IndexOf("sid\":\"") + "sid\":\"".Length);
            sid = sid.Substring(0, sid.IndexOf("\""));
            Parent.DumpLog("BE login 4", 7);
            foreach (Cookie c3 in cookies.GetCookies(new Uri("http://" + url)))
            {
                if (c3.Name == "io")
                {
                    sid = c3.Value;
                }

                /*if (c3.Name == "__cfduid")
                 *  c2 = c3;*/
            }
            Parent.DumpLog("BE login 5", 7);
            string chatinit = "42" + id++ + "[\"access_token_data\",{\"access_token\":\"" + accesstoken + "\"}]";

            chatinit = chatinit.Length + ":" + chatinit;
            var content = new StringContent(chatinit, Encoding.UTF8, "application/octet-stream");

            response = Client.PostAsync("socket.io/?EIO=3&transport=polling&t=" + json.CurrentDate() + "&sid=" + sid, content).Result.Content.ReadAsStringAsync().Result;
            Parent.DumpLog("BE login 5", 7);
            Cookies = new List <KeyValuePair <string, string> >();
            Headers = new List <KeyValuePair <string, string> >();
            Headers.Add(new KeyValuePair <string, string>("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"));
            foreach (Cookie x in cookies.GetCookies(new Uri("https://" + url)))
            {
                Cookies.Add(new KeyValuePair <string, string>(x.Name, x.Value));
            }
            Cookies.Add(new KeyValuePair <string, string>("io", sid));

            Parent.DumpLog("BE login 6", 7);
            WSClient = new WebSocket("wss://" + url + "/socket.io/?EIO=3&transport=websocket&sid=" + sid,
                                     null,
                                     Cookies,
                                     Headers,
                                     "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
                                     "https://" + url,
                                     WebSocketVersion.Rfc6455,
                                     null,
                                     System.Security.Authentication.SslProtocols.Tls | System.Security.Authentication.SslProtocols.Tls11 | System.Security.Authentication.SslProtocols.Tls12);
            WSClient.Closed          += WSClient_Closed;
            WSClient.DataReceived    += WSClient_DataReceived;
            WSClient.Error           += WSClient_Error;
            WSClient.MessageReceived += WSClient_MessageReceived;
            WSClient.Opened          += WSClient_Opened;
            WSClient.Open();
            while (WSClient.State == WebSocketState.Connecting)
            {
                Thread.Sleep(100);
            }
        }
Beispiel #10
0
        public override void Login(string Username, string Password, string twofa)
        {
            try
            {
                ClientHandlr = new HttpClientHandler {
                    UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, AllowAutoRedirect = true
                };
                Client = new HttpClient(ClientHandlr)
                {
                    BaseAddress = new Uri("https://betking.io/")
                };
                Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
                Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
                cookies = new CookieContainer();
                ClientHandlr.CookieContainer = cookies;
                Client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36");

                string s1 = "";
                HttpResponseMessage resp = Client.GetAsync("").Result;
                if (resp.IsSuccessStatusCode)
                {
                    s1 = resp.Content.ReadAsStringAsync().Result;
                }
                else
                {
                    if (resp.StatusCode == HttpStatusCode.ServiceUnavailable)
                    {
                        s1 = resp.Content.ReadAsStringAsync().Result;
                        System.Threading.Tasks.Task.Factory.StartNew(() =>
                        {
                            System.Windows.Forms.MessageBox.Show("betking.io has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                        });
                        if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, "betking.io"))
                        {
                            finishedlogin(false);
                            return;
                        }
                    }
                    else
                    {
                    }
                }
                resp = Client.GetAsync("").Result;
                s1   = resp.Content.ReadAsStringAsync().Result;

                s1 = s1.Substring(s1.IndexOf("window.settings"));
                s1 = s1.Substring(s1.IndexOf("\"csrfToken\":\"") + "\"csrfToken\":\"".Length);

                string csrf = s1.Substring(0, s1.IndexOf("\""));
                Client.DefaultRequestHeaders.Add("csrf-token", csrf);

                List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
                // pairs.Add(new KeyValuePair<string, string>("_csrf", csrf));
                //pairs.Add(new KeyValuePair<string, string>("client_id", "0"));
                pairs.Add(new KeyValuePair <string, string>("fingerprint", "DiceBot-" + Process.GetCurrentProcess().Id));
                pairs.Add(new KeyValuePair <string, string>("loginmethod", Username.Contains("@")?"email": "username"));
                pairs.Add(new KeyValuePair <string, string>("password", Password));
                //pairs.Add(new KeyValuePair<string, string>("redirect_uri", "https://betking.io/bet"));
                pairs.Add(new KeyValuePair <string, string>("otp", twofa));
                pairs.Add(new KeyValuePair <string, string>("rememberme", "false"));
                pairs.Add(new KeyValuePair <string, string>(Username.Contains("@") ? "email" : "username", Username));
                FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                HttpResponseMessage   RespMsg = Client.PostAsync("api/auth/login", Content).Result;
                string responseUri            = RespMsg.RequestMessage.RequestUri.ToString();
                string sEmitResponse          = RespMsg.Content.ReadAsStringAsync().Result;

                if (!sEmitResponse.ToLower().Contains("error"))
                {
                    BKAccount tmpAccount = json.JsonDeserialize <BKAccount>(sEmitResponse);
                    this.username = Username;

                    sEmitResponse = Client.GetStringAsync("api/wallet/currencies").Result;
                    Currs         = json.JsonDeserialize <bkGetCurrencies>(sEmitResponse);

                    if (Currs == null)
                    {
                        Parent.DumpLog("Failed to get currencies", 0);
                        finishedlogin(false);
                        return;
                    }
                    foreach (BKCurrency x in Currs.currencies)
                    {
                        if (x.symbol.ToLower() == Currency.ToLower())
                        {
                            CurrentCurrency = x;
                        }
                    }
                    resp = Client.GetAsync("bet/dice").Result;
                    s1   = resp.Content.ReadAsStringAsync().Result;

                    s1 = s1.Substring(s1.IndexOf("window.settings"));
                    s1 = s1.Substring(s1.IndexOf("\"csrfToken\":\"") + "\"csrfToken\":\"".Length);

                    csrf = s1.Substring(0, s1.IndexOf("\""));
                    Client.DefaultRequestHeaders.Remove("csrf-token");
                    Client.DefaultRequestHeaders.Add("csrf-token", csrf);
                    GetBalance();
                    GetStats();


                    string      LoadState = Client.GetStringAsync("api/dice/load-state?clientSeed=" + R.Next(0, int.MaxValue) + "&currency=0").Result;
                    bkLoadSTate TmpState  = json.JsonDeserialize <bkLoadSTate>(LoadState);
                    nonce          = TmpState.nonce;
                    clientseed     = TmpState.clientSeed;
                    serverseedhash = TmpState.serverSeedHash;
                    finishedlogin(true);
                    return;
                }
            }
            catch (Exception e)
            {
                Parent.DumpLog(e.ToString(), 0);
                finishedlogin(false);
                return;
            }
            finishedlogin(false);
        }
Beispiel #11
0
        public override void Login(string Username, string Password, string twofa)
        {
            LastBalance = DateTime.Now;
            try
            {
                ClientHandlr = new HttpClientHandler()
                {
                    UseCookies             = true,
                    AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
                    Proxy    = (IWebProxy)this.Prox,
                    UseProxy = this.Prox != null
                };

                ClientHandlr.CookieContainer = new CookieContainer();
                //ClientHandlr.CookieContainer.Add(new Cookie("token", accesstoken, "/", "safedice.com"));
                Client = new HttpClient(ClientHandlr)
                {
                    BaseAddress = new Uri("https://safedice.com/")
                };
                Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
                Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
                Client.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36");

                string s1 = "";
                HttpResponseMessage resp = Client.GetAsync("").Result;
                if (resp.IsSuccessStatusCode)
                {
                    s1 = resp.Content.ReadAsStringAsync().Result;
                }
                else
                {
                    if (resp.StatusCode == HttpStatusCode.ServiceUnavailable)
                    {
                        s1 = resp.Content.ReadAsStringAsync().Result;
                        //cflevel = 0;
                        System.Threading.Tasks.Task.Factory.StartNew(() =>
                        {
                            System.Windows.Forms.MessageBox.Show("safedice.com has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                        });
                        if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, "www.safedice.com"))
                        {
                            finishedlogin(false);
                            return;
                        }
                    }
                    else
                    {
                    }
                }

                /*if (!Cloudflare.doCFThing(s1, WebClient, ClientHandlr, 0, "www.bitdice.me"))
                 * {
                 *  finishedlogin(false);
                 *  return;
                 * }*/

                /*}
                 * }*/

                /*HttpWebRequest loginrequest = (HttpWebRequest)HttpWebRequest.Create("https://safedice.com/auth/local");
                 * if (Prox != null)
                 *  loginrequest.Proxy = Prox;
                 * loginrequest.Method = "POST";
                 * string post = "username="******"&password="******"&code=" + twofa;
                 * loginrequest.ContentLength = post.Length;
                 * loginrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                 * loginrequest.Headers.Add("authorization", "Bearer " + accesstoken);
                 * using (var writer = new StreamWriter(loginrequest.GetRequestStream()))
                 * {
                 *
                 *  writer.Write(post);
                 * }
                 * HttpWebResponse EmitResponse = (HttpWebResponse)loginrequest.GetResponse();
                 * string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd();*/

                //List < KeyValuePair<string, string>> pairs = new List<KeyValuePair<string, string>>();
                //         pairs.Add(new KeyValuePair<string, string>("username", Username));
                //         pairs.Add(new KeyValuePair<string, string>("captcha", ""));

                //         pairs.Add(new KeyValuePair<string, string>("password", Password/*==""?"undefined":twofa*/));
                //         pairs.Add(new KeyValuePair<string, string>("code", twofa/*==""?"undefined":twofa*/));
                Thread.Sleep(1000);
                string loginjson = json.JsonSerializer <SafeDiceLoginPost>(new SafeDiceLoginPost()
                {
                    username = Username,
                    password = Password,
                    code     = twofa,
                    captcha  = "094t3y8e47byegr"
                });//string.Format("{{username:\"{0}\",password:\"{1}\",code:\"{2}\",captcha:\"{3}\"}}",Username,Password,twofa,"");

                HttpContent cont = new StringContent(loginjson);
                cont.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
                HttpResponseMessage resp2 = Client.PostAsync("https://safedice.com/auth/local", cont).Result;

                if (resp2.IsSuccessStatusCode)
                {
                }
                string        sEmitResponse = resp2.Content.ReadAsStringAsync().Result;
                SafeDiceLogin tmp           = json.JsonDeserialize <SafeDiceLogin>(sEmitResponse);
                accesstoken = tmp.token;
                if (accesstoken == "")
                {
                    finishedlogin(false);
                }
                else
                {
                    Client.DefaultRequestHeaders.Add("authorization", "Bearer " + accesstoken);

                    /*loginrequest = (HttpWebRequest)HttpWebRequest.Create("https://safedice.com/api/accounts/me?token=" + accesstoken);
                     * if (Prox != null)
                     *  loginrequest.Proxy = Prox;
                     * loginrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                     *
                     * loginrequest.CookieContainer = new CookieContainer();
                     * loginrequest.CookieContainer.Add(new Cookie("token", accesstoken, "/", "safedice.com"));
                     * loginrequest.Headers.Add("authorization", "Bearer " + accesstoken);
                     * EmitResponse = (HttpWebResponse)loginrequest.GetResponse();
                     * sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd();*/
                    try
                    {
                        sEmitResponse = Client.GetStringAsync("api/accounts/me?token=" + accesstoken).Result;
                    }
                    catch
                    {
                        finishedlogin(false);
                        return;
                    }
                    SafeDicegetUserInfo tmp1 = json.JsonDeserialize <SafeDicegetUserInfo>(sEmitResponse);

                    /*loginrequest = (HttpWebRequest)HttpWebRequest.Create("https://safedice.com/api/accounts/" + tmp1.id + "/sites/" + curen + "/me");
                     * if (Prox != null)
                     *  loginrequest.Proxy = Prox;
                     * loginrequest.CookieContainer = new CookieContainer();
                     * loginrequest.CookieContainer.Add(new Cookie("token", accesstoken, "", "safedice.com"));
                     * loginrequest.Headers.Add("authorization", "Bearer " + accesstoken);
                     * EmitResponse = (HttpWebResponse)loginrequest.GetResponse();
                     * sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd();*/
                    sEmitResponse = Client.GetStringAsync("api/accounts/" + tmp1.id + "/sites/" + curen + "/me").Result;
                    SafeDiceWalletInfo tmp2 = json.JsonDeserialize <SafeDiceWalletInfo>(sEmitResponse);


                    Parent.updateBalance(tmp2.balance / (curen != 2 ? 100000000m : 1000000000000m));
                    balance = tmp2.balance / (curen != 2 ? 100000000.0m : 1000000000000.0m);

                    Parent.updateBets(tmp2.win + tmp2.lose);
                    Parent.updateLosses(tmp2.lose);
                    wins   = (int)tmp2.win;
                    losses = (int)tmp2.lose;
                    Parent.updateProfit((tmp2.amountWin - tmp2.amountLose) / (curen != 2 ? 100000000.0m : 1000000000000.0m));
                    profit = (tmp2.amountWin - tmp2.amountLose) / (curen != 2 ? 100000000.0m : 1000000000000.0m);
                    Parent.updateWagered(tmp2.wagered / (curen != 2 ? 100000000.0m : 1000000000000.0m));
                    wagered = tmp2.wagered / (curen != 2 ? 100000000.0m : 1000000000000.0m);
                    Parent.updateWins(tmp2.win);
                    Parent.updateStatus("Logged in");
                    serverhash = tmp1.serverSeedHash;
                    client     = tmp1.accountSeed;
                    nonce      = tmp1.nonce;
                    UID        = tmp1.id;
                    Parent.updateDeposit(GetDepositAddress());
                    ispd = true;
                    Thread t = new Thread(GetBalanceThread);
                    t.Start();
                    finishedlogin(true);
                }
            }
            catch (WebException e)
            {
                if (e.Response != null)
                {
                    Parent.DumpLog(e.ToString(), -1);
                    string sEmitResponse = new StreamReader(e.Response.GetResponseStream()).ReadToEnd();
                    Parent.updateStatus(sEmitResponse);
                    if (e.Message.Contains("401"))
                    {
                        //System.Windows.Forms.MessageBox.Show("Could not log in. Please ensure the username, passowrd and 2fa code are all correct.");
                    }
                }
                finishedlogin(false);
            }
            catch (Exception e)
            {
                Parent.DumpLog(e.ToString(), -1);
                finishedlogin(false);
            }
        }
Beispiel #12
0
        public override void Login(string Username, string Password, string twofa)
        {
            try
            {
                /*ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                 | SecurityProtocolType.Tls11
                 | SecurityProtocolType.Tls12
                 | SecurityProtocolType.Ssl3;*/
                cookies      = new CookieContainer();
                ClientHandlr = new HttpClientHandler {
                    UseCookies = true, CookieContainer = cookies, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip
                };
                WebClient = new HttpClient(ClientHandlr)
                {
                    BaseAddress = new Uri("https://fortunejack.com/")
                };
                WebClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
                WebClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
                WebClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("br"));
                WebClient.DefaultRequestHeaders.Host = "fortunejack.com";
                WebClient.DefaultRequestHeaders.Add("Origin", "https://fortunejack.com");
                WebClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36");
                string tmps = json.ToDateString(DateTime.UtcNow);

                /*HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://fortunejack.com/");
                 *  if (Prox != null)
                 *      betrequest.Proxy = Prox;
                 *  betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                 *  betrequest.CookieContainer = Cookies;
                 * HttpWebResponse EmitResponse;*/
                string s1 = "";
                try
                {
                    HttpResponseMessage resp = WebClient.GetAsync("").Result;
                    if (resp.IsSuccessStatusCode)
                    {
                        s1 = resp.Content.ReadAsStringAsync().Result;
                    }
                    else
                    {
                        if (resp.StatusCode == HttpStatusCode.ServiceUnavailable)
                        {
                            s1 = resp.Content.ReadAsStringAsync().Result;
                            //cflevel = 0;
                            System.Threading.Tasks.Task.Factory.StartNew(() =>
                            {
                                System.Windows.Forms.MessageBox.Show("fortunejack.com has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                            });
                            if (!Cloudflare.doCFThing(s1, WebClient, ClientHandlr, 0, "fortunejack.com"))
                            {
                                finishedlogin(false);
                                return;
                            }
                        }
                    }
                }
                catch (AggregateException e)
                {
                    finishedlogin(false);
                    return;
                }
                Cookie c = new Cookie();
                foreach (Cookie tc in ClientHandlr.CookieContainer.GetCookies(new Uri("https://fortunejack.com")))
                {
                    if (tc.Name == "__cfduid")
                    {
                        c = tc;
                        break;
                    }
                }

                /*betrequest = (HttpWebRequest)HttpWebRequest.Create("https://fortunejack.com/");
                *  if (Prox != null)
                *   betrequest.Proxy = Prox;
                *  betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                *  betrequest.CookieContainer = Cookies;
                *
                *  EmitResponse = (HttpWebResponse)betrequest.GetResponse();
                *  sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd();*/
                string           sEmitResponse = WebClient.GetStringAsync("").Result;
                string           phpsess       = "";
                CookieCollection tmp           = ClientHandlr.CookieContainer.GetCookies(new Uri("https://fortunejack.com"));
                List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
                FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                sEmitResponse = WebClient.PostAsync("ajax/time.php", Content).Result.Content.ReadAsStringAsync().Result;
                //https://fortunejack.com/ajax/gamesSearch.php
                pairs         = new List <KeyValuePair <string, string> >();
                Content       = new FormUrlEncodedContent(pairs);
                sEmitResponse = WebClient.PostAsync("ajax/gamesSearch.php", Content).Result.Content.ReadAsStringAsync().Result;

                pairs         = new List <KeyValuePair <string, string> >();
                Content       = new FormUrlEncodedContent(pairs);
                sEmitResponse = WebClient.PostAsync("ajax/time.php", Content).Result.Content.ReadAsStringAsync().Result;


                tmp = ClientHandlr.CookieContainer.GetCookies(new Uri("https://fortunejack.com"));

                pairs = new List <KeyValuePair <string, string> >();
                pairs.Add(new KeyValuePair <string, string>("logName", Username));
                pairs.Add(new KeyValuePair <string, string>("logPassword", Password));
                //1456046111067
                pairs.Add(new KeyValuePair <string, string>("nocache", tmps));
                WebClient.DefaultRequestHeaders.Add("X-Requested-With", "XMLHttpRequest");

                Content = new FormUrlEncodedContent(pairs);

                try
                {
                    sEmitResponse = WebClient.PostAsync("ajax/login.php", Content).Result.Content.ReadAsStringAsync().Result;
                    if (!sEmitResponse.Contains("success"))
                    {
                        finishedlogin(false); return;
                    }
                }
                catch (AggregateException e)
                { finishedlogin(false); return; }

                sEmitResponse = WebClient.GetStringAsync("user.php").Result;
                sEmitResponse = WebClient.GetStringAsync("games/dice/").Result;
                pairs         = new List <KeyValuePair <string, string> >();
                Content       = new FormUrlEncodedContent(pairs);
                KeepAlive();
                sEmitResponse = WebClient.PostAsync("ajax/time.php", Content).Result.Content.ReadAsStringAsync().Result;
                sEmitResponse = WebClient.GetStringAsync("api/dice4/diceutils.php?act=rooms").Result;
                List <KeyValuePair <string, string> > headers  = new List <KeyValuePair <string, string> >();
                List <KeyValuePair <string, string> > cookies2 = new List <KeyValuePair <string, string> >();
                //headers.Add(new KeyValuePair<string, string>("Cookie", "_csn_session=" + cookie));
                foreach (Cookie curCookie in ClientHandlr.CookieContainer.GetCookies(new Uri("https://fortunejack.com")))
                {
                    cookies2.Add(new KeyValuePair <string, string>(curCookie.Name, curCookie.Value));
                }
                var domainTableField = ClientHandlr.CookieContainer.GetType().GetRuntimeFields().FirstOrDefault(x => x.Name == "m_domainTable");
                var domains          = (IDictionary)domainTableField.GetValue(ClientHandlr.CookieContainer);

                foreach (var val in domains.Values)
                {
                    var type   = val.GetType().GetRuntimeFields().First(x => x.Name == "m_list");
                    var values = (IDictionary)type.GetValue(val);
                    foreach (CookieCollection cooks in values.Values)
                    {
                        foreach (Cookie curCookie in cooks)
                        {
                            cookies2.Add(new KeyValuePair <string, string>(curCookie.Name, curCookie.Value));
                        }
                    }
                }

                /*headers.Add(new KeyValuePair<string, string>("Origin", "https://fortunejack.com"));
                 * //headers.Add(new KeyValuePair<string, string>("Host", "btrader.fortunejack.com"));
                 * headers.Add(new KeyValuePair<string, string>("Upgrade", "websocket"));
                 * headers.Add(new KeyValuePair<string, string>("Connection", "Upgrade"));
                 * headers.Add(new KeyValuePair<string, string>("Accept-Encoding", "deflate"));
                 * headers.Add(new KeyValuePair<string, string>("accept-language", "en-GB,en-US;q=0.8,en;q=0.6"));
                 * headers.Add(new KeyValuePair<string, string>("user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36"));
                 * headers.Add(new KeyValuePair<string, string>("Sec-WebSocket-Extensions", "client_max_window_bits"));
                 */

                Client = new WebSocket("wss://btrader.fortunejack.com:8080/ndice", "", cookies2, headers);

                Client.Opened              += Client_Opened;
                Client.Error               += Client_Error;
                Client.Closed              += Client_Closed;
                Client.MessageReceived     += Client_MessageReceived;
                Client.DataReceived        += Client_DataReceived;
                Client.AutoSendPingInterval = 4;
                Client.EnableAutoSendPing   = true;

                Client.Open();

                /*while (Client.State == WebSocketState.Connecting)
                 * {
                 *  Task.Delay(100);
                 * }*/
                finishedlogin(true);
                IsLoggedIn = true;
                //Client.Send("67,2");
            }
            catch (AggregateException e)
            {
            }
        }
Beispiel #13
0
        public override void Login(string Username, string Password, string twofa)
        {
            try
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                                                       | SecurityProtocolType.Tls11
                                                       | SecurityProtocolType.Tls12
                                                       | SecurityProtocolType.Ssl3;
                cookies      = new CookieContainer();
                ClientHandlr = new HttpClientHandler
                {
                    UseCookies             = true,
                    CookieContainer        = cookies,
                    AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip,
                    Proxy    = (IWebProxy)this.Prox,
                    UseProxy = this.Prox != null
                };
                WebClient = new HttpClient(ClientHandlr)
                {
                    BaseAddress = new Uri("https://www.bitdice.me/")
                };
                WebClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
                WebClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
                WebClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0");

                /*HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://www.bitdice.me/");
                 *  if (Prox != null)
                 *      betrequest.Proxy = Prox;
                 *  betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                 *  betrequest.CookieContainer = Cookies;
                 * HttpWebResponse EmitResponse;*/
                string s1 = "";
                try
                {
                    HttpResponseMessage resp = WebClient.GetAsync("").Result;
                    if (resp.IsSuccessStatusCode)
                    {
                        s1 = resp.Content.ReadAsStringAsync().Result;
                    }
                    else
                    {
                        if (resp.StatusCode == HttpStatusCode.ServiceUnavailable)
                        {
                            s1 = resp.Content.ReadAsStringAsync().Result;
                            //cflevel = 0;
                            System.Threading.Tasks.Task.Factory.StartNew(() =>
                            {
                                System.Windows.Forms.MessageBox.Show("bitdice.me has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                            });
                            if (!Cloudflare.doCFThing(s1, WebClient, ClientHandlr, 0, "www.bitdice.me"))
                            {
                                finishedlogin(false);
                                return;
                            }

                            /*if (!Cloudflare.doCFThing(s1, WebClient, ClientHandlr, 0, "www.bitdice.me"))
                             * {
                             *  finishedlogin(false);
                             *  return;
                             * }*/
                        }
                    }
                }
                catch
                {
                    finishedlogin(false);
                    return;
                }
                Cookie c = new Cookie();
                foreach (Cookie tc in ClientHandlr.CookieContainer.GetCookies(new Uri("https://www.bitdice.me")))
                {
                    if (tc.Name == "__cfduid")
                    {
                        c = tc;
                        break;
                    }
                }

                /*betrequest = (HttpWebRequest)HttpWebRequest.Create("https://www.bitdice.me/");
                 * if (Prox != null)
                 *  betrequest.Proxy = Prox;
                 * betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                 * betrequest.CookieContainer = Cookies;
                 *
                 * EmitResponse = (HttpWebResponse)betrequest.GetResponse();
                 * sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd();*/
                string sEmitResponse = WebClient.GetStringAsync("").Result;
                getcsrf(sEmitResponse);

                cookie = ClientHandlr.CookieContainer.GetCookies(new Uri("https://www.bitdice.me"))["_csn_session"].Value;
                //betrequest = (HttpWebRequest)HttpWebRequest.Create("https://www.bitdice.me/users/sign_in");
                //betrequest.Method = "POST";
                //betrequest.CookieContainer = Cookies;

                /*string post = string.Format("
                 * utf8=%E2%9C%93
                 * user%5Busername%5D={0}
                 * user%5Bpassword%5D={1}
                 * user%5Botp_code%5D=
                 * button=", Username, Password);
                 * username = Username;
                 * betrequest.ContentLength = post.Length;
                 *
                 * if (Prox != null)
                 *  betrequest.Proxy = Prox;
                 * betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                 * betrequest.CookieContainer.Add(new Cookie("_csn_session", cookie, "/", "bitdice.me"));
                 * betrequest.Headers.Add("X-CSRF-Token", csrf);
                 * using (var writer = new StreamWriter(betrequest.GetRequestStream()))
                 * {
                 *
                 *  writer.Write(post);
                 * }
                 * EmitResponse = (HttpWebResponse)betrequest.GetResponse();
                 * sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd();*/
                List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
                pairs.Add(new KeyValuePair <string, string>("utf8", "✓"));
                pairs.Add(new KeyValuePair <string, string>("user[username]", Username));
                pairs.Add(new KeyValuePair <string, string>("user[password]", Password));
                pairs.Add(new KeyValuePair <string, string>("user[otp_code]", twofa));
                pairs.Add(new KeyValuePair <string, string>("button", ""));
                FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                if (WebClient.DefaultRequestHeaders.Contains("X-CSRF-Token"))
                {
                    WebClient.DefaultRequestHeaders.Remove("X-CSRF-Token");
                }
                WebClient.DefaultRequestHeaders.Add("X-CSRF-Token", csrf);

                username = Username;
                try
                {
                    sEmitResponse = WebClient.PostAsync("users/sign_in", Content).Result.Content.ReadAsStringAsync().Result;
                }
                catch { finishedlogin(false); }
                cookie = ClientHandlr.CookieContainer.GetCookies(new Uri("https://www.bitdice.me"))["_csn_session"].Value;
                if (WebClient.DefaultRequestHeaders.Contains("X-CSRF-Token"))
                {
                }
                try
                {
                    ClientHandlr.CookieContainer.Add(new Cookie("_csn_session", cookie, "/", "bitdice.me"));
                }catch
                { }

                /*betrequest = (HttpWebRequest)HttpWebRequest.Create("https://www.bitdice.me/");
                 * if (Prox != null)
                 *  betrequest.Proxy = Prox;
                 * betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                 * betrequest.CookieContainer = Cookies;
                 * betrequest.CookieContainer.Add(new Cookie("_csn_session", cookie, "/", "bitdice.me"));
                 *
                 * EmitResponse = (HttpWebResponse)betrequest.GetResponse();
                 * sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd();*/
                try
                {
                    sEmitResponse = WebClient.GetStringAsync("").Result;
                }
                catch (AggregateException e)
                {
                    finishedlogin(false);
                }
                catch { finishedlogin(false); }
                getDeposit(sEmitResponse);
                getcsrf(sEmitResponse);
                ClientHandlr.CookieContainer.GetCookies(new Uri("https://www.bitdice.me"))["_csn_session"].Value = cookie;
                //cookie = ClientHandlr.CookieContainer.GetCookies(new Uri("https://www.bitdice.me"))["_csn_session"].Value;

                getstream(sEmitResponse);

                getcsrf(sEmitResponse);
                getstream(sEmitResponse);
                if (WebClient.DefaultRequestHeaders.Contains("X-CSRF-Token"))
                {
                    WebClient.DefaultRequestHeaders.Remove("X-CSRF-Token");
                }
                WebClient.DefaultRequestHeaders.Add("X-CSRF-Token", csrf);
                if (Client != null)
                {
                    Client.Close();
                }

                List <KeyValuePair <string, string> > headers = new List <KeyValuePair <string, string> >();
                //headers.Add(new KeyValuePair<string, string>("Cookie", "_csn_session=" + cookie));
                List <KeyValuePair <string, string> > cookies2 = new List <KeyValuePair <string, string> >();
                cookies2.Add(new KeyValuePair <string, string>("_csn_session", cookie));
                cookies2.Add(new KeyValuePair <string, string>("__cfduid", c.Value));
                headers.Add(new KeyValuePair <string, string>("Origin", "https://www.bitdice.me"));
                headers.Add(new KeyValuePair <string, string>("Host", "www.bitdice.me"));
                headers.Add(new KeyValuePair <string, string>("Upgrade", "websocket"));
                headers.Add(new KeyValuePair <string, string>("Connection", "keep-alive, Upgrade"));
                headers.Add(new KeyValuePair <string, string>("user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0"));

                Client = new WebSocket("wss://www.bitdice.me/stream/" + stream, "", cookies2, headers, "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0",
                                       "https://www.bitdice.me", WebSocketVersion.Rfc6455, null, System.Security.Authentication.SslProtocols.Tls | System.Security.Authentication.SslProtocols.Tls11 | System.Security.Authentication.SslProtocols.Tls12);


                Client.Opened          += Client_Opened;
                Client.Error           += Client_Error;
                Client.Closed          += Client_Closed;
                Client.MessageReceived += Client_MessageReceived;


                Client.Open();
                while (Client.State == WebSocketState.Connecting)
                {
                    Thread.Sleep(100);
                }
                //CurrencyChanged();
                finishedlogin(Client.State == WebSocketState.Open);
                loggedin = true;
                System.Windows.Forms.MessageBox.Show("Due to current limitations of the API, I can't show you your stats until you place a valid bet. Sorry.\n\nAlso, you will need to reselect your currency. If you already selected the currency you want to play in, please select another first, and then switch back.", "Stats Errors", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
            }
            catch (WebException e)
            {
                if (e.Response != null)
                {
                    string s = new StreamReader(e.Response.GetResponseStream()).ReadToEnd();
                }
            }
            catch
            {
                finishedlogin(false);
            }
        }
Beispiel #14
0
        public override void Login(string Username, string Password, string twofa)
        {
            try
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                                                       | SecurityProtocolType.Tls11
                                                       | SecurityProtocolType.Tls12
                                                       | SecurityProtocolType.Ssl3;
                cookies      = new CookieContainer();
                ClientHandlr = new HttpClientHandler
                {
                    UseCookies             = true,
                    CookieContainer        = cookies,
                    AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip,
                    Proxy    = (IWebProxy)this.Prox,
                    UseProxy = this.Prox != null
                };
                WebClient = new HttpClient(ClientHandlr)
                {
                    BaseAddress = new Uri("https://www.bitdice.me/")
                };
                WebClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
                WebClient.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
                WebClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0");

                /*HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://www.bitdice.me/");
                 *  if (Prox != null)
                 *      betrequest.Proxy = Prox;
                 *  betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                 *  betrequest.CookieContainer = Cookies;
                 * HttpWebResponse EmitResponse;*/
                string s1 = "";
                try
                {
                    HttpResponseMessage resp = WebClient.GetAsync("").Result;
                    if (resp.IsSuccessStatusCode)
                    {
                        s1 = resp.Content.ReadAsStringAsync().Result;
                    }
                    else
                    {
                        if (resp.StatusCode == HttpStatusCode.ServiceUnavailable)
                        {
                            s1 = resp.Content.ReadAsStringAsync().Result;
                            //cflevel = 0;
                            System.Threading.Tasks.Task.Factory.StartNew(() =>
                            {
                                System.Windows.Forms.MessageBox.Show("bitdice.me has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                            });
                            if (!Cloudflare.doCFThing(s1, WebClient, ClientHandlr, 0, "www.bitdice.me"))
                            {
                                finishedlogin(false);
                                return;
                            }

                            /*if (!Cloudflare.doCFThing(s1, WebClient, ClientHandlr, 0, "www.bitdice.me"))
                             * {
                             *  finishedlogin(false);
                             *  return;
                             * }*/
                        }
                    }
                }
                catch
                {
                    finishedlogin(false);
                    return;
                }
                Cookie c = new Cookie();
                foreach (Cookie tc in ClientHandlr.CookieContainer.GetCookies(new Uri("https://www.bitdice.me")))
                {
                    if (tc.Name == "__cfduid")
                    {
                        c = tc;
                        break;
                    }
                }

                string sEmitResponse = WebClient.GetStringAsync("").Result;

                //create data thing
                string a = json.JsonSerializer <bitdicedatainfo>(new bitdicedatainfo());

                //encode
                //a = System.Web.HttpUtility.HtmlEncode(a);
                //a = a.Replace("+", "%20");
                //unescape
                a = System.Web.HttpUtility.UrlDecode(a);

                //base 64 encode
                a = EncodeTo64(a);
                a = "eyJsYW5nIjoiZW4tVVMsIGVuLCBhZiIsInBsYXRmb3JtIjoiV2luMzIiLCJjcHUiOjQsInNpemUiOiIxOTAzeDQyODEgKDE5MjB4MTA4MCkiLCJ3ZWJydGMiOiIxNzIuMTYuMTAxLjczIiwidGltZXpvbmUiOiJBZnJpY2EvSm9oYW5uZXNidXJnIiwidGltZSI6IkZyaSBOb3YgMDQgMjAxNiAxMDo1NzoxOSBHTVQrMDIwMCAoU291dGggQWZyaWNhIFN0YW5kYXJkIFRpbWUpIn0=";
                List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
                pairs.Add(new KeyValuePair <string, string>("user[email]", Username));
                pairs.Add(new KeyValuePair <string, string>("user[password]", Password));
                pairs.Add(new KeyValuePair <string, string>("user[two_fa]", twofa));
                pairs.Add(new KeyValuePair <string, string>("data[info]", a));
                //data[info]
                FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);

                /*if (WebClient.DefaultRequestHeaders.Contains("X-CSRF-Token"))
                 * {
                 *  WebClient.DefaultRequestHeaders.Remove("X-CSRF-Token");
                 * }
                 * WebClient.DefaultRequestHeaders.Add("X-CSRF-Token", csrf);
                 */
                username = Username;
                try
                {
                    sEmitResponse = WebClient.PostAsync("/api/sign_in", Content).Result.Content.ReadAsStringAsync().Result;
                }
                catch { finishedlogin(false); }
                //cookie = ClientHandlr.CookieContainer.GetCookies(new Uri("https://www.bitdice.me"))["_csn_session"].Value;

                /*if (WebClient.DefaultRequestHeaders.Contains("X-CSRF-Token"))
                 * {
                 *
                 * }*/
                /*try
                *  {
                *   ClientHandlr.CookieContainer.Add(new Cookie("_csn_session", cookie, "/", "bitdice.me"));
                *  }catch
                *  { }*/
                /*betrequest = (HttpWebRequest)HttpWebRequest.Create("https://www.bitdice.me/");
                 * if (Prox != null)
                 *  betrequest.Proxy = Prox;
                 * betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                 * betrequest.CookieContainer = Cookies;
                 * betrequest.CookieContainer.Add(new Cookie("_csn_session", cookie, "/", "bitdice.me"));
                 *
                 * EmitResponse = (HttpWebResponse)betrequest.GetResponse();
                 * sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd();*/
                try
                {
                    sEmitResponse = WebClient.GetStringAsync("").Result;
                }
                catch (AggregateException e)
                {
                    finishedlogin(false);
                }
                catch { finishedlogin(false); }
                getDeposit(sEmitResponse);
                getcsrf(sEmitResponse);
                ClientHandlr.CookieContainer.GetCookies(new Uri("https://www.bitdice.me"))["_csn_session"].Value = cookie;
                //cookie = ClientHandlr.CookieContainer.GetCookies(new Uri("https://www.bitdice.me"))["_csn_session"].Value;

                getstream(sEmitResponse);

                getcsrf(sEmitResponse);
                getstream(sEmitResponse);
                if (WebClient.DefaultRequestHeaders.Contains("X-CSRF-Token"))
                {
                    WebClient.DefaultRequestHeaders.Remove("X-CSRF-Token");
                }
                WebClient.DefaultRequestHeaders.Add("X-CSRF-Token", csrf);
                if (Client != null)
                {
                    Client.Close();
                }

                List <KeyValuePair <string, string> > headers = new List <KeyValuePair <string, string> >();
                //headers.Add(new KeyValuePair<string, string>("Cookie", "_csn_session=" + cookie));
                List <KeyValuePair <string, string> > cookies2 = new List <KeyValuePair <string, string> >();
                cookies2.Add(new KeyValuePair <string, string>("_csn_session", cookie));
                cookies2.Add(new KeyValuePair <string, string>("__cfduid", c.Value));
                headers.Add(new KeyValuePair <string, string>("Origin", "https://www.bitdice.me"));
                headers.Add(new KeyValuePair <string, string>("Host", "www.bitdice.me"));
                headers.Add(new KeyValuePair <string, string>("Upgrade", "websocket"));
                headers.Add(new KeyValuePair <string, string>("Connection", "keep-alive, Upgrade"));
                headers.Add(new KeyValuePair <string, string>("user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0"));

                Client = new WebSocket("wss://www.bitdice.me/stream/" + stream, "", cookies2, headers, "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0",
                                       "https://www.bitdice.me", WebSocketVersion.Rfc6455, null, System.Security.Authentication.SslProtocols.Tls | System.Security.Authentication.SslProtocols.Tls11 | System.Security.Authentication.SslProtocols.Tls12);


                Client.Opened          += Client_Opened;
                Client.Error           += Client_Error;
                Client.Closed          += Client_Closed;
                Client.MessageReceived += Client_MessageReceived;


                Client.Open();
                while (Client.State == WebSocketState.Connecting)
                {
                    Thread.Sleep(100);
                }
                //CurrencyChanged();
                finishedlogin(Client.State == WebSocketState.Open);
                loggedin = true;
                System.Windows.Forms.MessageBox.Show("Due to current limitations of the API, I can't show you your stats until you place a valid bet. Sorry.\n\nAlso, you will need to reselect your currency. If you already selected the currency you want to play in, please select another first, and then switch back.", "Stats Errors", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
            }
            catch (WebException e)
            {
                if (e.Response != null)
                {
                    string s = new StreamReader(e.Response.GetResponseStream()).ReadToEnd();
                }
            }
            catch
            {
                finishedlogin(false);
            }
        }
Beispiel #15
0
        public override void Login(string Username, string Password, string twofa)
        {
            try
            {
                ClientHandlr = new HttpClientHandler {
                    UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, AllowAutoRedirect = false
                };
                Client = new HttpClient(ClientHandlr)
                {
                    BaseAddress = new Uri("https://betking.io/")
                };
                Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
                Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
                cookies = new CookieContainer();
                ClientHandlr.CookieContainer = cookies;
                Client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36");

                string s1 = "";
                HttpResponseMessage resp = Client.GetAsync("").Result;
                if (resp.IsSuccessStatusCode)
                {
                    s1 = resp.Content.ReadAsStringAsync().Result;
                }
                else
                {
                    if (resp.StatusCode == HttpStatusCode.ServiceUnavailable)
                    {
                        s1 = resp.Content.ReadAsStringAsync().Result;
                        System.Threading.Tasks.Task.Factory.StartNew(() =>
                        {
                            System.Windows.Forms.MessageBox.Show("betking.io has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
                        });
                        if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, "betking.io"))
                        {
                            finishedlogin(false);
                            return;
                        }
                    }
                    else
                    {
                    }
                }
                string LoginPage = Client.GetStringAsync("").Result;
                LoginPage = Client.GetStringAsync("bet/login").Result;
                LoginPage = LoginPage.Substring(LoginPage.IndexOf("<input type=\"hidden\" name=\"_csrf\" value=\"") + "<input type=\"hidden\" name=\"_csrf\" value=\"".Length);
                string csrf = LoginPage.Substring(0, LoginPage.IndexOf("\""));


                List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
                pairs.Add(new KeyValuePair <string, string>("_csrf", csrf));
                pairs.Add(new KeyValuePair <string, string>("client_id", "0"));
                pairs.Add(new KeyValuePair <string, string>("fingerprint", ""));
                pairs.Add(new KeyValuePair <string, string>("loginvia", Username.Contains("@")?"email": "username"));
                pairs.Add(new KeyValuePair <string, string>("password", Password));
                pairs.Add(new KeyValuePair <string, string>("redirect_uri", "https://betking.io/bet"));
                pairs.Add(new KeyValuePair <string, string>("twoFactorCode", twofa));
                pairs.Add(new KeyValuePair <string, string>("username", Username));
                FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                HttpResponseMessage   RespMsg = Client.PostAsync("bet/login", Content).Result;
                string responseUri            = RespMsg.RequestMessage.RequestUri.ToString();
                string sEmitResponse          = RespMsg.Content.ReadAsStringAsync().Result;

                if (!sEmitResponse.ToLower().Contains("error"))
                {
                    RespMsg       = Client.GetAsync(RespMsg.Headers.Location.OriginalString).Result;
                    sEmitResponse = RespMsg.Content.ReadAsStringAsync().Result;
                    if (RespMsg.Headers.Location != null)
                    {
                        accesstoken = RespMsg.Headers.Location.OriginalString;
                        accesstoken = accesstoken.Substring(accesstoken.IndexOf("=") + 1);
                        accesstoken = accesstoken.Substring(0, accesstoken.IndexOf("&"));
                        Client.DefaultRequestHeaders.Add("authorization", "Bearer " + accesstoken);
                        while (RespMsg.Headers.Location != null)
                        {
                            RespMsg = Client.GetAsync(RespMsg.Headers.Location.OriginalString).Result;
                        }
                    }
                    string r = Client.GetStringAsync("https://betking.io/bet/dice").Result;
                    sEmitResponse = Client.GetStringAsync("https://api.betking.io/api/stats/gethousestats?appId=0").Result;
                    sEmitResponse = Client.GetStringAsync("https://betking.io/bet/api/account/current-profile").Result;

                    this.username = Username;
                    if (ConnectSocket())
                    {
                        lastupdate = DateTime.Now;
                        ispd       = true;
                        new Thread(new ThreadStart(GetBlanaceThread)).Start();
                        GetBalance();
                        GetStats();
                        finishedlogin(true);
                    }
                    else
                    {
                        finishedlogin(false);
                    }
                    return;
                }
            }
            catch (Exception e)
            {
                Parent.DumpLog(e.ToString(), 0);
                finishedlogin(false);
                return;
            }
            finishedlogin(false);
        }