diff --git a/CapSolver.Tests/BaseMethodTests.cs b/CapSolver.Tests/BaseMethodTests.cs index 440cff2..7c7626c 100644 --- a/CapSolver.Tests/BaseMethodTests.cs +++ b/CapSolver.Tests/BaseMethodTests.cs @@ -3,7 +3,7 @@ namespace CapSolver.Tests; public class BaseMethodTests { [Fact] - public async void TestBalance() + public async Task TestBalance() { var client = new CapSolverClient(Environment.GetEnvironmentVariable("APIKEY")!, false); float balance = await client.GetBalance(); @@ -12,7 +12,7 @@ public async void TestBalance() } [Fact] - public async void TestPackages() + public async Task TestPackages() { var client = new CapSolverClient(Environment.GetEnvironmentVariable("APIKEY")!, false); List packages = await client.GetPackages(); diff --git a/CapSolver.Tests/HCaptchaTaskTest.cs b/CapSolver.Tests/HCaptchaTaskTest.cs index bd82e5b..0110fc0 100644 --- a/CapSolver.Tests/HCaptchaTaskTest.cs +++ b/CapSolver.Tests/HCaptchaTaskTest.cs @@ -3,7 +3,7 @@ namespace CapSolver.Tests; public class HCaptchaTaskTest { [Fact] - public async void Test() + public async Task Test() { var client = new CapSolverClient(Environment.GetEnvironmentVariable("APIKEY")!, false); var task = new HCaptchaTask("https://lessons.zennolab.com/captchas/hcaptcha/?level=easy", @@ -11,7 +11,7 @@ public async void Test() string id = await client.CreateTask(task); Assert.IsType(id); Assert.NotNull(id); - var response = await client.JoinTaskResult(id); + var response = await client.JoinTaskResult(id); Assert.NotNull(response.GReCaptchaResponse); Assert.IsType(response.GReCaptchaResponse); } diff --git a/CapSolver.Tests/ReCaptchaV2TaskTest.cs b/CapSolver.Tests/ReCaptchaV2TaskTest.cs index f11a118..8f729f5 100644 --- a/CapSolver.Tests/ReCaptchaV2TaskTest.cs +++ b/CapSolver.Tests/ReCaptchaV2TaskTest.cs @@ -3,7 +3,7 @@ namespace CapSolver.Tests; public class ReCaptchaV2TaskTest { [Fact] - public async void Test() + public async Task Test() { var client = new CapSolverClient(Environment.GetEnvironmentVariable("APIKEY")!, false); var task = new ReCaptchaV2Task("https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=high", diff --git a/CapSolver.Tests/ReCaptchaV3TaskTest.cs b/CapSolver.Tests/ReCaptchaV3TaskTest.cs index d2dca39..54b1386 100644 --- a/CapSolver.Tests/ReCaptchaV3TaskTest.cs +++ b/CapSolver.Tests/ReCaptchaV3TaskTest.cs @@ -3,7 +3,7 @@ namespace CapSolver.Tests; public class ReCaptchaV3TaskTest { [Fact] - public async void Test() + public async Task Test() { var client = new CapSolverClient(Environment.GetEnvironmentVariable("APIKEY")!, false); var task = new ReCaptchaV3Task("https://lessons.zennolab.com/captchas/recaptcha/v3.php?level=beta", diff --git a/CapSolver/CapSolver.csproj b/CapSolver/CapSolver.csproj index 3ad80a2..d9bd650 100644 --- a/CapSolver/CapSolver.csproj +++ b/CapSolver/CapSolver.csproj @@ -1,22 +1,22 @@ - + - net6.0 + net6.0;net8.0 enable enable - CapSolver - 1.2.1 - Alperen Sert - Alperen Sert - CapSolver,ReCaptcha v2 solver, Bypass captcha, anti-captcha, + CapSolver + 2.0.0 + Alperen Sert + Alperen Sert + CapSolver,ReCaptcha v2 solver, Bypass captcha, anti-captcha, CapSolver.com Library for .NET Core MIT https://github.com/alperensert/CapSolver https://github.com/alperensert/CapSolver README.md git - - - - - + + + + + \ No newline at end of file diff --git a/CapSolver/CapSolverClient.cs b/CapSolver/CapSolverClient.cs index efed143..3bcbf93 100644 --- a/CapSolver/CapSolverClient.cs +++ b/CapSolver/CapSolverClient.cs @@ -102,15 +102,11 @@ public async Task CreateTask(ITask task) break; } } - var method = task switch - { - AntiAkamaiBMPTask => Endpoints.CreateTaskAntiAkamai, - AntiKasadaTask => Endpoints.CreateTaskKasada, - _ => Endpoints.CreateTask - }; - if (task is HCaptchaTurboTask && IsProxyActive() == false) - throw new CapSolverException(13, "PROXY_NEEDED", "HCaptchaTurboTask requires your own proxies."); - var r = await CheckResponse(await MakeRequest(method, data)); + + if (task is DatadomeSliderTask && !IsProxyActive()) + throw new CapSolverException(13, "PROXY_NEEDED", "DatadomeSliderTask requires your own proxies."); + + var r = await CheckResponse(await MakeRequest(Endpoints.CreateTask, data)); return r.TaskId; } @@ -120,7 +116,7 @@ public async Task CreateTask(ITask task) public void DisableProxy() => _proxy = null; - private bool IsReady(TaskResponse response) where T : ITaskResponse => response.Status == "ready"; + private static bool IsReady(TaskResponse response) where T : ITaskResponse => response.Status == "ready"; private async Task MakeRequest(string endpoint, string data) { @@ -139,7 +135,7 @@ private async Task MakeRequest(string endpoint, string data return response; } - private void CheckResponse(ErrorResponse? response) + private static void CheckResponse(ErrorResponse? response) { if (response == null) { @@ -151,7 +147,7 @@ private void CheckResponse(ErrorResponse? response) } } - private async Task CheckResponse(HttpResponseMessage response) where T : ErrorResponse + private static async Task CheckResponse(HttpResponseMessage response) where T : ErrorResponse { try { diff --git a/CapSolver/Utilities/CapSolver.cs b/CapSolver/CapSolverException.cs similarity index 79% rename from CapSolver/Utilities/CapSolver.cs rename to CapSolver/CapSolverException.cs index 511e49e..7472cdd 100644 --- a/CapSolver/Utilities/CapSolver.cs +++ b/CapSolver/CapSolverException.cs @@ -1,7 +1,7 @@ -namespace CapSolver.Utilities; +namespace CapSolver; -[System.Serializable] -public class CapSolverException : System.Exception +[Serializable] +public class CapSolverException : Exception { public int ErrorId { get; set; } diff --git a/CapSolver/Models/Responses/AntiAkamaiBMPResponse.cs b/CapSolver/Models/Responses/AntiAkamaiBMPResponse.cs deleted file mode 100644 index 5a2700d..0000000 --- a/CapSolver/Models/Responses/AntiAkamaiBMPResponse.cs +++ /dev/null @@ -1,19 +0,0 @@ -using CapSolver.Utilities; -using Newtonsoft.Json; - -namespace CapSolver.Models.Responses; - -public class AntiAkamaiBMPResponse : ITaskResponse -{ - [JsonRequired] - [JsonProperty("deviceId")] - public string DeviceId { get; set; } = null!; - - [JsonRequired] - [JsonProperty("sensors")] - public IList Sensors { get; set; } = null!; - - [JsonRequired] - [JsonProperty("version")] - public string Version { get; set; } = null!; -} \ No newline at end of file diff --git a/CapSolver/Models/Responses/AntiAwsWafResponse.cs b/CapSolver/Models/Responses/AntiAwsWafResponse.cs new file mode 100644 index 0000000..586b745 --- /dev/null +++ b/CapSolver/Models/Responses/AntiAwsWafResponse.cs @@ -0,0 +1,11 @@ +using CapSolver.Utilities; +using Newtonsoft.Json; + +namespace CapSolver.Models.Responses; + +public class AntiAwsWafResponse : ITaskResponse +{ + [JsonRequired] + [JsonProperty("cookie")] + public string Cookie { get; set; } = null!; +} \ No newline at end of file diff --git a/CapSolver/Models/Responses/AntiKasadaResponse.cs b/CapSolver/Models/Responses/AntiKasadaResponse.cs deleted file mode 100644 index 1b9dd1b..0000000 --- a/CapSolver/Models/Responses/AntiKasadaResponse.cs +++ /dev/null @@ -1,19 +0,0 @@ -using CapSolver.Utilities; -using Newtonsoft.Json; - -namespace CapSolver.Models.Responses; - -public class AntiKasadaResponse : ITaskResponse -{ - [JsonRequired] - [JsonProperty("x-kpsdk-ct")] - public string KPsdkCT { get; set; } = null!; - - [JsonRequired] - [JsonProperty("x-kpsdk-cd")] - public string KPsdkCD { get; set; } = null!; - - [JsonRequired] - [JsonProperty("user-agent")] - public string UserAgent { get; set; } = null!; -} \ No newline at end of file diff --git a/CapSolver/Models/Responses/AntiCloudflareResponse.cs b/CapSolver/Models/Responses/AntiTurnstileResponse.cs similarity index 88% rename from CapSolver/Models/Responses/AntiCloudflareResponse.cs rename to CapSolver/Models/Responses/AntiTurnstileResponse.cs index b5f3bd0..516fc5b 100644 --- a/CapSolver/Models/Responses/AntiCloudflareResponse.cs +++ b/CapSolver/Models/Responses/AntiTurnstileResponse.cs @@ -3,7 +3,7 @@ namespace CapSolver.Models.Responses; -public class AntiCloudflareResponse : ITaskResponse +public class AntiTurnstileResponse : ITaskResponse { [JsonRequired] [JsonProperty("token")] diff --git a/CapSolver/Models/Responses/AwsWafClassificationResponse.cs b/CapSolver/Models/Responses/AwsWafClassificationResponse.cs index 604ade6..5e798f2 100644 --- a/CapSolver/Models/Responses/AwsWafClassificationResponse.cs +++ b/CapSolver/Models/Responses/AwsWafClassificationResponse.cs @@ -5,6 +5,10 @@ namespace CapSolver.Models.Responses; public class AwsWafClassificationResponse : ITaskResponse { + [JsonRequired] + [JsonProperty("objects")] + public IList Objects { get; set; } = null!; + [JsonRequired] [JsonProperty("box")] public IList Box { get; set; } = null!; diff --git a/CapSolver/Models/Responses/BinanceCaptchaResponse.cs b/CapSolver/Models/Responses/BinanceCaptchaResponse.cs deleted file mode 100644 index 05374ec..0000000 --- a/CapSolver/Models/Responses/BinanceCaptchaResponse.cs +++ /dev/null @@ -1,15 +0,0 @@ -using CapSolver.Utilities; -using Newtonsoft.Json; - -namespace CapSolver.Models.Responses; - -public class BinanceCaptchaResponse : ITaskResponse -{ - [JsonRequired] - [JsonProperty("token")] - public string Token { get; set; } = null!; - - [JsonRequired] - [JsonProperty("userAgent")] - public string UserAgent { get; set; } = null!; -} diff --git a/CapSolver/Models/Responses/DatadomeSliderResponse.cs b/CapSolver/Models/Responses/DatadomeSliderResponse.cs index 4a6244a..81a6a56 100644 --- a/CapSolver/Models/Responses/DatadomeSliderResponse.cs +++ b/CapSolver/Models/Responses/DatadomeSliderResponse.cs @@ -5,8 +5,9 @@ namespace CapSolver.Models.Responses; public class DatadomeSliderResponse : ITaskResponse { + [JsonRequired] [JsonProperty("cookie")] - public string Cookie { get; set; } + public string Cookie { get; set; } = null!; [JsonRequired] [JsonProperty("userAgent")] diff --git a/CapSolver/Models/Responses/FunCaptchaClassificationResponse.cs b/CapSolver/Models/Responses/FunCaptchaClassificationResponse.cs deleted file mode 100644 index f0e8c8c..0000000 --- a/CapSolver/Models/Responses/FunCaptchaClassificationResponse.cs +++ /dev/null @@ -1,19 +0,0 @@ -using CapSolver.Utilities; -using Newtonsoft.Json; - -namespace CapSolver.Models.Responses; - -public class FunCaptchaClassificationResponse : ITaskResponse -{ - [JsonProperty("objects", NullValueHandling = NullValueHandling.Include)] - public IList? Objects { get; set; } - - [JsonProperty("labels", NullValueHandling = NullValueHandling.Include)] - public IList? Labels { get; set; } - - [JsonProperty("hasObject", NullValueHandling = NullValueHandling.Include)] - public bool? HasObject { get; set; } - - [JsonProperty("type", NullValueHandling = NullValueHandling.Include)] - public string? Type { get; set; } -} \ No newline at end of file diff --git a/CapSolver/Models/Responses/FunCaptchaTaskResponse.cs b/CapSolver/Models/Responses/FunCaptchaTaskResponse.cs deleted file mode 100644 index ed7b7c8..0000000 --- a/CapSolver/Models/Responses/FunCaptchaTaskResponse.cs +++ /dev/null @@ -1,11 +0,0 @@ -using CapSolver.Utilities; -using Newtonsoft.Json; - -namespace CapSolver.Models.Responses; - -public class FunCaptchaTaskResponse : ITaskResponse -{ - [JsonRequired] - [JsonProperty("token")] - public string Token { get; set; } = null!; -} \ No newline at end of file diff --git a/CapSolver/Models/Responses/GeeTestV4Response.cs b/CapSolver/Models/Responses/GeeTestV4Response.cs index 7944605..f49ae98 100644 --- a/CapSolver/Models/Responses/GeeTestV4Response.cs +++ b/CapSolver/Models/Responses/GeeTestV4Response.cs @@ -5,21 +5,21 @@ namespace CapSolver.Models.Responses; public class GeeTestV4Response { [JsonProperty("captcha_id")] - public string CaptchaId { get; set; } + public string? CaptchaId { get; set; } [JsonProperty("captcha_output")] - public string CaptchaOutput { get; set; } + public string? CaptchaOutput { get; set; } [JsonProperty("gen_time")] - public string GenTime { get; set; } + public string? GenTime { get; set; } [JsonProperty("lot_number")] - public string LotNumber { get; set; } + public string? LotNumber { get; set; } [JsonProperty("pass_token")] - public string Token { get; set; } + public string? Token { get; set; } [JsonProperty("risk_type")] - public string RiskType { get; set; } + public string? RiskType { get; set; } } diff --git a/CapSolver/Models/Responses/HCaptchaClassificationResponse.cs b/CapSolver/Models/Responses/HCaptchaClassificationResponse.cs index a54e0f1..f3bc241 100644 --- a/CapSolver/Models/Responses/HCaptchaClassificationResponse.cs +++ b/CapSolver/Models/Responses/HCaptchaClassificationResponse.cs @@ -12,6 +12,9 @@ public class HCaptchaClassificationResponse : ITaskResponse [JsonProperty("box")] public IList? Box { get; set; } + [JsonProperty("tags")] + public IList? Tags { get; set; } + [JsonProperty("imageSize")] - public Tuple ImageSize { get; set; } + public Tuple? ImageSize { get; set; } } \ No newline at end of file diff --git a/CapSolver/Models/Responses/HCaptchaTaskResponse.cs b/CapSolver/Models/Responses/HCaptchaResponse.cs similarity index 80% rename from CapSolver/Models/Responses/HCaptchaTaskResponse.cs rename to CapSolver/Models/Responses/HCaptchaResponse.cs index a1645d2..598510d 100644 --- a/CapSolver/Models/Responses/HCaptchaTaskResponse.cs +++ b/CapSolver/Models/Responses/HCaptchaResponse.cs @@ -3,7 +3,7 @@ namespace CapSolver.Models.Responses; -public class HCaptchaTaskResponse : ReCaptchaV2Response, ITaskResponse +public class HCaptchaResponse : ReCaptchaV2Response, ITaskResponse { [JsonRequired] [JsonProperty("timestamp")] diff --git a/CapSolver/Models/Responses/MtCaptchaResponse.cs b/CapSolver/Models/Responses/MtCaptchaResponse.cs index b3cd7b0..ec97fe6 100644 --- a/CapSolver/Models/Responses/MtCaptchaResponse.cs +++ b/CapSolver/Models/Responses/MtCaptchaResponse.cs @@ -6,8 +6,8 @@ namespace CapSolver.Models.Responses; public class MtCaptchaResponse : ITaskResponse { [JsonProperty("token")] - public string Token { get; set; } + public string? Token { get; set; } [JsonProperty("userAgent")] - public string UserAgent { get; set; } + public string? UserAgent { get; set; } } diff --git a/CapSolver/Models/Responses/ReCaptchaV2ClassificationResponse.cs b/CapSolver/Models/Responses/ReCaptchaV2ClassificationResponse.cs new file mode 100644 index 0000000..9d9708b --- /dev/null +++ b/CapSolver/Models/Responses/ReCaptchaV2ClassificationResponse.cs @@ -0,0 +1,20 @@ +using CapSolver.Utilities; +using Newtonsoft.Json; + +namespace CapSolver.Models.Responses; + +public class ReCaptchaV2ClassificationResponse : ITaskResponse +{ + [JsonRequired] + [JsonProperty("type")] + public string Type { get; set; } = null!; + + [JsonProperty("size")] + public int Size { get; set; } + + [JsonProperty("objects")] + public IList? Objects { get; set; } = null!; + + [JsonProperty("hasObject")] + public bool? HasObject { get; set; } +} \ No newline at end of file diff --git a/CapSolver/Models/Responses/ReCaptchaV3Response.cs b/CapSolver/Models/Responses/ReCaptchaV3Response.cs index a4ebc22..7bd9f70 100644 --- a/CapSolver/Models/Responses/ReCaptchaV3Response.cs +++ b/CapSolver/Models/Responses/ReCaptchaV3Response.cs @@ -3,6 +3,5 @@ namespace CapSolver.Models.Responses; public class ReCaptchaV3Response : ReCaptchaV2Response, ITaskResponse -{ - +{ } \ No newline at end of file diff --git a/CapSolver/Models/Responses/VisionEngineClassificationResponse.cs b/CapSolver/Models/Responses/VisionEngineClassificationResponse.cs new file mode 100644 index 0000000..e938550 --- /dev/null +++ b/CapSolver/Models/Responses/VisionEngineClassificationResponse.cs @@ -0,0 +1,16 @@ +using CapSolver.Utilities; +using Newtonsoft.Json; + +namespace CapSolver.Models.Responses; + +public class VisionEngineClassificationResponse : ITaskResponse +{ + [JsonProperty("distance")] + public int Distance { get; set; } + + [JsonProperty("angle")] + public int Angle{ get; set; } + + [JsonProperty("box")] + public IList? Box { get; set; } +} \ No newline at end of file diff --git a/CapSolver/Tasks/AntiAkamaiBMPTask.cs b/CapSolver/Tasks/AntiAkamaiBMPTask.cs deleted file mode 100644 index 38d9c35..0000000 --- a/CapSolver/Tasks/AntiAkamaiBMPTask.cs +++ /dev/null @@ -1,71 +0,0 @@ -using CapSolver.Utilities; -using Newtonsoft.Json; - -namespace CapSolver.Tasks; - -/// -/// This task type is used to solve Akamai BMP. -/// -public class AntiAkamaiBMPTask : ITask -{ - /// - /// Task's type. - /// - [JsonProperty("type")] - private readonly string Type = "AntiAkamaiBMPTask"; - - /// - /// Package name of AkamaiBMP mobile APP - /// - [JsonRequired] - [JsonProperty("packageName")] - public string PackageName { get; set; } - - /// - /// AKAMAI BMP Version number, default is: 3.2.6 , max support is: 3.3.1 - /// - [JsonProperty("version", NullValueHandling = NullValueHandling.Ignore)] - public string? Version { get; set; } - - /// - /// If you want to have a fixed device ID in the sensor, you can pass this parameter - /// - [JsonProperty("deviceId", NullValueHandling = NullValueHandling.Ignore)] - public string? DeviceId { get; set; } - - /// - /// Input fixed deviceInfo, default is: random. - /// - [JsonProperty("deviceName", NullValueHandling = NullValueHandling.Ignore)] - public string? DeviceName { get; set; } - - /// - /// Sensor combinations acquired at once.
- /// Maximum is 50. - ///
- /// - [JsonProperty("count", NullValueHandling = NullValueHandling.Ignore)] - public int? Count { get; set; } - - /// - /// Prepare AntiAkamaiBMP task. - /// - /// Package name of AkamaiBMP mobile APP - /// AKAMAI BMP Version number, default is: 3.2.6 , max support is: 3.3.1 - /// If you want to have a fixed device ID in the sensor, you can pass this parameter - /// Input fixed deviceInfo, default is: random. - /// Sensor combinations acquired at once. - public AntiAkamaiBMPTask(string packageName, - string? version = null, - string? deviceId = null, - string? deviceName = null, - int? count = null) - { - PackageName = packageName; - Version = version; - DeviceId = deviceId; - DeviceName = deviceName; - Count = count; - } - -} \ No newline at end of file diff --git a/CapSolver/Tasks/AntiAwsWafTask.cs b/CapSolver/Tasks/AntiAwsWafTask.cs new file mode 100644 index 0000000..2af90e5 --- /dev/null +++ b/CapSolver/Tasks/AntiAwsWafTask.cs @@ -0,0 +1,62 @@ +using CapSolver.Utilities; +using Newtonsoft.Json; + +namespace CapSolver.Tasks; + +public class AntiAwsWafTask : ITask, IProxyTask +{ + [JsonProperty("type")] + private string Type => "AntiAwsWafTask"; + + /// + /// The URL of the page that returns the captcha info + /// + [JsonRequired] + [JsonProperty("websiteURL")] + public string WebsiteURL { get; set; } + + /// + /// When the status code returned by the websiteURL page is 405, awsContext is required + /// + [JsonProperty("awsKey", NullValueHandling = NullValueHandling.Ignore)] + public string? AwsKey { get; set; } + + /// + /// When the status code returned by the websiteURL page is 405, awsIv is required + /// + [JsonProperty("awsIv", NullValueHandling = NullValueHandling.Ignore)] + public string? AwsIv { get; set; } + + /// + /// When the status code returned by the websiteURL page is 405, awsContext is required + /// + [JsonProperty("awsContext", NullValueHandling = NullValueHandling.Ignore)] + public string? AwsContext { get; set; } + + /// + /// When the status code returned by the websiteURL page is 405 or 202, awsChallengeJs is required + /// + [JsonProperty("awsChallengeJS", NullValueHandling = NullValueHandling.Ignore)] + public string? AwsChallengeJS { get; set; } + + /// + /// + /// The URL of the page that returns the captcha info + /// When the status code returned by the websiteURL page is 405, awsContext is required + /// When the status code returned by the websiteURL page is 405, awsIv is required + /// When the status code returned by the websiteURL page is 405, awsContext is required + /// When the status code returned by the websiteURL page is 405 or 202, awsChallengeJs is required + public AntiAwsWafTask(string websiteUrl, + string? awsKey = null, + string? awsIv = null, + string? awsContext = null, + string? awsChallengeJS = null) + { + + WebsiteURL = websiteUrl; + AwsKey = awsKey; + AwsIv = awsIv; + AwsContext = awsContext; + AwsChallengeJS = awsChallengeJS; + } +} diff --git a/CapSolver/Tasks/AntiKasadaTask.cs b/CapSolver/Tasks/AntiKasadaTask.cs deleted file mode 100644 index cf02512..0000000 --- a/CapSolver/Tasks/AntiKasadaTask.cs +++ /dev/null @@ -1,35 +0,0 @@ -using CapSolver.Utilities; -using Newtonsoft.Json; - -namespace CapSolver.Tasks; - -/// -/// This task type is used to solve AntiKasada. -/// This task type requires proxy. -/// -public class AntiKasadaTask : ITask, IProxyTask -{ - /// - /// Address of a webpage with Kasada - /// - [JsonProperty("pageURL")] - public string PageUrl { get; set; } - - /// - /// Only cd data is returned - /// - /// - [JsonProperty("onlyCD", NullValueHandling = NullValueHandling.Ignore)] - public string? OnlyCD { get; set; } - - /// - /// Prepare AntiKasada task - /// - /// Address of a webpage with Kasada - /// Only cd data is returned - public AntiKasadaTask(string pageUrl, string? onlyCd = null) - { - PageUrl = pageUrl; - OnlyCD = onlyCd; - } -} \ No newline at end of file diff --git a/CapSolver/Tasks/AntiCloudflareTask.cs b/CapSolver/Tasks/AntiTurnstileTask.cs similarity index 74% rename from CapSolver/Tasks/AntiCloudflareTask.cs rename to CapSolver/Tasks/AntiTurnstileTask.cs index abeb73b..c8923bb 100644 --- a/CapSolver/Tasks/AntiCloudflareTask.cs +++ b/CapSolver/Tasks/AntiTurnstileTask.cs @@ -3,10 +3,10 @@ namespace CapSolver.Tasks; -public class AntiCloudflareTask : ITask, IProxyTask +public class AntiTurnstileTask : ITask { [JsonProperty("type")] - private readonly string Type = "AntiCloudflareTask"; + private string Type => "AntiTurnstileTaskProxyLess"; /// /// The address of the target page. @@ -27,14 +27,14 @@ public class AntiCloudflareTask : ITask, IProxyTask public Dictionary? MetaData { get; set; } /// - /// Prepare an AntiCloudflare task. + /// Prepare an AntiTurnstileProxyLess task. /// /// The address of the target page. /// Turnstile siteKey /// Turnstile extra data - public AntiCloudflareTask(string websiteUrl, - string websiteKey, - Dictionary? metaData = null) + public AntiTurnstileTask(string websiteUrl, + string websiteKey, + Dictionary? metaData = null) { WebsiteKey = websiteKey; WebsiteURL = websiteUrl; diff --git a/CapSolver/Tasks/AwsWafClassificationTask.cs b/CapSolver/Tasks/AwsWafClassificationTask.cs index 40fee48..7d854c2 100644 --- a/CapSolver/Tasks/AwsWafClassificationTask.cs +++ b/CapSolver/Tasks/AwsWafClassificationTask.cs @@ -6,7 +6,13 @@ namespace CapSolver.Tasks; public class AwsWafClassificationTask : ITask { [JsonProperty("type")] - private readonly string Type = "AwsWafClassification"; + private string Type => "AwsWafClassification"; + + /// + /// Page source url to improve accuracy + /// + [JsonProperty("websiteURL")] + public string? WebsiteUrl { get; set; } /// /// Base64-encoded images, do not include "data:image/***;base64," @@ -30,10 +36,13 @@ public class AwsWafClassificationTask : ITask /// /// Base64-encoded images, do not include "data:image/***;base64,"Base64-encoded images, do not include "data:image/***;base64," /// For full names of questions, please refer to the following list of questions. + /// Page source url to improve accuracy public AwsWafClassificationTask(IList images, - string question) + string question, + string? websiteUrl = null) { Images = images; Question = question; + WebsiteUrl = websiteUrl; } } diff --git a/CapSolver/Tasks/BinanceCaptchaTask.cs b/CapSolver/Tasks/BinanceCaptchaTask.cs deleted file mode 100644 index b992115..0000000 --- a/CapSolver/Tasks/BinanceCaptchaTask.cs +++ /dev/null @@ -1,43 +0,0 @@ -using CapSolver.Utilities; -using Newtonsoft.Json; - -namespace CapSolver.Tasks; - -public class BinanceCaptchaTask : ITask, IProxyTask -{ - [JsonProperty("type")] - private readonly string Type = "BinanceCaptchaTask"; - - /// - /// Address of a webpage with bncaptcha - /// - [JsonProperty("websiteURL")] - public string WebsiteURL { get; set; } - - /// - /// bizId always be login - /// - [JsonProperty("websiteKey")] - public string WebsiteKey { get; set; } - - /// - /// validateId bncaptcha validateId field - /// - [JsonProperty("validateId")] - public string ValidateId { get; set; } - - /// - /// Prepare a BinanceCaptcha task. - /// - /// Address of a webpage with bncaptcha - /// bizId always be login - /// validateId bncaptcha validateId field - public BinanceCaptchaTask(string websiteUrl, - string websiteKey, - string validateId) - { - WebsiteKey = websiteKey; - WebsiteURL = websiteUrl; - ValidateId = validateId; - } -} diff --git a/CapSolver/Tasks/DatadomeSliderTask.cs b/CapSolver/Tasks/DatadomeSliderTask.cs index 1450d49..52ed186 100644 --- a/CapSolver/Tasks/DatadomeSliderTask.cs +++ b/CapSolver/Tasks/DatadomeSliderTask.cs @@ -10,7 +10,7 @@ namespace CapSolver.Tasks; public class DatadomeSliderTask : ITask, IProxyTask { [JsonProperty("type")] - private readonly string Type = "DatadomeSliderTask"; + private string Type => "DatadomeSliderTask"; /// /// Address of the webpage @@ -19,7 +19,7 @@ public class DatadomeSliderTask : ITask, IProxyTask public string WebsiteURL { get; set; } /// - /// Captcha Url where is the captcha + /// If the url contains t=bv that means that your ip must be banned, t should be t=fe /// [JsonProperty("captchaUrl")] public string CaptchaURL { get; set; } diff --git a/CapSolver/Tasks/FunCaptchaClassification.cs b/CapSolver/Tasks/FunCaptchaClassification.cs deleted file mode 100644 index 2176b11..0000000 --- a/CapSolver/Tasks/FunCaptchaClassification.cs +++ /dev/null @@ -1,45 +0,0 @@ -using CapSolver.Utilities; -using Newtonsoft.Json; - -namespace CapSolver.Tasks; - -/// -/// This task type is used to solve FunCaptchaClassification. -/// -public class FunCaptchaClassification : ITask -{ - [JsonProperty("type")] - private readonly string Type = "FunCaptchaClassification"; - - /// - /// Base64 encoded image, can be a screenshot (pass only the hexagonal image, do not pass the rest of the content) - /// - [JsonRequired] - [JsonProperty("image")] - public string Image { get; set; } - - /// - /// Question name. Pass the full name, such as: Pick the lion - /// Only support English requires accurate case, other languages please convert to English yourself - /// The server will automatically determine different image types according to the question, so please make sure the question is correct. - /// Please see the list at the end of the document for the full list of image types and corresponding English questions - ///
- /// See the supported question list: click here - ///
- [JsonRequired] - [JsonProperty("question")] - public string Question { get; set; } - - /// - /// Prepare a FunCaptchaClassification task. - ///
- /// See supported types of FunCaptcha: click here - ///
- /// Base64 encoded image, can be a screenshot (pass only the hexagonal image, do not pass the rest of the content) - /// Question name. Pass the full name, such as: Pick the lion. Only support English requires accurate case, other languages please convert to English yourself.
See the supported question list: click here - public FunCaptchaClassification(string image, string question) - { - Image = image; - Question = question; - } -} \ No newline at end of file diff --git a/CapSolver/Tasks/FunCaptchaTask.cs b/CapSolver/Tasks/FunCaptchaTask.cs deleted file mode 100644 index f114448..0000000 --- a/CapSolver/Tasks/FunCaptchaTask.cs +++ /dev/null @@ -1,64 +0,0 @@ -using CapSolver.Utilities; -using Newtonsoft.Json; - -namespace CapSolver.Tasks; - -/// -/// This task type is used to solve FunCaptcha -/// -public class FunCaptchaTask : ITask, IProxyTask, IUserAgentTask -{ - [JsonProperty("type")] - private readonly string Type = "FunCaptchaTask"; - - /// - /// Address of a webpage with Funcaptcha - /// - [JsonProperty("websiteURL")] - public string WebsiteURL { get; set; } - - /// - /// Funcaptcha website key. - /// - [JsonProperty("websitePublicKey")] - public string WebsitePublicKey { get; set; } - - /// - /// A special subdomain of funcaptcha.com, from which the JS captcha widget should be loaded. Most FunCaptcha installations work from shared domains. - /// - [JsonProperty("funcaptchaApiJSSubdomain")] - public string? ApiJsSubdomain { get; set; } - - /// - /// Additional parameter that may be required by FunCaptcha implementation. Use this property to send "blob" value as a stringified array. See example how it may look like. - /// - [JsonProperty("data")] - public string? Data { get; set; } - - /// - /// Browser's User-Agent which is used in emulation. It is required that you use a signature of a modern browser, otherwise Google will ask you to "update your browser" - /// - /// - [JsonProperty("userAgent", NullValueHandling = NullValueHandling.Ignore)] - public string? UserAgent { get; set; } - - /// - /// Prepare a FunCaptcha task - /// - /// Address of a webpage with Funcaptcha - /// Funcaptcha website key. - /// A special subdomain of funcaptcha.com, from which the JS captcha widget should be loaded. Most FunCaptcha installations work from shared domains. - /// Additional parameter that may be required by FunCaptcha implementation. Use this property to send "blob" value as a stringified array. See example how it may look like. - public FunCaptchaTask(string websiteUrl, - string websitePublicKey, - string? apiJsSubdomain = null, - string? data = null, - string? userAgent = null) - { - WebsiteURL = websiteUrl; - WebsitePublicKey = websitePublicKey; - ApiJsSubdomain = apiJsSubdomain; - Data = data; - UserAgent = userAgent; - } -} \ No newline at end of file diff --git a/CapSolver/Tasks/GeeTestTask.cs b/CapSolver/Tasks/GeeTestTask.cs index 845bc55..fd008e5 100644 --- a/CapSolver/Tasks/GeeTestTask.cs +++ b/CapSolver/Tasks/GeeTestTask.cs @@ -6,29 +6,34 @@ namespace CapSolver.Tasks; /// /// This task is used to solve GeeTest. /// -public class GeeTestTask : ITask, IProxyTask, IUserAgentTask, ICookieTask +public class GeeTestTask : ITask, ICookieTask { [JsonProperty("type")] - private readonly string Type = "GeeTestTask"; + private string Type => "GeeTestTaskProxyLess"; /// - /// Address of a webpage with Geetest + /// Web address of the website using geetest (Ex: https://geetest.com) /// + [JsonRequired] + [JsonProperty("websiteURL")] public string WebsiteURL { get; set; } /// - /// The domain public key, rarely updated. + /// Only Geetest V3 is required /// [JsonProperty("gt", NullValueHandling = NullValueHandling.Ignore)] public string? Gt { get; set; } /// - /// Changing token key. Make sure you grab a fresh one for each captcha; otherwise, you'll be charged for an error task. + /// Only Geetest V3 is required /// [JsonProperty("challenge", NullValueHandling = NullValueHandling.Ignore)] public string? Challenge { get; set; } - [JsonProperty("captchaId")] + /// + /// Only Geetest V4 is required + /// + [JsonProperty("captchaId", NullValueHandling = NullValueHandling.Ignore)] public string? CaptchaId { get; set; } /// @@ -36,34 +41,26 @@ public class GeeTestTask : ITask, IProxyTask, IUserAgentTask, ICookieTask /// [JsonProperty("geetestApiServerSubdomain", NullValueHandling = NullValueHandling.Ignore)] public string? ApiServerSubdomain { get; set; } - - /// - /// Browser's User-Agent which is used in emulation. It is required that you use a signature of a modern browser, otherwise Google will ask you to "update your browser". - /// - [JsonProperty("userAgent", NullValueHandling = NullValueHandling.Ignore)] - public string? UserAgent { get; set; } /// - /// Preapre a GeeTest task + /// Prepare a GeeTest task /// /// Address of a webpage with Geetest /// The domain public key, rarely updated. /// Changing token key. Make sure you grab a fresh one for each captcha; otherwise, you'll be charged for an error task. /// Optional API subdomain. May be required for some implementations. - /// Browser's User-Agent which is used in emulation. public GeeTestTask(string websiteUrl, string? gt = null, string? challenge = null, string? apiServerSubdomain = null, - string? userAgent = null, string? captchaId = null) { WebsiteURL = websiteUrl; Gt = gt; Challenge = challenge; ApiServerSubdomain = apiServerSubdomain; - UserAgent = userAgent; CaptchaId = captchaId; + if (gt != null && challenge != null) { CaptchaId = null; diff --git a/CapSolver/Tasks/HCaptchaClassificationTask.cs b/CapSolver/Tasks/HCaptchaClassificationTask.cs index c6b1b21..2f6ffb4 100644 --- a/CapSolver/Tasks/HCaptchaClassificationTask.cs +++ b/CapSolver/Tasks/HCaptchaClassificationTask.cs @@ -9,10 +9,23 @@ namespace CapSolver.Tasks; public class HCaptchaClassificationTask : ITask { [JsonProperty("type")] - private readonly string Type = "HCaptchaClassification"; + private string Type => "HCaptchaClassification"; /// - /// Base64-encoded images, do not include "data:image/***;base64," + /// Page source url to improve accuracy + /// + [JsonProperty("websiteURL")] + public string? WebsiteUrl { get; set; } + + /// + /// Website key to improve accuracy + /// + [JsonProperty("websiteKey")] + public string? WebsiteKey { get; set; } + + /// + /// Base64 encoded images, do not include "data:image/***; base64," + /// Assembles the picture as a list: [base64, base64, base64...] /// [JsonRequired] [JsonProperty("queries")] @@ -21,27 +34,22 @@ public class HCaptchaClassificationTask : ITask /// /// Question ID. Support English and Chinese, other languages please convert yourself /// - [JsonProperty("question", NullValueHandling = NullValueHandling.Ignore)] - public string? Question { get; set; } - - /// - /// The default result is false. If you need to return coordinates such as [0, 3, 4, 6, 7], put as true. - /// - [JsonProperty("coordinate", NullValueHandling = NullValueHandling.Ignore)] - public bool? Coordinate { get; set; } + [JsonRequired] + [JsonProperty("question")] + public string Question { get; set; } /// /// Prepare a HCaptchaClassification task. /// - /// Base64-encoded images, do not include "data:image/***;base64,"Base64-encoded images, do not include "data:image/***;base64," - /// Question ID. Support English and Chinese, other languages please convert yourself - /// The default result is false. If you need to return coordinates such as [0, 3, 4, 6, 7], put as true. + /// Base64 encoded images, do not include "data:image/***; base64," + /// Question ID. English is supported only. Please convert other languages by yourself + /// Page source url to improve accuracy public HCaptchaClassificationTask(IList queries, - string? question = null, - bool? coordinate = null) + string question, + string? websiteUrl = null) { Queries = queries; Question = question; - Coordinate = coordinate; + WebsiteUrl = websiteUrl; } } \ No newline at end of file diff --git a/CapSolver/Tasks/HCaptchaTask.cs b/CapSolver/Tasks/HCaptchaTask.cs index 95596e5..4399b31 100644 --- a/CapSolver/Tasks/HCaptchaTask.cs +++ b/CapSolver/Tasks/HCaptchaTask.cs @@ -6,10 +6,10 @@ namespace CapSolver.Tasks; /// /// This task type is used to solve HCaptcha. /// -public class HCaptchaTask : ITask, IProxyTask, IUserAgentTask +public class HCaptchaTask : ITask, IUserAgentTask { [JsonProperty("type")] - protected string Type = "HCaptchaTask"; + protected string Type = "HCaptchaTaskProxyLess"; /// /// Address of a webpage with hCaptcha @@ -49,13 +49,11 @@ public class HCaptchaTask : ITask, IProxyTask, IUserAgentTask /// Address of a webpage with hCaptcha /// hCaptcha website key /// Custom data that is used in some implementations of hCaptcha Enterprise. So you need to put true in the isEnterprise parameter. In most cases you see it as rqdata inside network requests. IMPORTANT: you MUST provide userAgent if you submit captcha with data parameter. The value should match the User-Agent you use when interacting with the target website. - /// Use true for enterprise version of hcaptcha /// Use true for invisible version of hcaptcha /// Browser's User-Agent which is used in emulation. public HCaptchaTask(string websiteUrl, string websiteKey, object? enterprisePayload = null, - bool? isEnterprise = null, bool? isInvisible = null, string? userAgent = null) { @@ -64,9 +62,5 @@ public HCaptchaTask(string websiteUrl, EnterprisePayload = enterprisePayload; IsInvisible = isInvisible; UserAgent = userAgent; - if (isEnterprise == true) - { - Type = "HCaptchaEnterpriseTask"; - } } } \ No newline at end of file diff --git a/CapSolver/Tasks/HCaptchaTurboTask.cs b/CapSolver/Tasks/HCaptchaTurboTask.cs deleted file mode 100644 index e1b1bba..0000000 --- a/CapSolver/Tasks/HCaptchaTurboTask.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace CapSolver.Tasks; - -public class HCaptchaTurboTask : HCaptchaTask -{ - public HCaptchaTurboTask(string websiteUrl, string websiteKey, - object? enterprisePayload = null, bool? isEnterprise = null, - bool? isInvisible = null, string? userAgent = null) - : base(websiteUrl, websiteKey, enterprisePayload, isEnterprise, isInvisible, userAgent) - { - Type = "HCaptchaTurboTask"; - } -} \ No newline at end of file diff --git a/CapSolver/Tasks/ImageToTextTask.cs b/CapSolver/Tasks/ImageToTextTask.cs index 71ddcad..175ce5d 100644 --- a/CapSolver/Tasks/ImageToTextTask.cs +++ b/CapSolver/Tasks/ImageToTextTask.cs @@ -12,16 +12,24 @@ public class ImageToTextTask : ITask /// Task's type. /// [JsonProperty("type")] - private readonly string Type = "ImageToTextTask"; + private string Type => "ImageToTextTask"; /// - /// Base64 encoded content of the image (without line breaks) + /// Page source url to improve accuracy + /// + [JsonProperty("websiteURL")] + public string? WebsiteUrl { get; set; } + + /// + /// Base64 encoded content of the image (no newlines, no data:image/***;charset=utf-8;base64,) /// [JsonProperty("body")] public string Body { get; set; } /// - /// Specifies the module. Currently, the supported modules are common and queueit. + /// Specifies the module. + ///
+ /// See independent module support list: click here ///
[JsonProperty("module")] public string? Module { get; set; } diff --git a/CapSolver/Tasks/MtCaptchaTask.cs b/CapSolver/Tasks/MtCaptchaTask.cs index 6ac42eb..b75cb62 100644 --- a/CapSolver/Tasks/MtCaptchaTask.cs +++ b/CapSolver/Tasks/MtCaptchaTask.cs @@ -3,43 +3,34 @@ namespace CapSolver.Tasks; -public class MtCaptchaTask : ITask, IProxyTask, IUserAgentTask +public class MtCaptchaTask : ITask, IProxyTask { [JsonProperty("type")] - private readonly string Type = "MtCaptchaTask"; + private string Type => "MtCaptchaTask"; /// - /// Web address of the website using hcaptcha, generally it's fixed value. (Ex: https://google.com) + /// Web address of the website using MTCaptcha, generally it's fixed value. (Ex: https://google.com) /// [JsonRequired] [JsonProperty("websiteURL")] public string WebsiteURL { get; set; } /// - /// if the url contains t=bv that means that your ip must be banned, t should be t=fe + /// The domain public key, rarely updated. (Ex: sk=MTPublic-xxx public key) /// [JsonRequired] - [JsonProperty("captchaUrl")] - public string CaptchaURL { get; set; } + [JsonProperty("websiteKey")] + public string WebsiteKey { get; set; } /// - /// Browser's User-Agent which is used in emulation. It is required that you use a signature of a modern browser, otherwise Google will ask you to "update your browser". /// - [JsonRequired] - [JsonProperty("userAgent")] - public string UserAgent { get; set; } - - /// - /// - /// Web address of the website using hcaptcha, generally it's fixed value. - /// if the url contains t=bv that means that your ip must be banned, t should be t=fe - /// Browser's User-Agent which is used in emulation. It is required that you use a signature of a modern browser, otherwise Google will ask you to "update your browser". + /// Web address of the website using MTCaptcha, generally it's fixed value. + /// The domain public key, rarely updated. (Ex: sk=MTPublic-xxx public key) public MtCaptchaTask(string websiteUrl, - string captchaUrl, - string userAgent) + string websiteKey) { - CaptchaURL = captchaUrl; + WebsiteURL = websiteUrl; - UserAgent = userAgent; + WebsiteKey = websiteKey; } } diff --git a/CapSolver/Tasks/ReCaptchaV2ClassificationTask.cs b/CapSolver/Tasks/ReCaptchaV2ClassificationTask.cs new file mode 100644 index 0000000..11dc418 --- /dev/null +++ b/CapSolver/Tasks/ReCaptchaV2ClassificationTask.cs @@ -0,0 +1,39 @@ +using CapSolver.Utilities; +using Newtonsoft.Json; + +namespace CapSolver.Tasks; + +public class ReCaptchaV2ClassificationTask : ITask +{ + [JsonProperty("type")] + private string Type => "ReCaptchaV2Classification"; + + /// + /// Base64-encoded images, do not include "data:image/***;base64," + /// + [JsonRequired] + [JsonProperty("images")] + public IList Images { get; set; } + + /// + /// For full names of questions, please refer to the following list of questions. + ///
+ /// See supported types: click here + ///
+ [JsonProperty("question", NullValueHandling = NullValueHandling.Include)] + public string Question { get; set; } + + /// + /// Prepare a ReCaptchaV2Classification task. + ///
+ /// See supported types: click here + ///
+ /// Base64-encoded images, do not include "data:image/***;base64,"Base64-encoded images, do not include "data:image/***;base64," + /// For full names of questions, please refer to the following list of questions. + public ReCaptchaV2ClassificationTask(IList images, + string question) + { + Images = images; + Question = question; + } +} diff --git a/CapSolver/Tasks/ReCaptchaV2Enterprise.cs b/CapSolver/Tasks/ReCaptchaV2EnterpriseTask.cs similarity index 92% rename from CapSolver/Tasks/ReCaptchaV2Enterprise.cs rename to CapSolver/Tasks/ReCaptchaV2EnterpriseTask.cs index 35b18c9..7a3be1d 100644 --- a/CapSolver/Tasks/ReCaptchaV2Enterprise.cs +++ b/CapSolver/Tasks/ReCaptchaV2EnterpriseTask.cs @@ -6,13 +6,13 @@ namespace CapSolver.Tasks; /// /// This task type is used to solve the ReCaptchaV2 Enterprise version. /// -public class ReCaptchaV2Enterprise : ITask, IProxyTask, IUserAgentTask, ICookieTask +public class ReCaptchaV2EnterpriseTask : ITask, IProxyTask, IUserAgentTask, ICookieTask { /// /// Task's type. /// [JsonProperty("type")] - private readonly string Type = "ReCaptchaV2EnterpriseTask"; + private string Type => "ReCaptchaV2EnterpriseTask"; /// /// Address of a webpage with Google ReCaptcha @@ -65,12 +65,12 @@ public class ReCaptchaV2Enterprise : ITask, IProxyTask, IUserAgentTask, ICookieT /// Domain address from which to load reCAPTCHA Enterprise. /// Additional cookies which we must use during interaction with target page or Google. /// Browser's User-Agent which is used in emulation. - public ReCaptchaV2Enterprise(string websiteUrl, + public ReCaptchaV2EnterpriseTask(string websiteUrl, string websiteKey, object? enterprisePayload = null, string? apiDomain = null, string? userAgent = null, - string? cookies= null) + string? cookies = null) { WebsiteUrl = websiteUrl; WebsiteKey = websiteKey; diff --git a/CapSolver/Tasks/ReCaptchaV2Task.cs b/CapSolver/Tasks/ReCaptchaV2Task.cs index 6a8416f..5ca2cc4 100644 --- a/CapSolver/Tasks/ReCaptchaV2Task.cs +++ b/CapSolver/Tasks/ReCaptchaV2Task.cs @@ -9,21 +9,21 @@ namespace CapSolver.Tasks; public class ReCaptchaV2Task : ITask, IUserAgentTask, ICookieTask, IProxyTask { [JsonProperty("type")] - private readonly string Type = "ReCaptchaV2Task"; + private string Type => "ReCaptchaV2Task"; /// /// Address of a webpage with Google ReCaptcha /// [JsonRequired] [JsonProperty("websiteURL")] - public string WebsiteUrl { get; set; } = null!; + public string WebsiteUrl { get; set; } /// /// Recaptcha website key.
///
[JsonRequired] [JsonProperty("websiteKey")] - public string WebsiteKey { get; set; } = null!; + public string WebsiteKey { get; set; } /// /// Specify whether or not Recaptcha is invisible. diff --git a/CapSolver/Tasks/ReCaptchaV3Task.cs b/CapSolver/Tasks/ReCaptchaV3Task.cs index e7b19d0..a617af0 100644 --- a/CapSolver/Tasks/ReCaptchaV3Task.cs +++ b/CapSolver/Tasks/ReCaptchaV3Task.cs @@ -9,7 +9,7 @@ namespace CapSolver.Tasks; public class ReCaptchaV3Task : ITask, IProxyTask, IUserAgentTask, ICookieTask { [JsonProperty("type")] - private readonly string Type = "ReCaptchaV3Task"; + private string Type { get; set; } = "ReCaptchaV3Task"; /// /// Address of a webpage with Google ReCaptcha @@ -30,7 +30,7 @@ public class ReCaptchaV3Task : ITask, IProxyTask, IUserAgentTask, ICookieTask /// [JsonRequired] [JsonProperty("pageAction")] - public string PageAction { get; set; } = "verify"; + public string PageAction { get; set; } /// /// Value from 0.1 to 0.9 @@ -73,7 +73,7 @@ public class ReCaptchaV3Task : ITask, IProxyTask, IUserAgentTask, ICookieTask /// Browser's User-Agent which is used in emulation. public ReCaptchaV3Task(string websiteUrl, string websiteKey, - string pageAction, + string pageAction = "verify", double? minimumScore = null, string? cookies = null, string? userAgent = null, @@ -88,6 +88,7 @@ public ReCaptchaV3Task(string websiteUrl, EnterprisePayload = enterprisePayload; ApiDomain = apiDomain; Cookies = cookies; + if (enterprisePayload != null) { Type = "ReCaptchaV3EnterpriseTask"; diff --git a/CapSolver/Tasks/VisionEngineClassificationTask.cs b/CapSolver/Tasks/VisionEngineClassificationTask.cs new file mode 100644 index 0000000..fbc9642 --- /dev/null +++ b/CapSolver/Tasks/VisionEngineClassificationTask.cs @@ -0,0 +1,67 @@ +using CapSolver.Utilities; +using Newtonsoft.Json; + +namespace CapSolver.Tasks; + +/// +/// This task type is used to solve VisionEngine +/// +public class VisionEngineClassificationTask : ITask +{ + [JsonProperty("type")] + private string Type => "VisionEngine"; + + /// + /// See supported images types: click here + /// + [JsonRequired] + [JsonProperty("module")] + public string Module { get; set; } + + /// + /// Base64 encoded content of the image (no newlines, no data:image/***;charset=utf-8;base64,) + /// + [JsonRequired] + [JsonProperty("image")] + public string Image { get; set; } + + /// + /// Base64 encoded content of the background image (no newlines, no data:image/***;charset=utf-8;base64,) + /// + [JsonRequired] + [JsonProperty("imageBackground")] + public string ImageBackground { get; set; } + + /// + /// Page source url to improve accuracy + /// + [JsonProperty("websiteURL")] + public string? WebsiteUrl { get; set; } + + /// + /// space_detection requires + /// + [JsonProperty("question")] + public string? Question { get; set; } + + /// + /// Prepare a HCaptchaClassification task. + /// + /// See supported images types: click here + /// Base64 encoded content of the image (no newlines, no data:image/***;charset=utf-8;base64,) + /// Base64 encoded content of the background image (no newlines, no data:image/***;charset=utf-8;base64,) + /// Page source url to improve accuracy + /// space_detection requires + public VisionEngineClassificationTask(string module, + string image, + string imageBackground, + string? websiteUrl = null, + string? question = null) + { + Module = module; + Image = image; + ImageBackground = imageBackground; + WebsiteUrl = websiteUrl; + Question = question; + } +} \ No newline at end of file diff --git a/CapSolver/Utilities/Endpoints.cs b/CapSolver/Utilities/Endpoints.cs index 91fc165..87c7b44 100644 --- a/CapSolver/Utilities/Endpoints.cs +++ b/CapSolver/Utilities/Endpoints.cs @@ -5,6 +5,4 @@ internal static class Endpoints public const string Balance = "/getBalance"; public const string CreateTask = "/createTask"; public const string GetTaskResult = "/getTaskResult"; - public const string CreateTaskKasada = "/kasada/invoke"; - public const string CreateTaskAntiAkamai = "/akamaibmp/invoke"; } \ No newline at end of file diff --git a/CapSolver/Utilities/ICookieTask.cs b/CapSolver/Utilities/ICookieTask.cs index c71f416..fc86c68 100644 --- a/CapSolver/Utilities/ICookieTask.cs +++ b/CapSolver/Utilities/ICookieTask.cs @@ -1,6 +1,5 @@ namespace CapSolver.Utilities; public interface ICookieTask -{ - +{ } \ No newline at end of file diff --git a/CapSolver/Utilities/IProxyTask.cs b/CapSolver/Utilities/IProxyTask.cs index 7a1d910..5b09188 100644 --- a/CapSolver/Utilities/IProxyTask.cs +++ b/CapSolver/Utilities/IProxyTask.cs @@ -1,6 +1,5 @@ namespace CapSolver.Utilities; public interface IProxyTask -{ - +{ } \ No newline at end of file diff --git a/CapSolver/Utilities/ITask.cs b/CapSolver/Utilities/ITask.cs index 22f3c49..1955289 100644 --- a/CapSolver/Utilities/ITask.cs +++ b/CapSolver/Utilities/ITask.cs @@ -1,6 +1,5 @@ namespace CapSolver.Utilities; public interface ITask -{ - +{ } \ No newline at end of file diff --git a/CapSolver/Utilities/ITaskResponse.cs b/CapSolver/Utilities/ITaskResponse.cs index ec0eecc..4b91767 100644 --- a/CapSolver/Utilities/ITaskResponse.cs +++ b/CapSolver/Utilities/ITaskResponse.cs @@ -1,6 +1,5 @@ namespace CapSolver.Utilities; public interface ITaskResponse -{ - +{ } \ No newline at end of file diff --git a/CapSolver/Utilities/Proxy.cs b/CapSolver/Utilities/Proxy.cs index 64deca9..21d3cf0 100644 --- a/CapSolver/Utilities/Proxy.cs +++ b/CapSolver/Utilities/Proxy.cs @@ -20,10 +20,10 @@ public class Proxy : IProxyTask public string? ProxyPassword { get; set; } public Proxy(string proxyType, - string proxyAddress, - int proxyPort, - string? proxyLogin = null, - string? proxyPassword = null) + string proxyAddress, + int proxyPort, + string? proxyLogin = null, + string? proxyPassword = null) { ProxyType = proxyType; ProxyAddress = proxyAddress; diff --git a/CapSolver/Utilities/VanillaTask.cs b/CapSolver/Utilities/VanillaTask.cs index 373a3e6..b5c7859 100644 --- a/CapSolver/Utilities/VanillaTask.cs +++ b/CapSolver/Utilities/VanillaTask.cs @@ -9,7 +9,7 @@ public class VanillaTask /// [JsonRequired] [JsonProperty("clientKey", NullValueHandling = NullValueHandling.Ignore)] - public string ClientKey { get; set; } = null!; + public string ClientKey { get; set; } [JsonProperty("task", NullValueHandling = NullValueHandling.Ignore)] public ITask? Task { get; private set; } diff --git a/README.md b/README.md index ab71cda..0059a7c 100644 --- a/README.md +++ b/README.md @@ -6,37 +6,35 @@ ### Installation via Package Manager: ``` -NuGet\Install-Package CapSolver -Version 1.2.1 +NuGet\Install-Package CapSolver -Version 2.0.0 ``` This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package. via .NET CLI: ```ssh -dotnet add package CapSolver --version 1.2.1 +dotnet add package CapSolver --version 2.0.0 ``` via adding PackageReference: ```xml - + ``` For projects that support PackageReference, copy this XML node into the project file to reference the package. ### Supported Captcha Types -- Image to text +- Image To Text - ReCaptcha V2 +- ReCaptcha V2 Classification - ReCaptcha V3 - HCaptcha - HCaptcha Classification -- FunCaptcha -- FunCaptcha Classification -- GeeTest -- Datadome Slider -- Anti Cloud Flare -- Mt Captcha -- Binance Captcha +- GeeTest V3 / V4 +- Datadome Slider / Interstitial +- Anti Turnstile / Cloudflare +- MTCaptcha +- AWS WAF Captcha - AWS WAF Classification -- Anti Kasada -- Anti Akamai BMP +- Vision Engine Classification ### Usage Examples --- @@ -65,9 +63,9 @@ var response = await client.JoinTaskResult(id); #### FunCaptcha Task ```csharp var client = new CapSolverClient("apikey", false); -var task = new FunCaptchaTask("funcaptcha-site", "funcaptcha-key", "funcaptcha-js-source"); +var task = new HCaptchaTask("hcaptcha-site", "hcaptcha-key"); string id = await client.CreateTask(task); -var response = await client.JoinTaskResult(id); +var response = await client.JoinTaskResult(id); ``` For other examples and api documentation please visit [wiki](https://captchaai.atlassian.net/wiki/spaces/CAPTCHAAI/overview) \ No newline at end of file