예제 #1
0
 /// <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));
     }
 }
예제 #2
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));
     }
 }
예제 #3
0
 /// <inheritdoc />
 public override double GetBalance()
 {
     using (CWebClient client = new CWebClient())
     {
         if (Timeout > 0)
         {
             client.Timeout = Timeout;
         }
         client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
         var res = client.UploadString("http://captchatypers.com/Forms/RequestBalanceToken.ashx", $"token={ApiKey}&action=REQUESTBALANCE");
         if (res.Contains("ERROR"))
         {
             throw new Exception(res);
         }
         return(double.Parse(res, 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]);
     }
 }
예제 #6
0
 /// <inheritdoc />
 public override double GetBalance()
 {
     using (CWebClient client = new CWebClient())
     {
         if (Timeout > 0)
         {
             client.Timeout = Timeout;
         }
         client.Headers.Add(HttpRequestHeader.Accept, "application/json");
         client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded");
         var response           = client.UploadString("http://api.dbcapi.me/api/user", $"username={User}&password={Pass}");
         GetBalanceResponse gbr = JsonConvert.DeserializeObject <GetBalanceResponse>(response);
         if (gbr.status != 0)
         {
             throw new Exception("Invalid Credentials");
         }
         return(gbr.balance / 100);
     }
 }
예제 #7
0
 /// <inheritdoc />
 public override double GetBalance()
 {
     using (CWebClient client = new CWebClient())
     {
         if (Timeout > 0)
         {
             client.Timeout = Timeout;
         }
         client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
         var response = client.UploadString("https://api.anti-captcha.com/getBalance",
                                            JsonConvert.SerializeObject(new GetBalanceRequest(ApiKey)));
         GetBalanceResponse gbr = JsonConvert.DeserializeObject <GetBalanceResponse>(response);
         if (gbr.errorId > 0)
         {
             throw new Exception(gbr.errorCode);
         }
         return(gbr.balance);
     }
 }
예제 #8
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/json");
                var response = client.UploadString("https://api.anti-captcha.com/createTask",
                                                   JsonConvert.SerializeObject(new CreateCaptchaTaskRequest(ApiKey, GetBase64(bitmap, ImageFormat.Png))));
                CreateTaskResponse ctr = JsonConvert.DeserializeObject <CreateTaskResponse>(response);
                if (ctr.errorId > 0)
                {
                    throw new Exception(ctr.errorCode);
                }
                TaskId = ctr.taskId;
                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);
                    client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
                    response = client.UploadString("https://api.anti-captcha.com/getTaskResult",
                                                   JsonConvert.SerializeObject(new GetTaskResultRequest(ApiKey, TaskId)));
                    GetTaskResultCaptchaResponse gtrr = JsonConvert.DeserializeObject <GetTaskResultCaptchaResponse>(response);
                    if (gtrr.errorId > 0)
                    {
                        throw new Exception(gtrr.errorCode);
                    }
                    if (gtrr.status == "ready")
                    {
                        Status = CaptchaStatus.Completed;
                        return(gtrr.solution.text);
                    }
                }
                throw new TimeoutException();
            }
        }
예제 #9
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 res = client.UploadString("http://captchatypers.com/Forms/UploadFileAndGetTextNEWToken.ashx",
                                       $"token={ApiKey}&action=UPLOADCAPTCHA&chkCase=1&file={WebUtility.UrlEncode(GetBase64(bitmap, ImageFormat.Bmp))}");
         if (res.Contains("ERROR"))
         {
             throw new Exception(res);
         }
         Status = CaptchaStatus.Completed;
         return(res.Split('|')[1]);
     }
 }
예제 #10
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();
            }
        }
예제 #11
0
        /// <inheritdoc />
        public override string SolveRecaptcha(string siteKey, string siteUrl)
        {
            // Create task
            using (CWebClient client = new CWebClient())
            {
                if (Timeout > 0)
                {
                    client.Timeout = Timeout;
                }
                client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded");
                var res = client.UploadString("http://captchatypers.com/captchaapi/UploadRecaptchaToken.ashx",
                                              $"token={ApiKey}&action=UPLOADCAPTCHA&pageurl={siteUrl}&googlekey={siteKey}");
                if (res.Contains("ERROR"))
                {
                    throw new Exception(res);
                }
                TaskId = res;
                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);
                    client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded");
                    res = client.UploadString("http://captchatypers.com/captchaapi/GetRecaptchaTextToken.ashx",
                                              $"token={ApiKey}&action=GETTEXT&captchaID={TaskId}");
                    if (res.Contains("NOTDECODED"))
                    {
                        continue;
                    }
                    if (res.Contains("ERROR"))
                    {
                        throw new Exception(res);
                    }
                    Status = CaptchaStatus.Completed;
                    return(res);
                }
                throw new TimeoutException();
            }
        }
예제 #12
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();
            }
        }
예제 #13
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://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();
            }
        }
예제 #14
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://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();
            }
        }