diff --git a/README.md b/README.md index d274c80..ccfeb30 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,9 @@ Examples of API requests for different captcha types are available on the [C# ca - [DataDome](#datadome) - [atbCAPTCHA](#atbcaptcha) - [Tencent](#tencent) + - [Prosopo](#prosopo) + - [Captchafox](#captchafox) + - [Temu](#temu) - [VK Image](#vk-image) - [VK Captcha](#vk-captcha) - [Other methods](#other-methods) @@ -490,6 +493,49 @@ tencent.SetAppId("190014885"); tencent.SetPageUrl("https://www.example.com/"); ``` +### Prosopo + +[API method description.](https://2captcha.com/2captcha-api#prosopo-procaptcha) + +Use this method to solve Prosopo and obtain a token to bypass the protection. + + +```csharp +Prosopo captcha = new Prosopo(); + +captcha.SetSiteKey("5EZVvsHMrKCFKp5NYNoTyDjTjetoVo1Z4UNNbTwJf1GfN6Xm"); +captcha.SetUrl("https://www.twickets.live/"); +``` + +### Captchafox + +[API method description.](https://2captcha.com/2captcha-api#captchafox) + +Use this method to solve Captchafox and obtain a token to bypass the protection. + + +```csharp +Captchafox captcha = new Captchafox(); +captcha.SetSiteKey("sk_ILKWNruBBVKDOM7dZs59KHnDLEWiH"); +captcha.SetUrl("https://mysite.com/page/with/captchafox"); +captcha.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"); +captcha.SetProxy("HTTPS", "login:password@IP_address:PORT"); +``` + +### Temu + +[API method description.](https://2captcha.com/2captcha-api#temucaptcha) + +This method can be used to solve Temu. Returns a coordinates. + +```csharp +Temu captcha = new Temu(); +captcha.SetBody(bodyStr); +captcha.SetPart1(part1Str); +captcha.SetPart2(part2Str); +captcha.SetPart3(part3Str); +``` + ### VK Image [API method description.](https://2captcha.com/2captcha-api#vkcaptcha) @@ -508,7 +554,6 @@ string base64EncodedImage = Convert.ToBase64String(bytes); VkCaptcha captcha = new VkCaptcha("vkimage"); captcha.SetBase64(base64EncodedImage); captcha.SetSteps("[5,12,22,24,21,23,10,7,2,8,19,18,8,24,21,22,11,14,16,5,18,20,4,21,12,6,0,0,11,12,8,20,19,3,14,8,9,13,16,24,18,3,2,23,8,12,6,1,11,0,20,15,19,22,17,24,8,0,12,5,19,14,11,6,7,14,23,24,23,20,4,20,6,12,4,17,4,18,6,20,17,5,23,7,10,2,8,9,5,4,17,24,11,14,4,10,12,22,21,2]"); - ``` ### VK Captcha diff --git a/TwoCaptcha.Examples/CaptchafoxExample.cs b/TwoCaptcha.Examples/CaptchafoxExample.cs new file mode 100644 index 0000000..2f046b6 --- /dev/null +++ b/TwoCaptcha.Examples/CaptchafoxExample.cs @@ -0,0 +1,30 @@ +using System; +using System.Linq; +using TwoCaptcha.Captcha; + +namespace TwoCaptcha.Examples +{ + public class CaptchafoxExample + { + public CaptchafoxExample(string apiKey) + { + TwoCaptcha solver = new TwoCaptcha(apiKey); + + Captchafox captcha = new Captchafox(); + captcha.SetSiteKey("sk_ILKWNruBBVKDOM7dZs59KHnDLEWiH"); + captcha.SetUrl("https://mysite.com/page/with/captchafox"); + captcha.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"); + captcha.SetProxy("HTTPS", "login:password@IP_address:PORT"); + + try + { + solver.Solve(captcha).Wait(); + Console.WriteLine("Captcha solved: " + captcha.Code); + } + catch (AggregateException e) + { + Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message); + } + } + } +} \ No newline at end of file diff --git a/TwoCaptcha.Examples/ProsopoExample.cs b/TwoCaptcha.Examples/ProsopoExample.cs new file mode 100644 index 0000000..3b5a79a --- /dev/null +++ b/TwoCaptcha.Examples/ProsopoExample.cs @@ -0,0 +1,28 @@ +using System; +using System.Linq; +using TwoCaptcha.Captcha; + +namespace TwoCaptcha.Examples +{ + public class ProsopoExample + { + public ProsopoExample(string apiKey) + { + TwoCaptcha solver = new TwoCaptcha(apiKey); + + Prosopo captcha = new Prosopo(); + captcha.SetSiteKey("5EZVvsHMrKCFKp5NYNoTyDjTjetoVo1Z4UNNbTwJf1GfN6Xm"); + captcha.SetUrl("https://www.twickets.live/"); + + try + { + solver.Solve(captcha).Wait(); + Console.WriteLine("Captcha solved: " + captcha.Code); + } + catch (AggregateException e) + { + Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message); + } + } + } +} \ No newline at end of file diff --git a/TwoCaptcha.Examples/Run.cs b/TwoCaptcha.Examples/Run.cs index a218289..2240f56 100644 --- a/TwoCaptcha.Examples/Run.cs +++ b/TwoCaptcha.Examples/Run.cs @@ -199,6 +199,16 @@ public static void Main(string[] args) YandexOptionsExample YandexOptionsExample = new YandexOptionsExample(apiKey); break; + case "ProsopoExample": + ProsopoExample ProsopoExample = new ProsopoExample(apiKey); + break; + + case "CaptchafoxExample": + CaptchafoxExample CaptchafoxExample = new CaptchafoxExample(apiKey); + break; + + case "TemuExample": + TemuExample TemuExample = new TemuExample(apiKey); case "VkImageExample": VkImageExample VkImageExample = new VkImageExample(apiKey); break; diff --git a/TwoCaptcha.Examples/TemuExample.cs b/TwoCaptcha.Examples/TemuExample.cs new file mode 100644 index 0000000..88d5d98 --- /dev/null +++ b/TwoCaptcha.Examples/TemuExample.cs @@ -0,0 +1,43 @@ +using System; +using System.IO; +using System.Linq; +using TwoCaptcha.Captcha; + +namespace TwoCaptcha.Examples +{ + public class TemuExample + { + public TemuExample(string apiKey) + { + TwoCaptcha solver = new TwoCaptcha(apiKey); + + byte[] bodyBytes = File.ReadAllBytes("resources/temu/body.png"); + string bodyStr = Convert.ToBase64String(bodyBytes); + + byte[] part1Bytes = File.ReadAllBytes("resources/temu/part1.png"); + string part1Str = Convert.ToBase64String(part1Bytes); + + byte[] part2Bytes = File.ReadAllBytes("resources/temu/part2.png"); + string part2Str = Convert.ToBase64String(part2Bytes); + + byte[] part3Bytes = File.ReadAllBytes("resources/temu/part3.png"); + string part3Str = Convert.ToBase64String(part3Bytes); + + Temu captcha = new Temu(); + captcha.SetBody(bodyStr); + captcha.SetPart1(part1Str); + captcha.SetPart2(part2Str); + captcha.SetPart3(part3Str); + + try + { + solver.Solve(captcha).Wait(); + Console.WriteLine("Captcha solved: " + captcha.Code); + } + catch (AggregateException e) + { + Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message); + } + } + } +} \ No newline at end of file diff --git a/TwoCaptcha.Examples/TwoCaptcha.Examples.csproj b/TwoCaptcha.Examples/TwoCaptcha.Examples.csproj index 442d461..a0942a3 100644 --- a/TwoCaptcha.Examples/TwoCaptcha.Examples.csproj +++ b/TwoCaptcha.Examples/TwoCaptcha.Examples.csproj @@ -10,6 +10,21 @@ + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + PreserveNewest @@ -83,6 +98,28 @@ + + PreserveNewest + + + + + + PreserveNewest + + + + + + PreserveNewest + + + + + + PreserveNewest + + PreserveNewest diff --git a/TwoCaptcha.Examples/resources/temu/body.png b/TwoCaptcha.Examples/resources/temu/body.png new file mode 100644 index 0000000..e45ed92 Binary files /dev/null and b/TwoCaptcha.Examples/resources/temu/body.png differ diff --git a/TwoCaptcha.Examples/resources/temu/part1.png b/TwoCaptcha.Examples/resources/temu/part1.png new file mode 100644 index 0000000..792f6de Binary files /dev/null and b/TwoCaptcha.Examples/resources/temu/part1.png differ diff --git a/TwoCaptcha.Examples/resources/temu/part2.png b/TwoCaptcha.Examples/resources/temu/part2.png new file mode 100644 index 0000000..de5a603 Binary files /dev/null and b/TwoCaptcha.Examples/resources/temu/part2.png differ diff --git a/TwoCaptcha.Examples/resources/temu/part3.png b/TwoCaptcha.Examples/resources/temu/part3.png new file mode 100644 index 0000000..be84dba Binary files /dev/null and b/TwoCaptcha.Examples/resources/temu/part3.png differ diff --git a/TwoCaptcha.Tests/CaptchafoxTest.cs b/TwoCaptcha.Tests/CaptchafoxTest.cs new file mode 100644 index 0000000..5645050 --- /dev/null +++ b/TwoCaptcha.Tests/CaptchafoxTest.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using NUnit.Framework; +using TwoCaptcha.Captcha; + +namespace TwoCaptcha.Tests +{ + [TestFixture] + public class CaptchafoxTest : AbstractWrapperTestCase + { + [Test] + public async Task TestAllOptions() + { + Captchafox captcha = new Captchafox(); + captcha.SetSiteKey("sk_ILKWNruBBVKDOM7dZs59KHnDLEWiH"); + captcha.SetUrl("https://mysite.com/page/with/captchafox"); + captcha.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"); + captcha.SetProxy("HTTPS", "username:password@1.2.3.4:5678"); + + var parameters = new Dictionary(); + parameters["method"] = "captchafox"; + parameters["sitekey"] = "sk_ILKWNruBBVKDOM7dZs59KHnDLEWiH"; + parameters["pageurl"] = "https://mysite.com/page/with/captchafox"; + parameters["userAgent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"; + parameters["proxy"] = "username:password@1.2.3.4:5678"; + parameters["proxytype"] = "HTTPS"; + parameters["soft_id"] = "4582"; + + await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters); + } + } +} \ No newline at end of file diff --git a/TwoCaptcha.Tests/ProsopoTest.cs b/TwoCaptcha.Tests/ProsopoTest.cs new file mode 100644 index 0000000..cd517fd --- /dev/null +++ b/TwoCaptcha.Tests/ProsopoTest.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using NUnit.Framework; +using TwoCaptcha.Captcha; + +namespace TwoCaptcha.Tests +{ + [TestFixture] + public class ProsopoTest : AbstractWrapperTestCase + { + [Test] + public async Task TestAllOptions() + { + Prosopo captcha = new Prosopo(); + captcha.SetSiteKey("5EZVvsHMrKCFKp5NYNoTyDjTjetoVo1Z4UNNbTwJf1GfN6Xm"); + captcha.SetUrl("https://www.twickets.live/"); + + var parameters = new Dictionary(); + parameters["method"] = "prosopo"; + parameters["sitekey"] = "5EZVvsHMrKCFKp5NYNoTyDjTjetoVo1Z4UNNbTwJf1GfN6Xm"; + parameters["pageurl"] = "https://www.twickets.live/"; + parameters["soft_id"] = "4582"; + + await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters); + } + } +} \ No newline at end of file diff --git a/TwoCaptcha.Tests/TemuTest.cs b/TwoCaptcha.Tests/TemuTest.cs new file mode 100644 index 0000000..e85d700 --- /dev/null +++ b/TwoCaptcha.Tests/TemuTest.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using NUnit.Framework; +using TwoCaptcha.Captcha; + +namespace TwoCaptcha.Tests +{ + [TestFixture] + public class TemuTest : AbstractWrapperTestCase + { + + [Test] + public async Task TestAllParameters() + { + byte[] bodyBytes = File.ReadAllBytes("resources/temu/body.png"); + string bodyStr = Convert.ToBase64String(bodyBytes); + + byte[] part1Bytes = File.ReadAllBytes("resources/temu/part1.png"); + string part1Str = Convert.ToBase64String(part1Bytes); + + byte[] part2Bytes = File.ReadAllBytes("resources/temu/part2.png"); + string part2Str = Convert.ToBase64String(part2Bytes); + + byte[] part3Bytes = File.ReadAllBytes("resources/temu/part3.png"); + string part3Str = Convert.ToBase64String(part3Bytes); + + Temu captcha = new Temu(); + captcha.SetBody(bodyStr); + captcha.SetPart1(part1Str); + captcha.SetPart2(part2Str); + captcha.SetPart3(part3Str); + + + var parameters = new Dictionary(); + parameters["method"] = "temuimage"; + parameters["body"] = bodyStr; + parameters["part1"] = part1Str; + parameters["part2"] = part2Str; + parameters["part3"] = part3Str; + parameters["soft_id"] = "4582"; + + + await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters); + } + + } +} \ No newline at end of file diff --git a/TwoCaptcha.Tests/TwoCaptcha.Tests.csproj b/TwoCaptcha.Tests/TwoCaptcha.Tests.csproj index c851b0f..7c1ec8f 100644 --- a/TwoCaptcha.Tests/TwoCaptcha.Tests.csproj +++ b/TwoCaptcha.Tests/TwoCaptcha.Tests.csproj @@ -16,4 +16,19 @@ + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + \ No newline at end of file diff --git a/TwoCaptcha.Tests/resources/temu/body.png b/TwoCaptcha.Tests/resources/temu/body.png new file mode 100644 index 0000000..e45ed92 Binary files /dev/null and b/TwoCaptcha.Tests/resources/temu/body.png differ diff --git a/TwoCaptcha.Tests/resources/temu/part1.png b/TwoCaptcha.Tests/resources/temu/part1.png new file mode 100644 index 0000000..792f6de Binary files /dev/null and b/TwoCaptcha.Tests/resources/temu/part1.png differ diff --git a/TwoCaptcha.Tests/resources/temu/part2.png b/TwoCaptcha.Tests/resources/temu/part2.png new file mode 100644 index 0000000..de5a603 Binary files /dev/null and b/TwoCaptcha.Tests/resources/temu/part2.png differ diff --git a/TwoCaptcha.Tests/resources/temu/part3.png b/TwoCaptcha.Tests/resources/temu/part3.png new file mode 100644 index 0000000..be84dba Binary files /dev/null and b/TwoCaptcha.Tests/resources/temu/part3.png differ diff --git a/TwoCaptcha/Captcha/Captcha.cs b/TwoCaptcha/Captcha/Captcha.cs index ee81ffd..14cb8ec 100644 --- a/TwoCaptcha/Captcha/Captcha.cs +++ b/TwoCaptcha/Captcha/Captcha.cs @@ -58,6 +58,11 @@ public Dictionary GetFiles() return new Dictionary(files); } + public void SetUserAgent(string userAgent) + { + parameters["userAgent"] = userAgent; + } + public void SetSiteKey(String siteKey) { parameters["sitekey"] = siteKey; diff --git a/TwoCaptcha/Captcha/Captchafox.cs b/TwoCaptcha/Captcha/Captchafox.cs new file mode 100644 index 0000000..cea15b3 --- /dev/null +++ b/TwoCaptcha/Captcha/Captchafox.cs @@ -0,0 +1,20 @@ +namespace TwoCaptcha.Captcha +{ + public class Captchafox : Captcha + { + public Captchafox() : base() + { + parameters["method"] = "captchafox"; + } + + public void SetSiteKey(string siteKey) + { + parameters["sitekey"] = siteKey; + } + + public void SetUrl(string url) + { + parameters["pageurl"] = url; + } + } +} \ No newline at end of file diff --git a/TwoCaptcha/Captcha/Prosopo.cs b/TwoCaptcha/Captcha/Prosopo.cs new file mode 100644 index 0000000..42d4043 --- /dev/null +++ b/TwoCaptcha/Captcha/Prosopo.cs @@ -0,0 +1,20 @@ +namespace TwoCaptcha.Captcha +{ + public class Prosopo : Captcha + { + public Prosopo() : base() + { + parameters["method"] = "prosopo"; + } + + public void SetSiteKey(string siteKey) + { + parameters["sitekey"] = siteKey; + } + + public void SetUrl(string url) + { + parameters["pageurl"] = url; + } + } +} \ No newline at end of file diff --git a/TwoCaptcha/Captcha/Temu.cs b/TwoCaptcha/Captcha/Temu.cs new file mode 100644 index 0000000..8db3bf2 --- /dev/null +++ b/TwoCaptcha/Captcha/Temu.cs @@ -0,0 +1,30 @@ +using System; +using System.IO; + +namespace TwoCaptcha.Captcha +{ + public class Temu : Captcha + { + public Temu() : base() + { + parameters["method"] = "temuimage"; + } + + public void SetBody(String body) + { + parameters["body"] = body; + } + public void SetPart1(String part1) + { + parameters["part1"] = part1; + } + public void SetPart2(String part2) + { + parameters["part2"] = part2; + } + public void SetPart3(String part3) + { + parameters["part3"] = part3; + } + } +} \ No newline at end of file