Exemplo n.º 1
0
 public ResolvedCaptcha GetResolvedCaptcha()
 {
     Captcha c = new Captcha("http://www.erepublik.com/en");
     return new ResolvedCaptcha(c.ChallengeID, c.ResolveAntigate(m_Key));
 }
Exemplo n.º 2
0
 public ResolvedCaptcha GetResolvedCaptcha()
 {
     lock (locker)
     {
         Init();
         Captcha c = new Captcha("http://www.erepublik.com/en");
         var stream = new System.IO.MemoryStream(c.Image);
         var img = System.Drawing.Image.FromStream(stream);
         PicBox.Image = img;
         PicBox.Width = img.Width;
         PicBox.Height = img.Height;
         Form.Width = PicBox.Width + 5;
         Form.Height = PicBox.Height + Form.Height - Form.ClientSize.Height + 30;
         TextBox.Top = PicBox.Height;
         TextBox.Width = PicBox.Width;
         TextBox.Height = 30;
         TextBox.Focus();
         TextBox.Text = "";
         if (m_bBeep)
         {
             Console.Beep(262, 400);
         }
         Form.ShowDialog();
         return new ResolvedCaptcha(c.ChallengeID, TextBox.Text);
     }
 }
Exemplo n.º 3
0
        public static bool Vote(string voteURL, string referrer, bool doVote)
        {
            ConsoleLog.WriteLine("Vote URL (doVote=" + doVote.ToString() + "): " + voteURL);

            string response;

            client.Referer = referrer;
            client.Headers.Remove("X-Requested-With");

            response = client.DownloadString(voteURL);
            //ConsoleLog.WriteLine(response, "Response1.txt");

            if (!doVote)
                return true;

            if (!response.Contains("<div id=\"contestBlock\">"))
            {
                ConsoleLog.WriteLine("Bad page loaded");
                return false;
            }

            if (response.Contains("<div id=\"kaptchaBlock\">"))
            {
                ConsoleLog.WriteLine("Loaded");

                response = CommonUtils.GetStringBetween(
                    response,
                    "<div id=\"kaptchaBlock\">",
                    "<input type=\"image\"");

                string imageURL = baseURL + CommonUtils.GetStringBetween(
                        response,
                        "<img src=\"",
                        "\">");
                string challengeID = CommonUtils.GetStringBetween(
                    response,
                    "<input type=\"hidden\" id=\"itemvote\" value=\"",
                    "\">");

                response = "-1";

                while (response.Contains("-1"))
                {
                    ConsoleLog.WriteLine("Getting captcha...");

                    byte[] image = client.DownloadData(imageURL);
                    Captcha captcha = new Captcha(image);

                    ConsoleLog.WriteLine(
                        "imageURL=" + imageURL + ", " +
                        "challengeID=" + challengeID);

                    string challengeText = captcha.ResolveAntigate(Globals.BotConfig.AntiGateKey);

                    client.Headers.Add("X-Requested-With", "XMLHttpRequest");
                    client.Referer = voteURL;
                    string PostData = "item=" + challengeID + "&votekey=" + challengeText;
                    response = client.UploadString(baseURL + "/contest/spvoting.php", PostData);

                    //ConsoleLog.WriteLine(response, "Response2.txt");
                }

                bool result = response.Contains("<a href=\"/bestsp.php\">");

                ConsoleLog.WriteLine("URL voted. Result=" + result);

                return result;
            }
            else
            {
                ConsoleLog.WriteLine("IP/URL allready voted");
                return false;
            }
        }