Capy拼图CAPTCHA绕过API服务
在如下所示的页面源代码或脚本源链接中找到的
capy_captchakey
参数值:https://api.capy.me/puzzle/get_js/?k=PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v
还需找到脚本URL的根部分,例如:https://api.capy.me/
,并在api_server
参数中使用。向我们的API URL:
http://2captcha.com/in.php
提交HTTPGET
或POST
请求,方式设置为capy
;提供在上一步中找到的值作为captchakey
和api_server
,并将整页URL作为pageurl
值。您可以在下表中找到完整的参数列表。请求URL示例 ->
http://2captcha.com/in.php?key=1abc234de56fab7c89012d34e56fa7b8&method=capy&captchakey=PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v&pageurl=http://mysite.com/
如果一切正常,服务器将以纯文本返回您的captcha
ID
,比如:OK|2122988149
,或者如果使用json
参数,则以JSON{"status":1,"request":"2122988149"}
返回。否则服务器将返回错误代码。暂停15-20秒,然后向我们的API URL:
http://2captcha.com/res.php
提交HTTPGET
请求以获取结果。完整的参数列表如下表所示。如果captcha已处理,服务器将以JSON响应并返回包含三个值的答案:
captchakey
、challengekey
和answer
.如果captcha未处理,服务器将返回
CAPCHA_NOT_READY
结果。如果出现问题,服务器将返回错误代码。
{ "captchakey": "PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v", "challengekey": "y1Pu234nCwq56WnqB7y8TSZq0Qzp0ltK", "answer": "0xax8ex0xax84x0xkx7qx0xux7qx0xux7gx0x18x7gx0x1sx76x0x26x6ix0x2qx6ix0x3ex68x0" }
使用对目标网站请求中返回的值,将其递至相应的请求字段中:
capy_captchakey
、capy_challengekey
、capy_answer
。代码示例:
阅读更多 - captcha处理API 文档。
// https://github.com/2captcha/2captcha-php $solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY'); try { $result = $solver->capy([ 'sitekey' => 'PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v', 'url' => 'https://www.mysite.com/captcha/', 'api_server' => 'https://jp.api.capy.me/' ]); } catch (\Exception $e) { die($e->getMessage()); } die('Captcha solved: ' . $result->code);
# https://github.com/2captcha/2captcha-python import sys import os sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) from twocaptcha import TwoCaptcha api_key = 'YOUR_API_KEY' solver = TwoCaptcha(api_key) try: result = solver.capy( sitekey='PUZZLE_Cz04hZLjuZRMYC3ee10C32D3uNms5w', url='https://www.mysite.com/page/captcha/', api_server="https://jp.api.capy.me/", ) except Exception as e: sys.exit(e) else: sys.exit('result: ' + str(result))
// https://github.com/2captcha/2captcha-csharp using System; using System.Linq; using TwoCaptcha.Captcha; namespace TwoCaptcha.Examples { public class CapyExample { public void Main() { TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY"); Capy captcha = new Capy(); captcha.SetSiteKey("PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v"); captcha.SetUrl("https://www.mysite.com/captcha/"); captcha.SetApiServer("https://jp.api.capy.me/"); 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.Capy; public class CapyExample { public static void main(String[] args) { TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY"); Capy captcha = new Capy(); captcha.setSiteKey("PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v"); captcha.setUrl("https://www.mysite.com/captcha/"); captcha.setApiServer("https://jp.api.capy.me/"); 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.Capy{ SiteKey: "PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v", Url: "https://www.mysite.com/captcha/", } 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::capy_t captcha; captcha.set_site_key ("PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v"); captcha.set_url ("https://www.mysite.com/captcha/"); 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.capy({ sitekey: 'PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v', pageurl: 'http://mysite.com/', api_server: 'https://jp.api.capy.me/' })