GeeTest CAPTCHA绕过API服务
使用我们的服务,您可以轻松绕过两个版本的Geetest:v3和v4,但首先您需要确定目标网站使用的版本。
有几点属性可用于识别:
- v3使用
initGeetest
初始化函数,v4使用initGeetest4
- v3加载
gt.js
脚本,而v4加载gt4.js
GeeTest v3
在目标网站上找到以下GeeTest captcha参数(通常您可以在
initGeetest
函数中找到它们):gt
- 公共网站密钥(静态)
challenge
- 动态挑战密钥
api_server
- API域名(可选)重要事项:对我们的API的每次请求,您都应该获取一个新的`challenge`值。一旦captcha被加载到页面上,`challenge`值变为无效。您应该检查页面加载时向网站发出的请求,以识别获取新`challenge`值的请求。您应该每次都提出这样的请求,以获得有效的`challenge`值。
将这些参数发送到{2CaptchaAPI。如果captcha已解决,服务器将以JSON返回响应。 响应包含三个值:
challenge
、validate
和seccode
:{ "challenge": "1a2b3456cd67890e12345fab678901c2de", "validate": "09fe8d7c6ba54f32e1dcb0a9fedc8765", "seccode": "12fe3d4c56789ba01f2e345d6789c012|jordan" }
使用从我们的API收到的值将您的请求提交到目标网站,将值填入相应的请求字段:
geetest_challenge geetest_validate geetest_seccode
点击"检查"按钮提交表格。
阅读更多 - captcha处理API文档。
// https://github.com/2captcha/2captcha-php require(__DIR__ . '/../src/autoloader.php'); $solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY'); try { $result = $solver->geetest([ 'gt' => '81388ea1fc187e0c335c0a8907ff2625', 'apiServer' => 'api.geetest.com', 'challenge' => '12345678abc90123d45678ef90123a456b', 'url' => 'https://2captcha.com/demo/geetest', ]); } catch (\Exception $e) { die($e->getMessage()); } die('Captcha solved: ' . $result->code);
# https://github.com/2captcha/2captcha-python import sys import os import requests import json sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) from twocaptcha import TwoCaptcha api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY') solver = TwoCaptcha(api_key) resp = requests.get("https://2captcha.com/api/v1/captcha-demo/gee-test/init-params") data = json.loads(resp) challenge = data["challenge"] try: result = solver.geetest(gt='f3bf6dbdcf7886856696502e1d55e00c', apiServer='api.geetest.com', challenge=challenge, url='https://2captcha.com/demo/geetest') except Exception as e: sys.exit(e) else: sys.exit('solved: ' + str(result))
// https://github.com/2captcha/2captcha-csharp using System; using System.Linq; using TwoCaptcha.Captcha; namespace TwoCaptcha.Examples { public class GeeTestExample { public void Main() { TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY"); GeeTest captcha = new GeeTest(); captcha.SetGt("81388ea1fc187e0c335c0a8907ff2625"); captcha.SetApiServer("api.geetest.com"); captcha.SetChallenge("12345678abc90123d45678ef90123a456b"); captcha.SetUrl("https://2captcha.com/demo/geetest"); try { solver.Solve(captcha).Wait(); Console.WriteLine("Captcha solved: " + captcha.Code); } catch (AggregateException e) { Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message); } } } }
// https://github.com/2captcha/2captcha-java package examples; import com.twocaptcha.TwoCaptcha; import com.twocaptcha.captcha.GeeTest; public class GeeTestExample { public static void main(String[] args) { TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY"); GeeTest captcha = new GeeTest(); captcha.setGt("81388ea1fc187e0c335c0a8907ff2625"); captcha.setApiServer("api.geetest.com"); captcha.setChallenge("12345678abc90123d45678ef90123a456b"); captcha.setUrl("https://2captcha.com/demo/geetest"); try { solver.solve(captcha); System.out.println("Captcha solved: " + captcha.getCode()); } catch (Exception e) { System.out.println("Error occurred: " + e.getMessage()); } } }
// https://github.com/2captcha/2captcha-go package main import ( "fmt" "log" "github.com/2captcha/2captcha-go" ) func main() { client := api2captcha.NewClient("API_KEY") captcha := api2captcha.GeeTest{ GT: "81388ea1fc187e0c335c0a8907ff2625", ApiServer: "api.geetest.com", Challenge: "12345678abc90123d45678ef90123a456b", Url: "https://2captcha.com/demo/geetest", } code, err := client.Solve(captcha.ToRequest()) if err != nil { log.Fatal(err); } fmt.Println("code "+code) }
// https://github.com/2captcha/2captcha-cpp #include <cstdio> #include "curl_http.hpp" #include "api2captcha.hpp" int main (int ac, char ** av) { api2captcha::curl_http_t http; http.set_verbose (true); api2captcha::client_t client; client.set_http_client (&http); client.set_api_key (API_KEY); api2captcha::geetest_t cap; cap.set_gt ("81388ea1fc187e0c335c0a8907ff2625"); cap.set_api_server ("api.geetest.com"); cap.set_challenge ("12345678abc90123d45678ef90123a456b"); cap.set_url ("https://2captcha.com/demo/geetest"); try { client.solve (cap); printf ("code '%s'\n", cap.code ().c_str ()); } catch (std::exception & e) { fprintf (stderr, "Failed: %s\n", e.what ()); } return 0; }
require 'api_2captcha' client = Api2Captcha.new("YOUR_API_KEY") result = client.geetest({ gt: 'f1ab2cdefa3456789012345b6c78d90e', api_server: 'api-na.geetest.com', challenge: '12345678abc90123d45678ef90123a456b', pageurl: 'https://www.site.com/page/' })
GeeTest v4
在浏览器中打开开发人员控制台并找到加载GeeTest v4脚本的脚本元素,您需要从脚本src属性中获取
captcha_id
参数值。<script src="https://gcaptcha4.geetest.com/load?captcha_id=e392e1d7fd421dc63325744d5a2b9c73&challenge=36056b4d-7453-4153-aaa7-67ac27ccae9c&client_type=web&lang=en&callback=geetest_1679073111173"></script>
将
captcha_id
和pageurl
发送到2CaptchaAPI。等待结果,可能如下所示:{ "captcha_id": "e392e1d7fd421dc63325744d5a2b9c73", "lot_number": "532c4ca58e3f4adb8ef96bfa222e623e", "pass_token": "9e6a5a354d50f3ab674c416de35b539c37627128382abd78342dd79442351f8f", "gen_time": "1679073037", "captcha_output": "c3rHzKlQXuv9xJe_l2wqb7ypWdFpbyZ_pk1ODXGTOdHKE5cJFer1r1jNTt2n5muwLzs5HOQ39D2lFjzqcygPO7ftaMFLXVMTCZuD8PkD4j10_vnvF0keeTTjbJaC0jq7btCE12-eN6fF6WPtHEoXLLXqkb8HaISjG5znAuZDMZ055HsCE6S7iyiaJYv_l0Sm1atkF0VEAYaKrEhQRYHus35X6FqIoRvVo1ISyCZGnjw=" }
在目标网站上使用返回的值,和手动破解captcha时使用值的方法相同。 表单可能会包含一组隐藏的输入或一个JavaScript回调。或者您可以简单地构建一个包含所需数据的HTTP请求。
阅读更多 - captcha处理API文档。
$result = $solver->geetest_v4([ 'captchaId' => 'e392e1d7fd421dc63325744d5a2b9c73', 'challenge' => 'd1a9ddd7-e36f-4100-be9f-231f11743656', 'url' => 'https://2captcha.com/demo/geetest-v4', ]);
result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73', url='https://2captcha.com/demo/geetest-v4', challenge="d1a9ddd7-e36f-4100-be9f-231f11743656")
GeeTestV4 captcha = new GeeTestV4(); captcha.SetCaptchaId("e392e1d7fd421dc63325744d5a2b9c73"); captcha.SetUrl("https://2captcha.com/demo/geetest-v4");
GeeTestV4 captcha = new GeeTestV4(); captcha.setCaptchaId("e392e1d7fd421dc63325744d5a2b9c73"); captcha.setUrl("https://2captcha.com/demo/geetest-v4");
require 'api_2captcha' client = Api2Captcha.new("YOUR_API_KEY") result = client.geetest_v4({ captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73', pageurl: 'https://www.site.com/page/' })