/// <summary> /// Gets the servers that are currently online. /// </summary> private void GetServers() { PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://omegle.com/status"); sendPost.Type = PostSubmitter.PostTypeEnum.Get; var strStatus = sendPost.Post(); var dictStatus = JsonConvert.DeserializeObject <dynamic>(strStatus); var listServers = new List <String>(); var listAntiNudeServers = new List <String>(); foreach (String server in dictStatus.servers) { listServers.Add(server.Split('.')[0]); } foreach (String server in dictStatus.antinudeservers) { listAntiNudeServers.Add(server.Split('.')[0]); } serverList = listServers.ToArray <String>(); antiNudeServerList = listAntiNudeServers.ToArray <String>(); }
/// <summary> /// Gets a new Id from the Omegle service. /// </summary> public void GetID() { PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://{0}.omegle.com/start?rcs=1", Server); sendPost.Type = PostSubmitter.PostTypeEnum.Post; if (Interests.Count > 0) // Adding topics outside of the URL doesn't work { sendPost.Url += "&topics=" + GetTopicPostString(); } if (Language != null) { sendPost.Url += "&lang=" + Language; } if (!Throws) { sendPost.WebExceptionEvent += WebException; } Id = sendPost.Post(); Id = Id.TrimStart('"'); //gets rid of " at the start and end Id = Id.TrimEnd('"'); }
/// <summary> /// Checks the Server for a new response. /// </summary> private void Listen() { PostSubmitter eventlisten = new PostSubmitter(); eventlisten.Url = String.Format("http://{0}.omegle.com/events", Server); eventlisten.PostItems.Add("id", Id); eventlisten.Type = PostSubmitter.PostTypeEnum.Post; eventlisten.WebExceptionEvent += WebException; Parse(eventlisten.Post()); }
/// <summary> /// Sends a disconnect message to the server, ending the conversation. /// </summary> /// <returns></returns> public string SendDisconnect() { PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://{0}.omegle.com/disconnect", Server); sendPost.PostItems.Add("id", Id); sendPost.Type = PostSubmitter.PostTypeEnum.Post; if (!Throws) { sendPost.WebExceptionEvent += WebException; } return(sendPost.Post()); }
/// <summary> /// Notifies the Server that the user has finished typing. /// </summary> public void StopTyping() { PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://{0}.omegle.com/stoppedtyping", Server); sendPost.PostItems.Add("id", Id); sendPost.Type = PostSubmitter.PostTypeEnum.Post; if (!Throws) { sendPost.WebExceptionEvent += WebException; } sendPost.Post(); }
/// <summary> /// Sends a captcha response to the Server. /// </summary> /// <param name="challenge">The challenge value</param> /// <param name="response">The response string</param> /// <returns></returns> public string SendCaptcha(string challenge, string response) { PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://{0}.omegle.com/recaptcha", Server); sendPost.PostItems.Add("id", Id); sendPost.PostItems.Add("challenge", challenge); sendPost.PostItems.Add("response", response); sendPost.Type = PostSubmitter.PostTypeEnum.Post; if (!Throws) { sendPost.WebExceptionEvent += WebException; } return(sendPost.Post()); }
/// <summary> /// Sends a message to the connected stranger. This version does not html-encode the message. /// </summary> /// <param name="message">The message to be sent</param> /// <returns></returns> public string SendMessageRaw(string message) { //Send Message format: [url]http://bajor.omegle.com/send?id=Id&msg=MSG[/url] PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://{0}.omegle.com/send", Server); sendPost.PostItems.Add("id", Id); sendPost.PostItems.Add("msg", message); sendPost.Type = PostSubmitter.PostTypeEnum.Post; if (!Throws) { sendPost.WebExceptionEvent += WebException; } return(sendPost.Post()); }
/// <summary> /// Sends a message from the specified Id. /// </summary> /// <param name="message">The message.</param> /// <param name="ownID">The ID.</param> /// <returns></returns> public string SendMessageAsID(string message, string ownID) { //This method could potentially be used to send messages from another user. //One would have to acquire said users Id first. //TODO: Find a way to get a strangers Id //message = HttpUtility.UrlEncode(message); PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://{0}.omegle.com/send", Server); sendPost.PostItems.Add("id", ownID); sendPost.PostItems.Add("msg", message); sendPost.Type = PostSubmitter.PostTypeEnum.Post; if (!Throws) { sendPost.WebExceptionEvent += WebException; } return(sendPost.Post()); }
/// <summary>Checks the Server for a new response.</summary> /// <returns>True if events were parsed, otherwise false.</returns> private bool Listen() { PostSubmitter eventlisten = new PostSubmitter(); eventlisten.Url = String.Format("http://{0}.omegle.com/events", Server); eventlisten.PostItems.Add("id", Id); eventlisten.Type = PostSubmitter.PostTypeEnum.Post; eventlisten.WebExceptionEvent += WebException; string response = eventlisten.Post(); if (response != null && response != "null") return Parse(response); else return false; }
/// <summary> /// Gets the servers that are currently online. /// </summary> private void GetServers() { PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://omegle.com/status"); sendPost.Type = PostSubmitter.PostTypeEnum.Get; var strStatus = sendPost.Post(); var dictStatus = JsonConvert.DeserializeObject<dynamic>(strStatus); var listServers = new List<String>(); var listAntiNudeServers = new List<String>(); foreach (String server in dictStatus.servers) listServers.Add(server.Split('.')[0]); foreach (String server in dictStatus.antinudeservers) listAntiNudeServers.Add(server.Split('.')[0]); serverList = listServers.ToArray<String>(); antiNudeServerList = listAntiNudeServers.ToArray<String>(); }
/// <summary> /// Notifies the Server that the user has finished typing. /// </summary> public void StopTyping() { if (!IsConnected) return; PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://{0}.omegle.com/stoppedtyping", Server); sendPost.PostItems.Add("id", Id); sendPost.Type = PostSubmitter.PostTypeEnum.Post; if (!Throws) sendPost.WebExceptionEvent += WebException; sendPost.Post(); }
/// <summary>Refreshes the bot list.</summary> private void refreshBotList() { PostSubmitter popular_list = new PostSubmitter(); popular_list.Url = "http://www.pandorabots.com/botmaster/en/mostactive"; popular_list.Type = PostSubmitter.PostTypeEnum.Get; string list_html = string.Empty; bool error; do { error = false; try { list_html = popular_list.Post(); } catch (WebException) { error = true; } } while (error && MessageBox.Show(this, "Could not connect to Pandora Bots.", "Network error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning) == DialogResult.Retry); if (error) { BotName = null; BotId = null; return; } ClearList(); string pattern = "<td.*>\\s*<a.*?href\\s*=\\s*[\"\']/pandora/talk\\?botid=(?<botid>.*?)[\'\"].*?>" + "(?<botname>.*)</a>\\s*</td>\\s*<td.*>\\s*(?<interactions>\\d+)\\s*</td>"; Regex regx = new Regex(pattern); MatchCollection matches = regx.Matches(list_html); if (matches.Count > 0) { foreach (Match m in matches) { GroupCollection g = m.Groups; Group botId = g["botid"]; Group botName = g["botname"]; Group botInteractions = g["interactions"]; if (!botName.Success || !botId.Success) continue; AddBot("popular", HttpUtility.HtmlDecode(botName.Value), HttpUtility.HtmlDecode(botId.Value), HttpUtility.HtmlDecode(botInteractions.Value)); } } else AddBot("popular", "List not available."); if (CustomBots != null) { foreach (PandoraBotRecord bot in CustomBots) AddBot("custom", bot.Name, bot.Id); } else AddBot("custom", "None added."); }
/// <summary> /// Sends a message to the connected stranger. This version does not html-encode the message. /// </summary> /// <param name="message">The message to be sent</param> /// <returns></returns> public string SendMessageRaw(string message) { if (!IsConnected) return null; //Send Message format: [url]http://bajor.omegle.com/send?id=Id&msg=MSG[/url] PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://{0}.omegle.com/send", Server); sendPost.PostItems.Add("id", Id); sendPost.PostItems.Add("msg", message); sendPost.Type = PostSubmitter.PostTypeEnum.Post; if (!Throws) sendPost.WebExceptionEvent += WebException; return sendPost.Post(); }
/// <summary> /// Sends a message from the specified Id. /// </summary> /// <param name="message">The message.</param> /// <param name="ownID">The ID.</param> /// <returns></returns> public string SendMessageAsID(string message, string ownID) { if (!IsConnected) return null; //This method could potentially be used to send messages from another user. //One would have to acquire said users Id first. //TODO: Find a way to get a strangers Id message = HttpUtility.UrlEncode(message); PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://{0}.omegle.com/send", Server); sendPost.PostItems.Add("id", ownID); sendPost.PostItems.Add("msg", message); sendPost.Type = PostSubmitter.PostTypeEnum.Post; if (!Throws) sendPost.WebExceptionEvent += WebException; return sendPost.Post(); }
/// <summary> /// Sends a disconnect message to the server, ending the conversation. /// </summary> /// <returns></returns> public string SendDisconnect() { if (!IsConnected) return null; PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://{0}.omegle.com/disconnect", Server); sendPost.PostItems.Add("id", Id); sendPost.Type = PostSubmitter.PostTypeEnum.Post; if (!Throws) sendPost.WebExceptionEvent += WebException; return sendPost.Post(); }
/// <summary> /// Sends a captcha response to the Server. /// </summary> /// <param name="challenge">The challenge value</param> /// <param name="response">The response string</param> /// <returns></returns> public string SendCaptcha(string challenge, string response) { PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://{0}.omegle.com/recaptcha", Server); sendPost.PostItems.Add("id", Id); sendPost.PostItems.Add("challenge", challenge); sendPost.PostItems.Add("response", response); sendPost.Type = PostSubmitter.PostTypeEnum.Post; if (!Throws) sendPost.WebExceptionEvent += WebException; return sendPost.Post(); }
/// <summary> /// Gets a new Id from the Omegle service. /// </summary> public void GetID() { PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://{0}.omegle.com/start", Server); sendPost.PostItems.Add("rcs", "1"); sendPost.Type = PostSubmitter.PostTypeEnum.Post; if (!Throws) sendPost.WebExceptionEvent += WebException; Id = sendPost.Post(); Id = Id.TrimStart('"'); //gets rid of " at the start and end Id = Id.TrimEnd('"'); }
private static void omegle_CaptchaRequired(object sender, CaptchaRequiredArgs e) { Console.ResetColor(); Console.WriteLine("Captcha Required. Press any key to launch browser."); Console.ReadKey(); PostSubmitter post = new PostSubmitter(); post.Url = "http://www.google.com/recaptcha/api/challenge"; post.PostItems.Add("k", e.id); post.PostItems.Add("ajax", "1"); post.Type = PostSubmitter.PostTypeEnum.Get; string response = "{" + post.Post().Split(new char[] { '{', '}' })[1] + "}"; string challenge = JsonConvert.DeserializeObject<JObject>(response)["challenge"].ToString(); captchaURL = "http://www.google.com/recaptcha/api/image?c=" + challenge; //System.Diagnostics.Process.Connect("http://www.google.com/recaptcha/api/image?c=" + challenge); captcha.ShowDialog(); Console.Write("Please Input Captcha: "); string userInput = Console.ReadLine(); if (userInput != string.Empty) omegle.SendCaptcha(challenge, userInput); else omegle.Reconnect(); }
/// <summary> /// Gets a new Id from the Omegle service. /// </summary> public void GetID() { PostSubmitter sendPost = new PostSubmitter(); sendPost.Url = String.Format("http://{0}.omegle.com/start?rcs=1", Server); sendPost.Type = PostSubmitter.PostTypeEnum.Post; if (Interests.Count > 0) // Adding topics outside of the URL doesn't work sendPost.Url += "&topics=" + GetTopicPostString(); if (Language != null) sendPost.Url += "&lang=" + Language; if (!Throws) sendPost.WebExceptionEvent += WebException; Id = sendPost.Post(); Id = Id.TrimStart('"'); //gets rid of " at the start and end Id = Id.TrimEnd('"'); }