private void GenerateLink() { // helper function to clean up code // MakeURL() returns the Adfly API url string url = MakeURL(); try { // create a new HttpWebRequest for the Adfly url HttpWebRequest wRequest = (HttpWebRequest)HttpWebRequest.Create(url); HttpWebResponse wResponse = (HttpWebResponse)wRequest.GetResponse(); // read the response string sResult = new StreamReader(wResponse.GetResponseStream()).ReadToEnd(); // check for error if (sResult.ToLower() != "error") { // update status and display the adfly link UpdateStatus("Link generated", sResult.Trim()); } else UpdateStatus("Error"); } catch (Exception ex) { // display any errors and set the status MessageBox.Show(ex.Message); UpdateStatus("Error"); } }
public override void Login(string Username, string Password, string twofa) { HttpWebRequest getHeaders = HttpWebRequest.Create("https://pocketrocketscasino.eu/play/#dice") as HttpWebRequest; if (Prox != null) getHeaders.Proxy = Prox; var cookies = new CookieContainer(); getHeaders.CookieContainer = cookies; HttpWebResponse Response = null; string rqtoken = ""; try { Response = (HttpWebResponse)getHeaders.GetResponse(); string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd(); string tmp = s1.Substring(s1.IndexOf("__RequestVerificationToken")+"__RequestVerificationToken\" type=\"hidden\" value=\"".Length); s = rqtoken = tmp.Substring(0, tmp.IndexOf("\"")); } catch (WebException e) { System.Windows.Forms.MessageBox.Show("Failed to log in. Please check your username and password."); finishedlogin(false); } getHeaders = HttpWebRequest.Create("https://pocketrocketscasino.eu/account/login") as HttpWebRequest; if (Prox != null) getHeaders.Proxy = Prox; getHeaders.CookieContainer = new CookieContainer(); foreach (Cookie c in Response.Cookies) { getHeaders.CookieContainer.Add(c); } getHeaders.Method = "POST"; string post = string.Format("userName={0}&password={1}&twoFactorCode={2}&__RequestVerificationToken={3}", Username, Password, twofa, rqtoken); getHeaders.ContentType = "application/x-www-form-urlencoded"; getHeaders.ContentLength = post.Length; using (var writer = new StreamWriter(getHeaders.GetRequestStream())) { string writestring = post as string; writer.Write(writestring); } try { Response = (HttpWebResponse)getHeaders.GetResponse(); string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd(); if (!s1.ToLower().Contains("success")) { System.Windows.Forms.MessageBox.Show("Failed to log in. Please check your username and password."); finishedlogin(false); } /*string tmp = s1.Substring(s1.IndexOf("__RequestVerificationToken") + "__RequestVerificationToken\" type=\"hidden\" value=\"".Length); rqtoken = tmp.Substring(0, tmp.IndexOf("\""));*/ } catch (WebException e) { Response = (HttpWebResponse)e.Response; string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd(); System.Windows.Forms.MessageBox.Show("Failed to log in. Please check your username and password."); finishedlogin(false); } foreach (Cookie c in Response.Cookies) { if (c.Name == "__RequestVerificationToken") rqtoken = c.Value; Cookies.Add(c); } Cookies.Add((new Cookie("PRC_Affiliate", "357", "/", "pocketrocketscasino.eu"))); con.CookieContainer = Cookies; try { getHeaders = HttpWebRequest.Create("https://pocketrocketscasino.eu/play/#dice") as HttpWebRequest; if (Prox != null) getHeaders.Proxy = Prox; getHeaders.CookieContainer = Cookies; Response = (HttpWebResponse)getHeaders.GetResponse(); string stmp = new StreamReader(Response.GetResponseStream()).ReadToEnd(); string sstmp = stmp.Substring(stmp.IndexOf("__RequestVerificationToken") + "__RequestVerificationToken\" type=\"hidden\" value=\"".Length); s = rqtoken = sstmp.Substring(0, sstmp.IndexOf("\"")); dicehub = con.CreateHubProxy("diceHub"); con.Start().Wait(); dicehub.Invoke("joinChatRoom", 1); dicehub.On<string, string, string, int, int, bool>("chat", ReceivedChat); dicehub.On<string, string, string, int, bool>("receivePrivateMesssage", ReceivedChat); getHeaders = HttpWebRequest.Create("https://pocketrocketscasino.eu/account/GetUserAccount") as HttpWebRequest; if (Prox != null) getHeaders.Proxy = Prox; getHeaders.CookieContainer = Cookies; Response = (HttpWebResponse)getHeaders.GetResponse(); string s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd(); PRCUser tmp = json.JsonDeserialize<PRCUser>(s1); balance = (double)tmp.AvailableBalance; profit = (double)tmp.Profit; wagered = (double)tmp.Wagered; bets = (int)tmp.NumBets; wins = (int)tmp.Wins; losses = (int)tmp.Losses; UserID = tmp.Id; Parent.updateBalance((decimal)(balance)); Parent.updateBets(tmp.NumBets); Parent.updateLosses(tmp.Losses); Parent.updateProfit(profit); Parent.updateWagered(wagered); Parent.updateWins(tmp.Wins); //Parent.updateDeposit(tmp.DepositAddress); getHeaders = HttpWebRequest.Create("https://pocketrocketscasino.eu/account/GetCurrentSeed") as HttpWebRequest; if (Prox != null) getHeaders.Proxy = Prox; getHeaders.CookieContainer = Cookies; Response = (HttpWebResponse)getHeaders.GetResponse(); s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd(); prcSeed getseed = json.JsonDeserialize<prcSeed>(s1); client = getseed.ClientSeed; serverhash = getseed.ServerHash; getHeaders = HttpWebRequest.Create("https://pocketrocketscasino.eu/account/getDepositAddress") as HttpWebRequest; if (Prox != null) getHeaders.Proxy = Prox; getHeaders.CookieContainer = Cookies; Response = (HttpWebResponse)getHeaders.GetResponse(); s1 = new StreamReader(Response.GetResponseStream()).ReadToEnd(); PRCDepost dep = json.JsonDeserialize<PRCDepost>(s1); Parent.updateDeposit(dep.Address); finishedlogin(true); } catch { } }
public static string GetRealIP() { string str3; string requestUriString = "http://checkrealip.com"; try { str3 = new StreamReader(WebRequest.Create(requestUriString).GetResponse().GetResponseStream(), true).ReadToEnd(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; ProjectData.ClearProjectError(); return ""; } str3 = str3.ToLower(); int index = str3.IndexOf("address:"); if (index == -1) { return ""; } str3 = str3.Substring(index + 8); index = str3.IndexOf("\r\n"); if (index == -1) { return ""; } return str3.Substring(0, index); }
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) { ClientHandlr = new HttpClientHandler { UseCookies = true }; Client = new HttpClient(ClientHandlr) { BaseAddress = new Uri("https://rollin.io/api/") }; ClientHandlr.CookieContainer = this.Cookies; Client.DefaultRequestHeaders.Add("X-CSRF-Token", Token); 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); }
public DeliveryStatusResponse GetDeliveryStatus(Guid transactionId) { var response = new DeliveryStatusResponse(); try { var requestString = "https://api.elasticemail.com/mailer/status/" + transactionId + "?showstats=true"; var request = WebRequest.Create(requestString); Stream stream = new RetryLogic(_configuration.PreferredRetryStrategy).Execute(() => request.GetResponse().GetResponseStream()); var xmlString = new StreamReader(stream, Encoding.UTF8).ReadToEnd(); if (xmlString.ToLower().StartsWith("no job with transactionid")) { response.ErrorMessage = xmlString; response.ResultType = ResultType.Error; } else { try { XmlSerializer serializer = new XmlSerializer(typeof(job)); StringReader rdr = new StringReader(xmlString); var job = (job)serializer.Deserialize(rdr); var deliveryStatus = new DeliveryStatus(); deliveryStatus.Id = transactionId; deliveryStatus.Recipients = job.recipients; deliveryStatus.Delivered = job.delivered; deliveryStatus.Failed = job.failed; deliveryStatus.Pending = job.pending; deliveryStatus.Status = job.status; deliveryStatus.Clicked = job.clicked; deliveryStatus.Opened = job.opened; deliveryStatus.Unsubscribed = job.unsubscribed; response.DeliveryStatus = deliveryStatus; response.ResultType = ResultType.Success; } catch (Exception ex) { response.ErrorMessage = "Could not deserialize message: " + Environment.NewLine + ex; response.ResultType = ResultType.Error; } } } catch (Exception ex) { response.ErrorMessage = ex.ToString(); response.ResultType = ResultType.Error; } return response; }