Skip to content

Commit eda9c71

Browse files
added enterprise (v2 & v3) reCAPTCHA and cookie_input param
1 parent 23b63f5 commit eda9c71

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

lib/imagetyperzapi.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# -------------------------------------------------------------------------------------------
1111
CAPTCHA_ENDPOINT = '/Forms/UploadFileAndGetTextNEW.ashx'
1212
RECAPTCHA_SUBMIT_ENDPOINT = '/captchaapi/UploadRecaptchaV1.ashx'
13+
RECAPTCHA_ENT_SUBMIT_ENDPOINT = 'http://captchatypers.com/captchaapi/UploadRecaptchaEnt.ashx'
1314
RECAPTCHA_RETRIEVE_ENDPOINT = '/captchaapi/GetRecaptchaText.ashx'
1415
BALANCE_ENDPOINT = '/Forms/RequestBalance.ashx'
1516
BAD_IMAGE_ENDPOINT = '/Forms/SetBadImage.ashx'
@@ -177,9 +178,15 @@ def submit_recaptcha(d)
177178
data['useragent'] = d['user_agent']
178179
end
179180

180-
# v3
181+
# type / enterprise
181182
if d.key? 'type'
182183
data['recaptchatype'] = d['type']
184+
if d['type'].to_s == '4' || d['type'].to_s == '5'
185+
url = RECAPTCHA_ENT_SUBMIT_ENDPOINT
186+
end
187+
if d['type'].to_s == '5'
188+
data['enterprise_type'] = 'v3'
189+
end
183190
end
184191
if d.key? 'v3_action'
185192
data['captchaaction'] = d['v3_action']
@@ -190,7 +197,9 @@ def submit_recaptcha(d)
190197
if d.key? 'data-s'
191198
data['data-s'] = d['data-s']
192199
end
193-
200+
if d.key? 'cookie_input'
201+
data['cookie_input'] = d['cookie_input']
202+
end
194203

195204
# make request
196205
http = Net::HTTP.new(ROOT_DOMAIN, 80)

readme.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,18 @@ It works with URL instead of image file too.
6262
For recaptcha submission there are two things that are required.
6363
- page_url (**required**)
6464
- site_key (**required**)
65-
- type - can be one of this 3 values: `1` - normal, `2` - invisible, `3` - v3 (it's optional, defaults to `1`)
65+
- type (optional, defaults to 1 if not given)
66+
- `1` - v2
67+
- `2` - invisible
68+
- `3` - v3
69+
- `4` - enterprise v2
70+
- `5` - enterprise v3
6671
- v3_min_score - minimum score to target for v3 recaptcha `- optional`
6772
- v3_action - action parameter to use for v3 recaptcha `- optional`
6873
- proxy - proxy to use when solving recaptcha, eg. `12.34.56.78:1234` or `12.34.56.78:1234:user:password` `- optional`
6974
- user_agent - useragent to use when solve recaptcha `- optional`
7075
- data-s - extra parameter used in solving recaptcha `- optional`
76+
- cookie_input - cookies used in solving reCAPTCHA - `- optional`
7177

7278
``` ruby
7379
d = {}
@@ -79,6 +85,7 @@ d['sitekey'] = '7LrGJmcUABBAALFtIb_FxC0LXm_GwOLyJAfbbUCL'
7985
# d['proxy'] = '126.45.34.53:123' # - HTTP proxy - optional
8086
# d['user_agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' # optional
8187
# d['data-s'] = 'recaptcha data-s value' # optional
88+
# d['cookie_input'] = 'a=b;c=d' # optional
8289
captcha_id = ita.submit_recaptcha d
8390
```
8491
ID will be used to retrieve the g-response, once workers have

recaptcha.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,23 @@ def test_api
1717
d = {}
1818
d['page_url'] = 'https://your-site.com'
1919
d['sitekey'] = '7LrGJmcUABBAALFtIb_FxC0LXm_GwOLyJAfbbUCL'
20-
# d['type'] = 3 # optional, defaults to 1
20+
21+
# reCAPTCHA type(s) - optional, defaults to 1
22+
# ---------------------------------------------
23+
# 1 - v2
24+
# 2 - invisible
25+
# 3 - v3
26+
# 4 - enterprise v2
27+
# 5 - enterprise v3
28+
#
29+
# d['type'] = 1 # optional, defaults to 1
30+
#
2131
# d['v3_min_score'] = 0.3 # min score to target when solving v3 - optional
2232
# d['v3_action'] = 'homepage' # action to use when solving v3 - optional
2333
# d['proxy'] = '126.45.34.53:123' # - HTTP proxy - optional
2434
# d['user_agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' # optional
2535
# d['data-s'] = 'recaptcha data-s value' # optional
36+
# d['cookie_input'] = 'a=b;c=d' # optional
2637
captcha_id = ita.submit_recaptcha d
2738
response = nil
2839
while response == nil

0 commit comments

Comments
 (0)