1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace jumper423\decaptcha\services; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class RuCaptchaKeyCaptcha. |
7
|
|
|
*/ |
8
|
|
|
class RuCaptchaKeyCaptcha extends RuCaptcha |
9
|
|
|
{ |
10
|
|
|
public function init() |
11
|
|
|
{ |
12
|
|
|
parent::init(); |
13
|
|
|
|
14
|
|
|
unset( |
15
|
|
|
$this->paramsNames[static::ACTION_FIELD_FILE], |
16
|
|
|
$this->paramsNames[static::ACTION_FIELD_PHRASE], |
17
|
|
|
$this->paramsNames[static::ACTION_FIELD_REGSENSE], |
18
|
|
|
$this->paramsNames[static::ACTION_FIELD_NUMERIC], |
19
|
|
|
$this->paramsNames[static::ACTION_FIELD_MIN_LEN], |
20
|
|
|
$this->paramsNames[static::ACTION_FIELD_MAX_LEN], |
21
|
|
|
$this->paramsNames[static::ACTION_FIELD_LANGUAGE], |
22
|
|
|
$this->paramsNames[static::ACTION_FIELD_LANG], |
23
|
|
|
$this->paramsNames[static::ACTION_FIELD_QUESTION], |
24
|
|
|
$this->paramsNames[static::ACTION_FIELD_INSTRUCTIONS], |
25
|
|
|
$this->paramsNames[static::ACTION_FIELD_CALC], |
26
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_FILE], |
27
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PHRASE], |
28
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_REGSENSE], |
29
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_NUMERIC], |
30
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_MIN_LEN], |
31
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_MAX_LEN], |
32
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LANGUAGE], |
33
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LANG], |
34
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_QUESTION], |
35
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_INSTRUCTIONS], |
36
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_CALC] |
37
|
|
|
); |
38
|
|
|
|
39
|
|
|
$this->paramsNames[static::ACTION_FIELD_SSC_USER_ID] = 's_s_c_user_id'; |
40
|
|
|
$this->paramsNames[static::ACTION_FIELD_SSC_SESSION_ID] = 's_s_c_session_id'; |
41
|
|
|
$this->paramsNames[static::ACTION_FIELD_SSC_WEB_SERVER_SIGN] = 's_s_c_web_server_sign'; |
42
|
|
|
$this->paramsNames[static::ACTION_FIELD_SSC_WEB_SERVER_SIGN2] = 's_s_c_web_server_sign2'; |
43
|
|
|
$this->paramsNames[static::ACTION_FIELD_PAGEURL] = 'pageurl'; |
44
|
|
|
|
45
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_METHOD][static::PARAM_SLUG_DEFAULT] = 'keycaptcha'; |
46
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_SSC_USER_ID] = [ |
47
|
|
|
static::PARAM_SLUG_REQUIRE => true, |
48
|
|
|
static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING, |
49
|
|
|
]; |
50
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_SSC_SESSION_ID] = [ |
51
|
|
|
static::PARAM_SLUG_REQUIRE => true, |
52
|
|
|
static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING, |
53
|
|
|
]; |
54
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_SSC_WEB_SERVER_SIGN] = [ |
55
|
|
|
static::PARAM_SLUG_REQUIRE => true, |
56
|
|
|
static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING, |
57
|
|
|
]; |
58
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_SSC_WEB_SERVER_SIGN2] = [ |
59
|
|
|
static::PARAM_SLUG_REQUIRE => true, |
60
|
|
|
static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING, |
61
|
|
|
]; |
62
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PAGEURL] = [ |
63
|
|
|
static::PARAM_SLUG_REQUIRE => true, |
64
|
|
|
static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING, |
65
|
|
|
]; |
66
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PROXY] = [ |
67
|
|
|
static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING, |
68
|
|
|
]; |
69
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PROXYTYPE] = [ |
70
|
|
|
static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_STRING, |
71
|
|
|
]; |
72
|
|
|
|
73
|
|
|
$this->wiki->setText(['service', 'name'], [ |
74
|
|
|
'ru' => 'RuCaptcha KeyCaptcha', |
75
|
|
|
'en' => 'RuCaptcha KeyCaptcha', |
76
|
|
|
]); |
77
|
|
|
$this->wiki->setText(['recognize', 'price'], [ |
78
|
|
|
'ru' => '1000 решений стоят 39 рублей.', |
79
|
|
|
'en' => '1000 for $0,7', |
80
|
|
|
]); |
81
|
|
|
$this->wiki->setText(['recognize', 'desc'], [ |
82
|
|
|
'ru' => 'KeyCaptcha — это такой вид капчи, для решения которой нужно собрать небольшой пазл. |
83
|
|
|
|
84
|
|
|
Чтобы решить KeyCaptcha с помощью нашего сервиса, нужно: |
85
|
|
|
|
86
|
|
|
1) Найти следующие параметры KeyCaptcha в исходном коде страницы: |
87
|
|
|
|
88
|
|
|
``` |
89
|
|
|
s_s_c_user_id |
90
|
|
|
s_s_c_session_id |
91
|
|
|
s_s_c_web_server_sign |
92
|
|
|
s_s_c_web_server_sign2 |
93
|
|
|
``` |
94
|
|
|
|
95
|
|
|
2) Узакать эти параметры в методе recognize |
96
|
|
|
|
97
|
|
|
3) Найдите и удалите следующий блок, который подключает javascript-файл: |
98
|
|
|
|
99
|
|
|
``` |
100
|
|
|
<script language="JavaScript" src="http://backs.keycaptcha.com/swfs/cap.js"></script> |
101
|
|
|
``` |
102
|
|
|
|
103
|
|
|
Найдите и удалите элемент div с id="div_for_keycaptcha": |
104
|
|
|
|
105
|
|
|
``` |
106
|
|
|
<div id="div_for_keycaptcha"...>...</div> |
107
|
|
|
``` |
108
|
|
|
|
109
|
|
|
``` |
110
|
|
|
Внимание: иногда содержимое страницы генерируется динамически и вы можете не найти нужные элементы или они могут немного отличаться. |
111
|
|
|
В таком случае вам нужно хорошенько разобраться в коде страницы и используемых на ней скриптов. |
112
|
|
|
``` |
113
|
|
|
|
114
|
|
|
4) Найдите элемент с id="capcode" и измените его значение на ответ, полученный от нашего сервера. |
115
|
|
|
|
116
|
|
|
``` |
117
|
|
|
<input name="capcode" id="capcode" value="-->CODE<--" type="hidden"> |
118
|
|
|
``` |
119
|
|
|
|
120
|
|
|
5) Отправить форму.', |
121
|
|
|
'en' => 'KeyCaptcha is a kind of captcha, for the solution of which you need to assemble a small puzzle. |
122
|
|
|
|
123
|
|
|
To solve KeyCaptcha using our service, you need: |
124
|
|
|
|
125
|
|
|
1) Find the following KeyCaptcha parameters in the page source code: |
126
|
|
|
|
127
|
|
|
``` |
128
|
|
|
s_s_c_user_id |
129
|
|
|
s_s_c_session_id |
130
|
|
|
s_s_c_web_server_sign |
131
|
|
|
s_s_c_web_server_sign2 |
132
|
|
|
``` |
133
|
|
|
|
134
|
|
|
2) See these parameters in the method recognize |
135
|
|
|
|
136
|
|
|
3) Find and delete the following block that connects the javascript file: |
137
|
|
|
|
138
|
|
|
``` |
139
|
|
|
<script language = "JavaScript" src = "http://backs.keycaptcha.com/swfs/cap.js"> </ script> |
140
|
|
|
``` |
141
|
|
|
|
142
|
|
|
Find and delete the div element with id = "div_for_keycaptcha": |
143
|
|
|
|
144
|
|
|
``` |
145
|
|
|
<div id = "div_for_keycaptcha" ...> ... </ div> |
146
|
|
|
``` |
147
|
|
|
|
148
|
|
|
``` |
149
|
|
|
Attention: sometimes the page content is dynamically generated and you may not find the elements you need or they may differ slightly. |
150
|
|
|
In this case, you need to thoroughly understand the code of the page and the scripts used on it. |
151
|
|
|
``` |
152
|
|
|
|
153
|
|
|
4) Find the element with id = "capcode" and change its value to the response received from our server. |
154
|
|
|
|
155
|
|
|
``` |
156
|
|
|
<input name = "capcode" id = "capcode" value = "-> CODE <-" type = "hidden"> |
157
|
|
|
``` |
158
|
|
|
|
159
|
|
|
5) Submit the form.', |
160
|
|
|
]); |
161
|
|
|
$this->wiki->setText(['recognize', 'data'], [ |
162
|
|
|
static::ACTION_FIELD_PAGEURL => 'https://www.keycaptcha.com/signup/', |
163
|
|
|
static::ACTION_FIELD_SSC_USER_ID => '15', |
164
|
|
|
static::ACTION_FIELD_SSC_SESSION_ID => 'd49b0eb43165997c786bdb62a75aa12c', |
165
|
|
|
static::ACTION_FIELD_SSC_WEB_SERVER_SIGN => 'dbf758481b1371aa641364276b5ff0c4-pz-', |
166
|
|
|
static::ACTION_FIELD_SSC_WEB_SERVER_SIGN2 => '1117c0251c885edd1ce16dff799e5310', |
167
|
|
|
]); |
168
|
|
|
$this->wiki->setText(['recognize', 'file'], false); |
169
|
|
|
$this->wiki->setText(['menu', 'from_service'], [ |
170
|
|
|
RuCaptcha::class, |
171
|
|
|
RuCaptchaClick::class, |
172
|
|
|
RuCaptchaInstruction::class, |
173
|
|
|
RuCaptchaGrid::class, |
174
|
|
|
RuCaptchaReCaptcha::class, |
175
|
|
|
RuCaptchaFunCaptcha::class, |
176
|
|
|
RuCaptchaReCaptchaV3::class, |
177
|
|
|
RuCaptchaGeeTest::class, |
178
|
|
|
]); |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
public function recognize($additionally = [], $null = null) |
182
|
|
|
{ |
183
|
|
|
return parent::recognize(null, $additionally); |
184
|
|
|
} |
185
|
|
|
} |
186
|
|
|
|