예제 #1
0
        public override void Login(string Username, string Password, string otp)
        {
            //accept-encoding:gzip, deflate,
            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://bitvest.io/")
            };
            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", "DiceBot");
            try
            {
                string resp = "";// Client.GetStringAsync("").Result;
                List <KeyValuePair <string, string> > pairs = new List <KeyValuePair <string, string> >();
                pairs.Add(new KeyValuePair <string, string>("type", "secret"));
                FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
                resp = Client.PostAsync("https://bitvest.io/login.php", Content).Result.Content.ReadAsStringAsync().Result;
                bitvestLoginBase tmpblogin = json.JsonDeserialize <bitvestLoginBase>(resp.Replace("-", "_"));
                bitvestLogin     tmplogin  = tmpblogin.data;
                secret = tmpblogin.account.secret;
                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"));
                Content = new FormUrlEncodedContent(pairs);
                resp    = Client.PostAsync("https://bitvest.io/update.php", Content).Result.Content.ReadAsStringAsync().Result;

                string tmpresp = resp.Replace("-", "_");
                tmpblogin = json.JsonDeserialize <bitvestLoginBase>(tmpresp);
                tmplogin  = tmpblogin.data;
                if (tmplogin.session_token != null)
                {
                    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>("tfa", otp));
                    pairs.Add(new KeyValuePair <string, string>("token", tmplogin.session_token));
                    //pairs.Add(new KeyValuePair<string, string>("c", "secret"));
                    pairs.Add(new KeyValuePair <string, string>("secret", secret));
                    Content   = new FormUrlEncodedContent(pairs);
                    resp      = Client.PostAsync("https://bitvest.io/login.php", Content).Result.Content.ReadAsStringAsync().Result;
                    tmpresp   = resp.Replace("-", "_");
                    tmpblogin = json.JsonDeserialize <bitvestLoginBase>(tmpresp);
                    Weights   = tmpblogin.currency_weight;
                    Limits    = tmpblogin.rate_limits;

                    tmplogin = tmpblogin.data;
                    if (Currency.ToLower() == "bitcoins")
                    {
                        balance = decimal.Parse(tmplogin.balance, System.Globalization.NumberFormatInfo.InvariantInfo);
                    }
                    else if (Currency.ToLower() == "ethers")
                    {
                        balance = decimal.Parse(tmplogin.balance_ether, System.Globalization.NumberFormatInfo.InvariantInfo);
                    }
                    else if (Currency.ToLower() == "litecoins")
                    {
                        balance = decimal.Parse(tmplogin.balance_litecoin, System.Globalization.NumberFormatInfo.InvariantInfo);
                    }
                    else if (Currency.ToLower() == "dogecoins")
                    {
                        balance = decimal.Parse(tmplogin.balance_dogecoin, System.Globalization.NumberFormatInfo.InvariantInfo);
                    }
                    else if (Currency.ToLower() == "bcash")
                    {
                        balance = decimal.Parse(tmplogin.balance_bcash, System.Globalization.NumberFormatInfo.InvariantInfo);
                    }
                    else
                    {
                        balance = decimal.Parse(tmplogin.token_balance, System.Globalization.NumberFormatInfo.InvariantInfo);
                    }
                    accesstoken = tmplogin.session_token;
                    secret      = tmpblogin.account.secret;
                    wagered     = decimal.Parse(tmplogin.self_total_bet_dice, System.Globalization.NumberFormatInfo.InvariantInfo);
                    profit      = decimal.Parse(tmplogin.self_total_won_dice, System.Globalization.NumberFormatInfo.InvariantInfo);
                    bets        = int.Parse(tmplogin.self_total_bets_dice.Replace(",", ""), System.Globalization.NumberFormatInfo.InvariantInfo);
                    wins        = 0;
                    losses      = 0;
                    Parent.updateBalance(balance);
                    Parent.updateWagered(wagered);
                    Parent.updateProfit(profit);
                    Parent.updateBets(bets);
                    Parent.updateWins(wins);
                    Parent.updateLosses(losses);
                    //Parent.updateDeposit(tmpblogin.account.address);
                    lastupdate = DateTime.Now;
                    seed       = tmpblogin.last_user_seed;
                    ispd       = true;
                    pw         = Password;
                    new Thread(new ThreadStart(GetBalanceThread)).Start();
                    lasthash = tmpblogin.server_hash;
                    this.Tip = tmpblogin.tip.enabled;
                    finishedlogin(true);
                    return;
                }
                else
                {
                    finishedlogin(false);
                    return;
                }
            }
            catch (AggregateException e)
            {
                finishedlogin(false);
                return;
            }
            catch (Exception e)
            {
                finishedlogin(false);
                return;
            }
            finishedlogin(false);
        }
예제 #2
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://bitvest.io")
            };
            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>("r", "46534"));

                FormUrlEncodedContent Content  = new FormUrlEncodedContent(pairs);
                string           sEmitResponse = Client.PostAsync("create.php", Content).Result.Content.ReadAsStringAsync().Result;
                bitvestLoginBase tmpbase       = json.JsonDeserialize <bitvestLoginBase>(sEmitResponse.Replace("-", "_"));
                accesstoken = tmpbase.data.session_token;
                secret      = tmpbase.account.secret;

                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"));

                Content       = new FormUrlEncodedContent(pairs);
                sEmitResponse = Client.PostAsync("https://bitvest.io/update.php", Content).Result.Content.ReadAsStringAsync().Result;


                tmpbase     = json.JsonDeserialize <bitvestLoginBase>(sEmitResponse.Replace("-", "_"));
                accesstoken = tmpbase.data.session_token;
                //tmplogin = tmpblogin.data;

                pairs = new List <KeyValuePair <string, string> >();
                pairs.Add(new KeyValuePair <string, string>("act", "convert"));
                pairs.Add(new KeyValuePair <string, string>("c", "9999999"));
                pairs.Add(new KeyValuePair <string, string>("password", Password));
                pairs.Add(new KeyValuePair <string, string>("password_conf", Password));
                pairs.Add(new KeyValuePair <string, string>("secret", secret));
                pairs.Add(new KeyValuePair <string, string>("token", accesstoken));
                pairs.Add(new KeyValuePair <string, string>("username", Username));
                Content       = new FormUrlEncodedContent(pairs);
                sEmitResponse = Client.PostAsync("action.php", Content).Result.Content.ReadAsStringAsync().Result;
                tmpbase       = json.JsonDeserialize <bitvestLoginBase>(sEmitResponse);
                if (!tmpbase.success)
                {
                    Parent.updateStatus(tmpbase.msg);
                    finishedlogin(false);
                    return(false);
                }
                accesstoken = tmpbase.data.session_token;
                secret      = tmpbase.account.secret;
                if (accesstoken == "")
                {
                    return(false);
                }
                else
                {
                    bitvestLoginBase tmpblogin = tmpbase;
                    bitvestLogin     tmplogin  = tmpblogin.data;
                    if (Currency.ToLower() == "bitcoins")
                    {
                        balance = decimal.Parse(tmplogin.balance, System.Globalization.NumberFormatInfo.InvariantInfo);
                    }
                    else if (Currency.ToLower() == "ethers")
                    {
                        balance = decimal.Parse(tmplogin.balance_ether, System.Globalization.NumberFormatInfo.InvariantInfo);
                    }
                    else if (Currency.ToLower() == "litecoins")
                    {
                        balance = decimal.Parse(tmplogin.balance_litecoin, System.Globalization.NumberFormatInfo.InvariantInfo);
                    }
                    else
                    {
                        balance = decimal.Parse(tmplogin.token_balance, System.Globalization.NumberFormatInfo.InvariantInfo);
                    }
                    accesstoken = tmplogin.session_token;
                    secret      = tmpblogin.account.secret;
                    wagered     = (decimal)(Currency.ToLower() == "bitcoins"? tmplogin.total_bet:
                                            Currency.ToLower() == "ethers" ? tmplogin.ether_total_bet :
                                            Currency.ToLower() == "litecoins" ? tmplogin.litecoin_total_bet :
                                            tmplogin.token_total_bet);
                    profit = (decimal)(Currency.ToLower() == "bitcoins" ? tmplogin.total_profit :
                                       Currency.ToLower() == "ethers" ? tmplogin.ether_total_profit :
                                       Currency.ToLower() == "litecoins" ? tmplogin.litecoin_total_profit :
                                       tmplogin.token_total_bet);
                    bets   = tmplogin.bets;
                    wins   = 0;
                    losses = 0;
                    Parent.updateBalance(balance);
                    Parent.updateWagered(wagered);
                    Parent.updateProfit(profit);
                    Parent.updateBets(bets);
                    Parent.updateWins(wins);
                    Parent.updateLosses(losses);
                    Parent.updateDeposit(tmpblogin.account.address);
                    lastupdate = DateTime.Now;
                    ispd       = true;
                    pw         = Password;
                    new Thread(new ThreadStart(GetBalanceThread)).Start();
                    lasthash = tmpblogin.server_hash;
                    this.Tip = false;
                    finishedlogin(true);
                    return(true);
                }
            }
            catch (Exception e)
            {
                Parent.updateStatus(e.Message);
                finishedlogin(false); return(false);
            }

            return(false);
        }