private void bttn_listar_cliente_Click(object sender, EventArgs e) { try { ListarCliente TelaListarCliente = new ListarCliente(Convert.ToInt32(tb_listar_cliente_cod.Text)); TelaListarCliente.Show(); } catch (Exception ERR) { MessageBox.Show(ERR.ToString(), "ERRO DE ENTRADA"); } }
public override void Login(string Username, string Password, string twofa) { 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; ConnectSocket(); if (WSClient.State == WebSocketState.Open) { Parent.DumpLog("BE login 7.1", 7); ispd = true; lastupdate = DateTime.Now; ForceUpdateStats = false; 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; }
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; }
protected override void _Login(LoginParamValue[] LoginParams) { ClientHandlr = new HttpClientHandler { UseCookies = true, CookieContainer = cookies, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip }; 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"); Logger.DumpLog("BE login 1", 8); string APIKey = ""; foreach (LoginParamValue x in LoginParams) { if (x.Param.Name.ToLower() == "api key") { APIKey = x.Value; } } try { accesstoken = APIKey; LoginStarted = true; LoginTime = DateTime.Now; LoginTimer.Enabled = true; ConnectSocket(); if (WSClient.State == WebSocketState.Open) { Logger.DumpLog("BE login 7.1", 7); ispd = true; lastupdate = DateTime.Now; //ForceUpdateStats = true; new Thread(new ThreadStart(GetBalanceThread)).Start(); //callLoginFinished(true); return; } else { Logger.DumpLog("BE login 7.2", 7); callLoginFinished(false); return; } } catch (AggregateException ER) { Logger.DumpLog(ER.ToString(), -1); callLoginFinished(false); return; } catch (Exception ERR) { Logger.DumpLog(ERR.ToString(), -1); callLoginFinished(false); return; } callLoginFinished(false); return; }