Ejemplo n.º 1
0
 protected override void _UpdateStats()
 {
     try
     {
         lastupdate = DateTime.Now;
         string       s     = Client.GetStringAsync("https://freebitco.in/cgi-bin/api.pl?op=get_user_stats").Result;
         FreebtcStats stats = json.JsonDeserialize <FreebtcStats>(s);
         if (stats != null)
         {
             Stats.Balance = stats.balance / 100000000m;
             Stats.Bets    = (int)stats.rolls_played;
             //wins = losses = 0;
             Stats.Profit  = stats.dice_profit / 100000000m;
             Stats.Wagered = stats.wagered / 100000000m;
         }
     }
     catch (Exception e)
     {
         Logger.DumpLog(e);
     }
 }
Ejemplo n.º 2
0
        protected override void _Login(LoginParamValue[] LoginParams)
        {
            string Username = "";
            string Password = "";
            string otp      = "";

            foreach (LoginParamValue x in LoginParams)
            {
                if (x.Param.Name.ToLower() == "username")
                {
                    Username = x.Value;
                }
                if (x.Param.Name.ToLower() == "password")
                {
                    Password = x.Value;
                }
                if (x.Param.Name.ToLower() == "2fa code")
                {
                    otp = x.Value;
                }
            }
            ClientHandlr = new HttpClientHandler {
                UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip
            };
            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(() =>
                        {
                            callNotify("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", otp));
                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)
                        {
                            Stats.Balance = stats.balance / 100000000m;
                            Stats.Bets    = (int)stats.rolls_played;
                            Stats.Wins    = Stats.Losses = 0;
                            Stats.Profit  = stats.dice_profit / 100000000m;
                            Stats.Wagered = stats.wagered / 100000000m;

                            lastupdate = DateTime.Now;
                            ispd       = true;
                            Thread t = new Thread(GetBalanceThread);
                            t.Start();
                            callLoginFinished(true);
                            return;
                        }
                        callLoginFinished(false);
                        return;
                    }
                    callLoginFinished(false);
                    return;
                }


                //Lastbet = DateTime.Now;
            }
            catch (Exception e)
            {
                Logger.DumpLog(e.ToString(), 1);
            }
            callLoginFinished(false);
            return;
        }