public override void Login(string Username, string Password, string twofa) { try { this.username = Username; Token = Password; Key = twofa; var cookies = new CookieContainer(); string csrftoken = ""; HttpWebRequest getHeaders = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/ref/8c4"); if (Prox != null) { getHeaders.Proxy = Prox; } //var cookies = new CookieContainer(); getHeaders.CookieContainer = cookies; try { HttpWebResponse Response = (HttpWebResponse)getHeaders.GetResponse(); string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd(); foreach (Cookie C in Response.Cookies) { cookies.Add(C); } s1 = s1.Substring(s1.IndexOf("<input name=\"_token\" type=\"hidden\"")); s1 = s1.Substring("<input name=\"_token\" type=\"hidden\" value=\"".Length); csrftoken = s1.Substring(0, s1.IndexOf("\"")); } catch { finishedlogin(false); return; } /* * HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/login"); * if (Prox != null) * betrequest.Proxy = Prox; * betrequest.CookieContainer = cookies; * * betrequest.Method = "POST"; * * string post = string.Format("username={0}&password={1}&code={2}", Username, Password, twofa); * betrequest.ContentLength = post.Length; * betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; * betrequest.Headers.Add("X-API-KEY", Token); * using (var writer = new StreamWriter(betrequest.GetRequestStream())) * { * * writer.Write(post); * } * HttpWebResponse EmitResponse = (HttpWebResponse)betrequest.GetResponse(); * string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); * if (!sEmitResponse.ToLower().Contains("true")) * { * finishedlogin(false); * return; * } * this.Cookies = cookies; * HttpWebRequest betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/info?username="******"X-CSRF-Token", Token); * HttpWebResponse EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse(); * string sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd(); * RollinLoginStats tmpStats = json.JsonDeserialize<RollinLoginStats>(sEmitResponse2); * * //https://rollin.io/api/customer/sync * betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/sync"); * if (Prox != null) * betrequest2.Proxy = Prox; * betrequest2.CookieContainer = cookies; * betrequest2.Headers.Add("X-CSRF-Token", Token); * EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse(); * */ ClientHandlr = new HttpClientHandler { UseCookies = true, CookieContainer = cookies, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null };; Client = new HttpClient(ClientHandlr) { BaseAddress = new Uri("https://rollin.io/api/") }; Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip")); Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate")); ClientHandlr.CookieContainer = this.Cookies; Client.DefaultRequestHeaders.Add("Origin", "https://rollin.com"); Client.DefaultRequestHeaders.Add("X-API-Key", Token); Client.DefaultRequestHeaders.Add("X-CSRF-Token", csrftoken); /*finishedlogin(true); * return;*/ Client.DefaultRequestHeaders.Remove("X-API-Nonce"); Client.DefaultRequestHeaders.Add("X-API-Nonce", mfagenerator.GetCode(Key)); string sEmitResponse2 = Client.GetStringAsync("customer/info?username="******"X-API-Nonce"); Client.DefaultRequestHeaders.Add("X-API-Nonce", mfagenerator.GetCode(Key)); sEmitResponse2 = Client.GetStringAsync("customer/sync").Result; RollinBet tmpStats2 = json.JsonDeserialize <RollinBet>(sEmitResponse2); if (tmpStats.success && tmpStats2.success) { /*ClientHandlr = new HttpClientHandler { UseCookies = true, AutomaticDecompression= DecompressionMethods.Deflate| DecompressionMethods.GZip, Proxy= this.Prox, UseProxy=Prox!=null };; * Client = new HttpClient(ClientHandlr) { BaseAddress = new Uri("https://rollin.io/api/") };*/ GetDeposit(); balance = decimal.Parse(tmpStats2.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m; //i assume bets = tmpStats.user.bets; profit = decimal.Parse(tmpStats.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m; Parent.updateBalance((decimal)(balance)); Parent.updateBets(tmpStats.user.bets); Parent.updateLosses(tmpStats.user.losses); Parent.updateProfit(decimal.Parse(tmpStats.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m); Parent.updateWagered(decimal.Parse(tmpStats.user.wagered, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m); Parent.updateWins(tmpStats.user.wins); isRollin = true; Thread t = new Thread(new ThreadStart(SyncThread)); t.Start(); finishedlogin(true); return; } } catch (WebException e) { string s = new StreamReader(e.Response.GetResponseStream()).ReadToEnd(); } catch (Exception e) { } finishedlogin(false); }
public override bool Register(string username, string password) { this.username = username; HttpWebRequest getHeaders = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/ref/8c4"); if (Prox != null) { getHeaders.Proxy = Prox; } var cookies = new CookieContainer(); getHeaders.CookieContainer = cookies; try { HttpWebResponse Response = (HttpWebResponse)getHeaders.GetResponse(); string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd(); foreach (Cookie C in Response.Cookies) { cookies.Add(C); } s1 = s1.Substring(s1.IndexOf("<input name=\"_token\" type=\"hidden\"")); s1 = s1.Substring("<input name=\"_token\" type=\"hidden\" value=\"".Length); Token = s1.Substring(0, s1.IndexOf("\"")); } catch { finishedlogin(false); return(false); } HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/settings/username"); if (Prox != null) { betrequest.Proxy = Prox; } betrequest.CookieContainer = cookies; betrequest.Method = "POST"; string post = string.Format("username={0}", username); betrequest.ContentLength = post.Length; betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; betrequest.Headers.Add("X-CSRF-Token", Token); using (var writer = new StreamWriter(betrequest.GetRequestStream())) { writer.Write(post); } HttpWebResponse EmitResponse = (HttpWebResponse)betrequest.GetResponse(); string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); betrequest = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/settings/password"); if (Prox != null) { betrequest.Proxy = Prox; } betrequest.CookieContainer = cookies; betrequest.Method = "POST"; post = string.Format("old=&new={0}&confirm={0}", password); betrequest.ContentLength = post.Length; betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; betrequest.Headers.Add("X-CSRF-Token", Token); using (var writer = new StreamWriter(betrequest.GetRequestStream())) { writer.Write(post); } EmitResponse = (HttpWebResponse)betrequest.GetResponse(); sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); HttpWebRequest betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/info?username="******"X-CSRF-Token", Token); HttpWebResponse EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse(); string sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd(); RollinLoginStats tmpStats = json.JsonDeserialize <RollinLoginStats>(sEmitResponse2); //https://rollin.io/api/customer/sync betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/sync"); if (Prox != null) { betrequest2.Proxy = Prox; } betrequest2.CookieContainer = cookies; betrequest2.Headers.Add("X-CSRF-Token", Token); EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse(); sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd(); RollinBet tmpStats2 = json.JsonDeserialize <RollinBet>(sEmitResponse2); if (tmpStats.success && tmpStats2.success) { ClientHandlr = new HttpClientHandler { UseCookies = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = this.Prox, UseProxy = Prox != null };; Client = new HttpClient(ClientHandlr) { BaseAddress = new Uri("https://rollin.io/api/") }; Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip")); Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate")); ClientHandlr.CookieContainer = this.Cookies; Client.DefaultRequestHeaders.Add("X-CSRF-Token", Token); GetDeposit(); balance = decimal.Parse(tmpStats2.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m; //i assume bets = tmpStats.user.bets; profit = decimal.Parse(tmpStats.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m; Parent.updateBalance((decimal)(balance)); Parent.updateBets(tmpStats.user.bets); Parent.updateLosses(tmpStats.user.losses); Parent.updateProfit(decimal.Parse(tmpStats.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m); Parent.updateWagered(decimal.Parse(tmpStats.user.wagered, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0m); Parent.updateWins(tmpStats.user.wins); isRollin = true; Thread t = new Thread(new ThreadStart(SyncThread)); t.Start(); finishedlogin(true); return(true); } finishedlogin(false); return(false); }
public override void Login(string Username, string Password, string twofa) { try { this.username = Username; HttpWebRequest getHeaders = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/ref/8c4"); if (Prox != null) { getHeaders.Proxy = Prox; } var cookies = new CookieContainer(); getHeaders.CookieContainer = cookies; try { HttpWebResponse Response = (HttpWebResponse)getHeaders.GetResponse(); string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd(); foreach (Cookie C in Response.Cookies) { cookies.Add(C); } s1 = s1.Substring(s1.IndexOf("<input name=\"_token\" type=\"hidden\"")); s1 = s1.Substring("<input name=\"_token\" type=\"hidden\" value=\"".Length); Token = s1.Substring(0, s1.IndexOf("\"")); } catch { finishedlogin(false); return; } HttpWebRequest betrequest = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/login"); if (Prox != null) { betrequest.Proxy = Prox; } betrequest.CookieContainer = cookies; betrequest.Method = "POST"; string post = string.Format("username={0}&password={1}&code={2}", Username, Password, twofa); betrequest.ContentLength = post.Length; betrequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; betrequest.Headers.Add("X-CSRF-Token", Token); using (var writer = new StreamWriter(betrequest.GetRequestStream())) { writer.Write(post); } HttpWebResponse EmitResponse = (HttpWebResponse)betrequest.GetResponse(); string sEmitResponse = new StreamReader(EmitResponse.GetResponseStream()).ReadToEnd(); if (!sEmitResponse.ToLower().Contains("true")) { finishedlogin(false); return; } this.Cookies = cookies; HttpWebRequest betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/info?username="******"X-CSRF-Token", Token); HttpWebResponse EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse(); string sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd(); RollinLoginStats tmpStats = json.JsonDeserialize <RollinLoginStats>(sEmitResponse2); //https://rollin.io/api/customer/sync betrequest2 = (HttpWebRequest)HttpWebRequest.Create("https://rollin.io/api/customer/sync"); if (Prox != null) { betrequest2.Proxy = Prox; } betrequest2.CookieContainer = cookies; betrequest2.Headers.Add("X-CSRF-Token", Token); EmitResponse2 = (HttpWebResponse)betrequest2.GetResponse(); sEmitResponse2 = new StreamReader(EmitResponse2.GetResponseStream()).ReadToEnd(); RollinBet tmpStats2 = json.JsonDeserialize <RollinBet>(sEmitResponse2); if (tmpStats.success && tmpStats2.success) { GetDeposit(); balance = double.Parse(tmpStats2.customer.balance, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0; //i assume bets = tmpStats.user.bets; profit = double.Parse(tmpStats.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0; Parent.updateBalance((decimal)(balance)); Parent.updateBets(tmpStats.user.bets); Parent.updateLosses(tmpStats.user.losses); Parent.updateProfit(double.Parse(tmpStats.user.profit, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0); Parent.updateWagered(double.Parse(tmpStats.user.wagered, System.Globalization.NumberFormatInfo.InvariantInfo) / 1000.0); Parent.updateWins(tmpStats.user.wins); finishedlogin(true); return; } } catch { } finishedlogin(false); }