Beispiel #1
0
        public override bool Register(string username, string password)
        {
            ClientHandlr = new HttpClientHandler {
                UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null
            };
            Client = new HttpClient(ClientHandlr)
            {
                BaseAddress = new Uri("https://kingdice.com/api/")
            };
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
            Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
            try
            {
                List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
                pairs.Add(new KeyValuePair <string, string>("username", username));
                pairs.Add(new KeyValuePair <string, string>("aff", "221"));

                FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                string sEmitResponse          = Client.PostAsync("register.php", Content).Result.Content.ReadAsStringAsync().Result;

                KDLogin tmplogin = json.JsonDeserialize <KDLogin>(sEmitResponse);
                if (tmplogin.code == "SUCCESS")
                {
                    accesstoken = tmplogin.token;
                    pairs       = new List <KeyValuePair <string, string> >();
                    pairs.Add(new KeyValuePair <string, string>("token", accesstoken));
                    Content       = new FormUrlEncodedContent(pairs);
                    sEmitResponse = Client.PostAsync("logged.php", Content).Result.Content.ReadAsStringAsync().Result;
                    //sEmitResponse2 = Client.GetStringAsync("logged.php").Result;
                    KDLoggedIn tmpStats = json.JsonDeserialize <KDLoggedIn>(sEmitResponse);
                    if (tmpStats.code == "SUCCESS")
                    {
                        pairs = new List <KeyValuePair <string, string> >();
                        pairs.Add(new KeyValuePair <string, string>("pass", password));
                        pairs.Add(new KeyValuePair <string, string>("token", accesstoken));
                        Content       = new FormUrlEncodedContent(pairs);
                        sEmitResponse = Client.PostAsync("setpass.php", Content).Result.Content.ReadAsStringAsync().Result;
                        KDLoggedIn tmpStats2 = json.JsonDeserialize <KDLoggedIn>(sEmitResponse);
                        if (tmpStats2.code == "SUCCESS")
                        {
                            balance = tmpStats.balance / 100000000m;
                            if (tmpStats.address != null)
                            {
                                Parent.updateDeposit(tmpStats.address);
                            }
                            pairs = new List <KeyValuePair <string, string> >();
                            pairs.Add(new KeyValuePair <string, string>("token", accesstoken));
                            Content       = new FormUrlEncodedContent(pairs);
                            sEmitResponse = Client.PostAsync("nextroll.php", Content).Result.Content.ReadAsStringAsync().Result;
                            KDNextRoll tmphash = json.JsonDeserialize <KDNextRoll>(sEmitResponse);
                            if (tmphash.code == "SUCCESS")
                            {
                                LastHash = tmphash.round_hash;

                                iskd = true;
                                Thread t = new Thread(GetBalanceThread);
                                finishedlogin(true);
                                return(true);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Parent.DumpLog(e.ToString(), 1);
            }
            finishedlogin(false);
            return(false);
        }
Beispiel #2
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://kingdice.com/api/")
            };
            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");
            Client.DefaultRequestHeaders.Add("Host", "kingdice.com");
            Client.DefaultRequestHeaders.Add("Origin", "https://kingdice.com");
            Client.DefaultRequestHeaders.Add("Referer", "https://kingdice.com");

            try
            {
                this.username = Username;
                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>("sdb", "8043d46408307f3ac9d14931ba27c9015349bf21b7b7"));
                pairs.Add(new KeyValuePair <string, string>("2facode", twofa /*==""?"undefined":twofa*/));
                FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                string sEmitResponse          = Client.PostAsync("login.php", Content).Result.Content.ReadAsStringAsync().Result;

                KDLogin tmplogin = json.JsonDeserialize <KDLogin>(sEmitResponse);
                if (tmplogin.code == "SUCCESS")
                {
                    accesstoken = tmplogin.token;
                    pairs       = new List <KeyValuePair <string, string> >();
                    pairs.Add(new KeyValuePair <string, string>("token", accesstoken));
                    Content       = new FormUrlEncodedContent(pairs);
                    sEmitResponse = Client.PostAsync("logged.php", Content).Result.Content.ReadAsStringAsync().Result;
                    //sEmitResponse2 = Client.GetStringAsync("logged.php").Result;
                    KDLoggedIn tmpStats = json.JsonDeserialize <KDLoggedIn>(sEmitResponse);
                    if (tmpStats.code == "SUCCESS")
                    {
                        balance = tmpStats.balance / 100000000m;
                        if (tmpStats.address != null)
                        {
                            Parent.updateDeposit(tmpStats.address);
                        }
                        pairs = new List <KeyValuePair <string, string> >();
                        pairs.Add(new KeyValuePair <string, string>("token", accesstoken));
                        Content       = new FormUrlEncodedContent(pairs);
                        sEmitResponse = Client.PostAsync("nextroll.php", Content).Result.Content.ReadAsStringAsync().Result;
                        KDNextRoll tmphash = json.JsonDeserialize <KDNextRoll>(sEmitResponse);
                        if (tmphash.code == "SUCCESS")
                        {
                            LastHash = tmphash.round_hash;
                            pairs    = new List <KeyValuePair <string, string> >();
                            pairs.Add(new KeyValuePair <string, string>("username", username));
                            pairs.Add(new KeyValuePair <string, string>("token", accesstoken));
                            Content       = new FormUrlEncodedContent(pairs);
                            sEmitResponse = Client.PostAsync("stats/profile.php", Content).Result.Content.ReadAsStringAsync().Result;
                            KDStat tmpstats = json.JsonDeserialize <KDStat>(sEmitResponse);
                            wagered = tmpstats.wagered / 100000000m;
                            profit  = tmpstats.profit / 100000000m;
                            bets    = (int)tmpstats.rolls;
                            Parent.updateBets(bets);
                            Parent.updateProfit(profit);
                            Parent.updateWagered(wagered);
                            iskd = true;
                            Thread t = new Thread(GetBalanceThread);
                            t.Start();
                            Parent.updateBalance(balance);
                            finishedlogin(true);
                            return;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Parent.DumpLog(e.ToString(), 1);
            }
            finishedlogin(false);
        }