From 4c70fcc120b80dcba0ec233a2d349e5022aaf2c4 Mon Sep 17 00:00:00 2001 From: Maxim S Date: Mon, 10 Jun 2024 20:52:55 +0200 Subject: [PATCH] - Updated parameter values in the examples folder for hcaptcha, keycaptcha, lemin, recaptcha - Added comments about dynamic parameters for geetest and amazon Signed-off-by: Maxim S --- examples/amazon_waf.py | 5 +++++ examples/amazon_waf_options.py | 5 +++++ examples/geetest.py | 16 ++++++++++------ examples/geetest_options.py | 16 ++++++++++------ examples/hcaptcha.py | 2 +- examples/keycaptcha.py | 10 +++++----- examples/keycaptcha_options.py | 17 ++++++++--------- examples/lemin.py | 2 +- examples/recaptcha_v2.py | 4 ++-- examples/recaptcha_v2_options.py | 4 ++-- 10 files changed, 49 insertions(+), 32 deletions(-) diff --git a/examples/amazon_waf.py b/examples/amazon_waf.py index ea00bee..3a79e0c 100644 --- a/examples/amazon_waf.py +++ b/examples/amazon_waf.py @@ -15,6 +15,11 @@ solver = TwoCaptcha(api_key) +""" +Important: the values of the 'iv' and 'context' parameters are dynamic, for every request to our API you need to get new values. +The values 'iv' and 'context' need to be looked for in the page code. +""" + try: result = solver.amazon_waf( sitekey='AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AFsClhVgr5q0UFRdXhhHEwiAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMLMbH8d6uQSrYTraoAgEQgDvtSNxdEyG7Zu393cHyPdWNCZgeIB52+W7fCTI8U5z15z1NdPUdnB1ZHoK7ewpwoSMm5mzkJJld0cnvGw==', diff --git a/examples/amazon_waf_options.py b/examples/amazon_waf_options.py index c1bbbb6..31c6d92 100644 --- a/examples/amazon_waf_options.py +++ b/examples/amazon_waf_options.py @@ -26,6 +26,11 @@ solver = TwoCaptcha(**config) +""" +Important: the values of the 'iv' and 'context' parameters are dynamic, for every request to our API you need to get new values. +The values 'iv' and 'context' need to be looked for in the page code. +""" + try: result = solver.amazon_waf(sitekey='AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AGIqvS8v6ScFa8ZpNRrlQgKAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMx9gxoe10Zg35PWhzAgEQgDvUtMMkqkFQByMLK2329D8iX4mjvaTuUhU70LD4vLp54v3+4K1nYY2hB+OM1hMbncnMbP63y4UOrY77jg==', iv='CgAGVTNd9JAAAAnB', diff --git a/examples/geetest.py b/examples/geetest.py index 405e949..2819a29 100644 --- a/examples/geetest.py +++ b/examples/geetest.py @@ -15,17 +15,21 @@ solver = TwoCaptcha(api_key) -resp = requests.get("https://www.mysite.com/distil_r_captcha_challenge") -challenge = resp.content.decode('utf-8').split(';')[0] +""" +Important: the value of the 'challenge' parameter is dynamic, for each request to our API you need to get a new value. +""" + +resp = requests.get("https://2captcha.com/api/v1/captcha-demo/gee-test/init-params") +challenge = resp.json()['challenge'] try: - result = solver.geetest(gt='f3bf6dbdcf7886856696502e1d55e00c', - apiServer='api-na.geetest.com', + result = solver.geetest(gt='81388ea1fc187e0c335c0a8907ff2625', + apiServer='http://api.geetest.com', challenge=challenge, - url='https://www.mysite.com/distil_r_captcha.html') + url='https://2captcha.com/demo/geetest') except Exception as e: sys.exit(e) else: - sys.exit('result: ' + str(result)) + sys.exit('result: ' + str(result)) \ No newline at end of file diff --git a/examples/geetest_options.py b/examples/geetest_options.py index 919bc04..39c491c 100644 --- a/examples/geetest_options.py +++ b/examples/geetest_options.py @@ -15,15 +15,19 @@ solver = TwoCaptcha(api_key, defaultTimeout=300, pollingInterval=10) -resp = requests.get("https://www.mysite.com/distil_r_captcha_challenge") -challenge = resp.content.decode('utf-8').split(';')[0] +""" +Important: the value of the 'challenge' parameter is dynamic, for each request to our API you need to get a new value. +""" + +resp = requests.get("https://2captcha.com/api/v1/captcha-demo/gee-test/init-params") +challenge = resp.json()['challenge'] try: result = solver.geetest( - gt='f3bf6dbdcf7886856696502e1d55e00c', - apiServer='api-na.geetest.com', + gt='81388ea1fc187e0c335c0a8907ff2625', + apiServer='http://api.geetest.com', challenge=challenge, - url='https://www.mysite.com/distil_r_captcha.html', + url='https://2captcha.com/demo/geetest', # proxy={ # 'type': 'HTTPS', # 'uri': 'login:password@IP_address:PORT' @@ -34,4 +38,4 @@ sys.exit(e) else: - sys.exit('result: ' + str(result)) + sys.exit('result: ' + str(result)) \ No newline at end of file diff --git a/examples/hcaptcha.py b/examples/hcaptcha.py index 8426086..222c279 100644 --- a/examples/hcaptcha.py +++ b/examples/hcaptcha.py @@ -17,7 +17,7 @@ try: result = solver.hcaptcha( - sitekey='3ceb8624-1970-4e6b-91d5-70317b70b651', + sitekey='41b778e7-8f20-45cc-a804-1f1ebb45c579', url='https://2captcha.com/demo/hcaptcha?difficulty=easy', ) diff --git a/examples/keycaptcha.py b/examples/keycaptcha.py index ea14c20..f6d9c4b 100644 --- a/examples/keycaptcha.py +++ b/examples/keycaptcha.py @@ -17,11 +17,11 @@ try: result = solver.keycaptcha( - s_s_c_user_id=15, - s_s_c_session_id='faa8cc1697c962ad4b859aa472f5d992', - s_s_c_web_server_sign='4f84e4fe41cf688d8d94361489ecd75c-pz-', - s_s_c_web_server_sign2='a9af97bb0a645eec495f2527e431a21b', - url='https://www.keycaptcha.com/products/') + s_s_c_user_id=184015, + s_s_c_session_id='e34ddd2c72e67593ac0b4ca8e4f44725', + s_s_c_web_server_sign='a5ebd41ae22348b2cdbdc211792e982d', + s_s_c_web_server_sign2='29255689423dd92990f8d06de50560d0', + url='https://2captcha.com/demo/keycaptcha') except Exception as e: sys.exit(e) diff --git a/examples/keycaptcha_options.py b/examples/keycaptcha_options.py index b1518dc..a04bbbc 100644 --- a/examples/keycaptcha_options.py +++ b/examples/keycaptcha_options.py @@ -27,15 +27,14 @@ solver = TwoCaptcha(**config) try: - result = solver.keycaptcha(s_s_c_user_id = 184015, - s_s_c_session_id = 'c32c9934c68b2968bee0332b9346da42', - s_s_c_web_server_sign = 'c93c8d136d5ee6ee6fe27ab2be54901d', - s_s_c_web_server_sign2 = 'eec85fcfeda28bffd7764d712d4089e7', - url = 'https://2captcha.com/ru/demo/keycaptcha' - # proxy = { - # 'type': 'HTTPS', - # 'uri': 'login:password@IP_address:PORT'} - ) + result = solver.keycaptcha(s_s_c_user_id=184015, + s_s_c_session_id='e34ddd2c72e67593ac0b4ca8e4f44725', + s_s_c_web_server_sign='a5ebd41ae22348b2cdbdc211792e982d', + s_s_c_web_server_sign2='29255689423dd92990f8d06de50560d0', + url='https://2captcha.com/demo/keycaptcha', + # proxy = {'type': 'HTTPS', + # 'uri': 'login:password@IP_address:PORT'} + ) except Exception as e: diff --git a/examples/lemin.py b/examples/lemin.py index bc9d269..18ac536 100644 --- a/examples/lemin.py +++ b/examples/lemin.py @@ -15,7 +15,7 @@ solver = TwoCaptcha(api_key) try: - result = solver.lemin(captcha_id='CROPPED_3dfdd5c_d1872b526b794d83ba3b365eb15a200b', + result = solver.lemin(captcha_id='CROPPED_5a29582_ca114c2f3314482c84cd32fc7d2feb63', div_id='lemin-cropped-captcha', url='https://2captcha.com/demo/lemin') diff --git a/examples/recaptcha_v2.py b/examples/recaptcha_v2.py index 6af8d64..660ab55 100644 --- a/examples/recaptcha_v2.py +++ b/examples/recaptcha_v2.py @@ -17,8 +17,8 @@ try: result = solver.recaptcha( - sitekey='6LfDxboZAAAAAD6GHukjvUy6lszoeG3H4nQW57b6', - url='https://2captcha.com/demo/recaptcha-v2-invisible?level=low') + sitekey='6LdO5_IbAAAAAAeVBL9TClS19NUTt5wswEb3Q7C5', + url='https://2captcha.com/demo/recaptcha-v2-invisible') except Exception as e: sys.exit(e) diff --git a/examples/recaptcha_v2_options.py b/examples/recaptcha_v2_options.py index 8460781..bce7843 100644 --- a/examples/recaptcha_v2_options.py +++ b/examples/recaptcha_v2_options.py @@ -28,8 +28,8 @@ try: result = solver.recaptcha( - sitekey='6LfDxboZAAAAAD6GHukjvUy6lszoeG3H4nQW57b6', - url='https://2captcha.com/demo/recaptcha-v2-invisible?level=low', + sitekey='6LdO5_IbAAAAAAeVBL9TClS19NUTt5wswEb3Q7C5', + url='https://2captcha.com/demo/recaptcha-v2-invisible', invisible=1, enterprise=0 # proxy={