/// <inheritdoc />
 public override double GetBalance()
 {
     using (CWebClient client = new CWebClient())
     {
         if (Timeout > 0)
         {
             client.Timeout = Timeout;
         }
         var response = client.DownloadString($"http://rucaptcha.com/res.php?key={ApiKey}&action=getbalance");
         return(double.Parse(response, CultureInfo.InvariantCulture));
     }
 }
Example #2
0
        /// <inheritdoc />
        public override string SolveRecaptcha(string siteKey, string siteUrl)
        {
            // Create task
            using (CWebClient client = new CWebClient())
            {
                if (Timeout > 0)
                {
                    client.Timeout = Timeout;
                }
                var             response = client.DownloadString($"http://azcaptcha.com/in.php?key={ApiKey}&method=userrecaptcha&googlekey={siteKey}&pageurl={siteUrl}&json=1");
                GenericResponse ctr      = JsonConvert.DeserializeObject <GenericResponse>(response);
                if (ctr.status == 0)
                {
                    throw new Exception(ctr.request);
                }
                TaskId = ctr.request;
                Status = CaptchaStatus.Processing;

                // Check if task has been completed
                DateTime start = DateTime.Now;
                while (Status == CaptchaStatus.Processing && (DateTime.Now - start).TotalSeconds < Timeout)
                {
                    Thread.Sleep(5000);
                    response = client.DownloadString($"http://azcaptcha.com/res.php?key={ApiKey}&action=get&id={TaskId}&json=1");
                    GenericResponse gtrr = JsonConvert.DeserializeObject <GenericResponse>(response);
                    if (gtrr.request.Contains("NOTREADY"))
                    {
                        continue;
                    }
                    if (gtrr.status == 0)
                    {
                        throw new Exception(gtrr.request);
                    }
                    Status = CaptchaStatus.Completed;
                    return(gtrr.request);
                }
                throw new TimeoutException();
            }
        }
        /// <inheritdoc />
        public override string SolveRecaptcha(string siteKey, string siteUrl)
        {
            // Create task
            using (CWebClient client = new CWebClient())
            {
                if (Timeout > 0)
                {
                    client.Timeout = Timeout;
                }
                var response = client.DownloadString($"http://rucaptcha.com/in.php?key={ApiKey}&method=userrecaptcha&googlekey={siteKey}&pageurl={siteUrl}");
                if (!response.StartsWith("OK"))
                {
                    throw new Exception(response);
                }
                TaskId = response.Split('|')[1];
                Status = CaptchaStatus.Processing;

                // Check if task has been completed
                DateTime start = DateTime.Now;
                while (Status == CaptchaStatus.Processing && (DateTime.Now - start).TotalSeconds < Timeout)
                {
                    Thread.Sleep(5000);
                    response = client.DownloadString($"http://rucaptcha.com/res.php?key={ApiKey}&action=get&id={TaskId}");
                    if (response.Contains("NOT_READY"))
                    {
                        continue;
                    }
                    if (response.Contains("ERROR"))
                    {
                        throw new Exception(response);
                    }
                    Status = CaptchaStatus.Completed;
                    return(response.Split('|')[1]);
                }
                throw new TimeoutException();
            }
        }
Example #4
0
 /// <inheritdoc />
 public override double GetBalance()
 {
     using (CWebClient client = new CWebClient())
     {
         if (Timeout > 0)
         {
             client.Timeout = Timeout;
         }
         var             response = client.DownloadString($"http://azcaptcha.com/res.php?key={ApiKey}&action=getbalance&json=1");
         GenericResponse gbr      = JsonConvert.DeserializeObject <GenericResponse>(response);
         if (gbr.status == 0)
         {
             throw new Exception(gbr.request);
         }
         return(double.Parse(gbr.request, CultureInfo.InvariantCulture));
     }
 }
 /// <inheritdoc />
 public override double GetBalance()
 {
     // Create task
     using (CWebClient client = new CWebClient())
     {
         client.Timeout = 3;
         try
         {
             var response = client.DownloadString($"https://api.solverecaptcha.com/?userid={User}&key={Pass}&sitekey=test&pageurl=test");
             if (response.Contains("ERROR_ACCESS_DENIED"))
             {
                 return(0);                                          // Invalid key
             }
         }
         catch { } // Catch the timeout exception, this means it's trying to process a captcha so the key is valid
         return(999);
     }
 }
 /// <inheritdoc />
 public override string SolveRecaptcha(string siteKey, string siteUrl)
 {
     // Create task
     using (CWebClient client = new CWebClient())
     {
         if (Timeout > 0)
         {
             client.Timeout = Timeout;
         }
         var response = client.DownloadString($"https://api.solverecaptcha.com/?userid={User}&key={Pass}&sitekey={siteKey}&pageurl={siteUrl}");
         if (response.Contains("ERROR"))
         {
             throw new Exception(response);
         }
         Status = CaptchaStatus.Completed;
         return(response.Split('|')[1]);
     }
 }
Example #7
0
        /// <inheritdoc />
        public override string SolveCaptcha(Bitmap bitmap)
        {
            // Create task
            using (CWebClient client = new CWebClient())
            {
                if (Timeout > 0)
                {
                    client.Timeout = Timeout;
                }
                client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded");
                var response = client.UploadString("http://azcaptcha.com/in.php",
                                                   $"key={ApiKey}&method=base64&regsense=1&body={GetBase64(bitmap, ImageFormat.Bmp)}&json=1");
                GenericResponse ctr = JsonConvert.DeserializeObject <GenericResponse>(response);
                if (ctr.status == 0)
                {
                    throw new Exception(ctr.request);
                }
                TaskId = ctr.request;
                Status = CaptchaStatus.Processing;

                // Check if task has been completed
                DateTime start = DateTime.Now;
                while (Status == CaptchaStatus.Processing && (DateTime.Now - start).TotalSeconds < Timeout)
                {
                    Thread.Sleep(5000);
                    response = client.DownloadString($"http://azcaptcha.com/res.php?key={ApiKey}&action=get&id={TaskId}&json=1");
                    GenericResponse gtrr = JsonConvert.DeserializeObject <GenericResponse>(response);
                    if (gtrr.request.Contains("NOTREADY"))
                    {
                        continue;
                    }
                    if (gtrr.status == 0)
                    {
                        throw new Exception(gtrr.request);
                    }
                    Status = CaptchaStatus.Completed;
                    return(gtrr.request);
                }
                throw new TimeoutException();
            }
        }
        /// <inheritdoc />
        public override string SolveCaptcha(Bitmap bitmap)
        {
            // Create task
            using (CWebClient client = new CWebClient())
            {
                if (Timeout > 0)
                {
                    client.Timeout = Timeout;
                }
                client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded");
                var response = client.UploadString("http://rucaptcha.com/in.php",
                                                   $"key={ApiKey}&method=base64&regsense=1&body={EscapeLongString(GetBase64(bitmap, ImageFormat.Bmp))}");
                if (!response.StartsWith("OK"))
                {
                    throw new Exception(response);
                }
                TaskId = response.Split('|')[1];
                Status = CaptchaStatus.Processing;

                // Check if task has been completed
                DateTime start = DateTime.Now;
                while (Status == CaptchaStatus.Processing && (DateTime.Now - start).TotalSeconds < Timeout)
                {
                    Thread.Sleep(5000);
                    response = client.DownloadString($"http://rucaptcha.com/res.php?key={ApiKey}&action=get&id={TaskId}");
                    if (response.Contains("NOT_READY"))
                    {
                        continue;
                    }
                    if (response.Contains("ERROR"))
                    {
                        throw new Exception(response);
                    }
                    Status = CaptchaStatus.Completed;
                    return(response.Split('|')[1]);
                }
                throw new TimeoutException();
            }
        }