diff --git a/README.md b/README.md index 4971f23..2f7bb28 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) - [Other methods](#other-methods) - [send / getResult](#send--getresult) - [balance](#balance) @@ -488,6 +491,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); +``` + ## Other methods 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 c190662..005c544 100644 --- a/TwoCaptcha.Examples/Run.cs +++ b/TwoCaptcha.Examples/Run.cs @@ -198,6 +198,18 @@ public static void Main(string[] args) case "YandexOptionsExample": 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); + 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 08a4b39..8f46aa2 100644 --- a/TwoCaptcha.Examples/TwoCaptcha.Examples.csproj +++ b/TwoCaptcha.Examples/TwoCaptcha.Examples.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1;net5.0;net6.0;net7.0 @@ -10,6 +10,21 @@ + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + PreserveNewest @@ -81,5 +96,28 @@ PreserveNewest - + + + + PreserveNewest + + + + + + PreserveNewest + + + + + + PreserveNewest + + + + + + PreserveNewest + + \ No newline at end of file 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 f075824..91aa8d3 100644 --- a/TwoCaptcha/Captcha/Captcha.cs +++ b/TwoCaptcha/Captcha/Captcha.cs @@ -57,5 +57,10 @@ public Dictionary GetFiles() { return new Dictionary(files); } + + public void SetUserAgent(string userAgent) + { + parameters["userAgent"] = userAgent; + } } } \ No newline at end of file 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