Skip to content

Commit 44189c6

Browse files
author
victorkowalski
committed
merge
2 parents d5c3cac + 38a6761 commit 44189c6

31 files changed

Lines changed: 726 additions & 28 deletions
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Publish to NuGet
2+
3+
on:
4+
push:
5+
# Запускать только при пуше тегов версий,
6+
# например 1.4.1 или v1.4.1
7+
tags:
8+
- 'v*'
9+
- '[0-9]+.[0-9]+.[0-9]+'
10+
11+
jobs:
12+
build-and-publish:
13+
name: Build and publish to NuGet
14+
runs-on: ubuntu-latest
15+
16+
env:
17+
# Имя основного проекта библиотеки
18+
PROJECT_PATH: TwoCaptcha/TwoCaptcha.csproj
19+
# Версию берём из имени тега, например 1.4.1 или v1.4.1
20+
TAG_NAME: ${{ github.ref_name }}
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Normalize version from tag
27+
id: version
28+
run: |
29+
tag="${TAG_NAME}"
30+
# Убираем префикс v, если используется формат v1.2.3
31+
version="${tag#v}"
32+
echo "version=$version" >> "$GITHUB_OUTPUT"
33+
34+
- name: Setup .NET
35+
uses: actions/setup-dotnet@v4
36+
with:
37+
dotnet-version: '7.0.x'
38+
39+
- name: Restore
40+
run: dotnet restore
41+
42+
- name: Build
43+
run: dotnet build $PROJECT_PATH -c Release --no-restore
44+
45+
- name: Pack
46+
run: |
47+
dotnet pack $PROJECT_PATH -c Release \
48+
-o ./artifacts \
49+
/p:PackageVersion=${{ steps.version.outputs.version }}
50+
51+
- name: Publish to NuGet
52+
run: |
53+
dotnet nuget push "artifacts/*.nupkg" \
54+
--api-key "${{ secrets.NUGET_API_KEY }}" \
55+
--source "https://api.nuget.org/v3/index.json" \
56+
--skip-duplicate

README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ Examples of API requests for different captcha types are available on the [C# ca
4343
- [DataDome](#datadome)
4444
- [atbCAPTCHA](#atbcaptcha)
4545
- [Tencent](#tencent)
46+
- [Prosopo](#prosopo)
47+
- [Captchafox](#captchafox)
48+
- [Temu](#temu)
49+
- [VK Image](#vk-image)
50+
- [VK Captcha](#vk-captcha)
4651
- [Other methods](#other-methods)
4752
- [send / getResult](#send--getresult)
4853
- [balance](#balance)
@@ -490,6 +495,83 @@ tencent.SetAppId("190014885");
490495
tencent.SetPageUrl("https://www.example.com/");
491496
```
492497

498+
### Prosopo
499+
500+
<sup>[API method description.](https://2captcha.com/2captcha-api#prosopo-procaptcha)</sup>
501+
502+
Use this method to solve Prosopo and obtain a token to bypass the protection.
503+
504+
505+
```csharp
506+
Prosopo captcha = new Prosopo();
507+
508+
captcha.SetSiteKey("5EZVvsHMrKCFKp5NYNoTyDjTjetoVo1Z4UNNbTwJf1GfN6Xm");
509+
captcha.SetUrl("https://www.twickets.live/");
510+
```
511+
512+
### Captchafox
513+
514+
<sup>[API method description.](https://2captcha.com/2captcha-api#captchafox)</sup>
515+
516+
Use this method to solve Captchafox and obtain a token to bypass the protection.
517+
518+
519+
```csharp
520+
Captchafox captcha = new Captchafox();
521+
captcha.SetSiteKey("sk_ILKWNruBBVKDOM7dZs59KHnDLEWiH");
522+
captcha.SetUrl("https://mysite.com/page/with/captchafox");
523+
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");
524+
captcha.SetProxy("HTTPS", "login:password@IP_address:PORT");
525+
```
526+
527+
### Temu
528+
529+
<sup>[API method description.](https://2captcha.com/2captcha-api#temucaptcha)</sup>
530+
531+
This method can be used to solve Temu. Returns a coordinates.
532+
533+
```csharp
534+
Temu captcha = new Temu();
535+
captcha.SetBody(bodyStr);
536+
captcha.SetPart1(part1Str);
537+
captcha.SetPart2(part2Str);
538+
captcha.SetPart3(part3Str);
539+
```
540+
541+
### VK Image
542+
543+
<sup>[API method description.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>
544+
545+
We offer two methods to solve this type of captcha - token-based and image-based.
546+
547+
We use the body (image in base64 format) or file (image as file) and steps parameters.
548+
You can get both values from the response to the request https://api.vk.com/method/captchaNotRobot.getContent?v={API_VER} when loading the captcha widget on the page.
549+
550+
```csharp
551+
TwoCaptcha solver = new TwoCaptcha(apiKey);
552+
553+
byte[] bytes = File.ReadAllBytes("resources/vk.jpg");
554+
string base64EncodedImage = Convert.ToBase64String(bytes);
555+
556+
VkCaptcha captcha = new VkCaptcha("vkimage");
557+
captcha.SetBase64(base64EncodedImage);
558+
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]");
559+
```
560+
561+
### VK Captcha
562+
563+
<sup>[API method description.](https://2captcha.com/2captcha-api#vk-captcha)</sup>
564+
565+
Token-based method requires redirect_uri parameter, as well as proxy and userAgent. The value of the redirect_uri parameter can be found in the response to requests to the VK API that return captchas.
566+
567+
```csharp
568+
VkCaptcha captcha = new VkCaptcha("vkcaptcha");
569+
570+
captcha.SetRedirectUri("https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJ....HGsc5B4LyvjA&variant=popup&blank=1");
571+
captcha.SetuserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36");
572+
captcha.SetProxy("http", "1.2.3.4");
573+
```
574+
493575

494576
## Other methods
495577

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using System.Linq;
3+
using TwoCaptcha.Captcha;
4+
5+
namespace TwoCaptcha.Examples
6+
{
7+
public class CaptchafoxExample
8+
{
9+
public CaptchafoxExample(string apiKey)
10+
{
11+
TwoCaptcha solver = new TwoCaptcha(apiKey);
12+
13+
Captchafox captcha = new Captchafox();
14+
captcha.SetSiteKey("sk_ILKWNruBBVKDOM7dZs59KHnDLEWiH");
15+
captcha.SetUrl("https://mysite.com/page/with/captchafox");
16+
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");
17+
captcha.SetProxy("HTTPS", "login:password@IP_address:PORT");
18+
19+
try
20+
{
21+
solver.Solve(captcha).Wait();
22+
Console.WriteLine("Captcha solved: " + captcha.Code);
23+
}
24+
catch (AggregateException e)
25+
{
26+
Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
27+
}
28+
}
29+
}
30+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Linq;
3+
using TwoCaptcha.Captcha;
4+
5+
namespace TwoCaptcha.Examples
6+
{
7+
public class ProsopoExample
8+
{
9+
public ProsopoExample(string apiKey)
10+
{
11+
TwoCaptcha solver = new TwoCaptcha(apiKey);
12+
13+
Prosopo captcha = new Prosopo();
14+
captcha.SetSiteKey("5EZVvsHMrKCFKp5NYNoTyDjTjetoVo1Z4UNNbTwJf1GfN6Xm");
15+
captcha.SetUrl("https://www.twickets.live/");
16+
17+
try
18+
{
19+
solver.Solve(captcha).Wait();
20+
Console.WriteLine("Captcha solved: " + captcha.Code);
21+
}
22+
catch (AggregateException e)
23+
{
24+
Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
25+
}
26+
}
27+
}
28+
}

TwoCaptcha.Examples/Run.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,24 @@ public static void Main(string[] args)
198198
case "YandexOptionsExample":
199199
YandexOptionsExample YandexOptionsExample = new YandexOptionsExample(apiKey);
200200
break;
201+
202+
case "ProsopoExample":
203+
ProsopoExample ProsopoExample = new ProsopoExample(apiKey);
204+
break;
205+
206+
case "CaptchafoxExample":
207+
CaptchafoxExample CaptchafoxExample = new CaptchafoxExample(apiKey);
208+
break;
209+
210+
case "TemuExample":
211+
TemuExample TemuExample = new TemuExample(apiKey);
212+
case "VkImageExample":
213+
VkImageExample VkImageExample = new VkImageExample(apiKey);
214+
break;
215+
216+
case "VkCaptchaExample":
217+
VkCaptchaExample VkCaptchaExample = new VkCaptchaExample(apiKey);
218+
break;
201219
}
202220
}
203221
}

TwoCaptcha.Examples/TemuExample.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.IO;
3+
using System.Linq;
4+
using TwoCaptcha.Captcha;
5+
6+
namespace TwoCaptcha.Examples
7+
{
8+
public class TemuExample
9+
{
10+
public TemuExample(string apiKey)
11+
{
12+
TwoCaptcha solver = new TwoCaptcha(apiKey);
13+
14+
byte[] bodyBytes = File.ReadAllBytes("resources/temu/body.png");
15+
string bodyStr = Convert.ToBase64String(bodyBytes);
16+
17+
byte[] part1Bytes = File.ReadAllBytes("resources/temu/part1.png");
18+
string part1Str = Convert.ToBase64String(part1Bytes);
19+
20+
byte[] part2Bytes = File.ReadAllBytes("resources/temu/part2.png");
21+
string part2Str = Convert.ToBase64String(part2Bytes);
22+
23+
byte[] part3Bytes = File.ReadAllBytes("resources/temu/part3.png");
24+
string part3Str = Convert.ToBase64String(part3Bytes);
25+
26+
Temu captcha = new Temu();
27+
captcha.SetBody(bodyStr);
28+
captcha.SetPart1(part1Str);
29+
captcha.SetPart2(part2Str);
30+
captcha.SetPart3(part3Str);
31+
32+
try
33+
{
34+
solver.Solve(captcha).Wait();
35+
Console.WriteLine("Captcha solved: " + captcha.Code);
36+
}
37+
catch (AggregateException e)
38+
{
39+
Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
40+
}
41+
}
42+
}
43+
}

TwoCaptcha.Examples/TwoCaptcha.Examples.csproj

Lines changed: 72 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,47 @@
1-
<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2-
3-
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
5-
<IsPackable>false</IsPackable>
6-
<OutputType>Exe</OutputType>
7-
</PropertyGroup>
8-
9-
<ItemGroup>
10-
<ProjectReference Include="..\TwoCaptcha\TwoCaptcha.csproj" />
11-
</ItemGroup>
12-
13-
<ItemGroup>
14-
<None Update="resources\audio-en.mp3">
15-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
16-
</None>
17-
</ItemGroup>
18-
19-
<ItemGroup>
20-
<None Update="resources\audio-ru.mp3">
21-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
22-
</None>
23-
</ItemGroup>
1+
<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
242

25-
<ItemGroup>
26-
<None Update="resources\canvas.jpg">
27-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3+
<PropertyGroup>
4+
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
5+
<IsPackable>false</IsPackable>
6+
<OutputType>Exe</OutputType>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\TwoCaptcha\TwoCaptcha.csproj" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<Compile Update="Properties\Resources.Designer.cs">
15+
<DesignTime>True</DesignTime>
16+
<AutoGen>True</AutoGen>
17+
<DependentUpon>Resources.resx</DependentUpon>
18+
</Compile>
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<EmbeddedResource Update="Properties\Resources.resx">
23+
<Generator>ResXFileCodeGenerator</Generator>
24+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
25+
</EmbeddedResource>
26+
</ItemGroup>
27+
28+
<ItemGroup>
29+
<None Update="resources\audio-en.mp3">
30+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
31+
</None>
32+
</ItemGroup>
33+
34+
<ItemGroup>
35+
<None Update="resources\audio-ru.mp3">
36+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2837
</None>
29-
</ItemGroup>
38+
</ItemGroup>
39+
40+
<ItemGroup>
41+
<None Update="resources\canvas.jpg">
42+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
43+
</None>
44+
</ItemGroup>
3045

3146
<ItemGroup>
3247
<None Update="resources\canvas_hint.jpg">
@@ -81,5 +96,35 @@
8196
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
8297
</None>
8398
</ItemGroup>
99+
100+
<ItemGroup>
101+
<None Update="resources\temu\body.png">
102+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
103+
</None>
104+
</ItemGroup>
105+
106+
<ItemGroup>
107+
<None Update="resources\temu\part1.png">
108+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
109+
</None>
110+
</ItemGroup>
111+
112+
<ItemGroup>
113+
<None Update="resources\temu\part2.png">
114+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
115+
</None>
116+
</ItemGroup>
117+
118+
<ItemGroup>
119+
<None Update="resources\temu\part3.png">
120+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
121+
</None>
122+
</ItemGroup>
123+
124+
<ItemGroup>
125+
<None Update="resources\vk.jpg">
126+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
127+
</None>
128+
</ItemGroup>
84129

85130
</Project>

0 commit comments

Comments
 (0)