如果网站速度慢,请使用网站链接 2captcha.cn

KeyCAPTCHA 演示

本页介绍如何显示 KeyCAPTCHA 以及 KeyCAPTCHA 验证的工作原理。 KeyCaptcha验证码需通过拼图破解。

KeyCAPTCHA的徽标

在许多情况下,KeyCAPTCHA会妨碍无障碍访问,使用户感到沮丧,限制对公开信息的访问,使应用程序和网站的测试变得困难。使用 KeyCAPTCHA 解算器可自动绕过这些障碍。

KeyCAPTCHA 解算器API

如何破解KeyCaptcha

  1. 在页面源代码中找到以下KeyCaptcha参数:

    s_s_c_user_id
    s_s_c_session_id
    s_s_c_web_server_sign
    s_s_c_web_server_sign2
  2. 在页面源代码中找到以下KeyCaptcha参数:(/api-docs#solving_keycaptcha).

    使用SDK(推荐):

    PHP

    // https://github.com/2captcha/2captcha-php
    
    require(__DIR__ . '/../src/autoloader.php');
    
    $solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');
    
    try {
        $result = $solver->keycaptcha([
            's_s_c_user_id'          => 184015,
            's_s_c_session_id'       => '9ff29e0176e78eb7ba59314f92dbac1b',
            's_s_c_web_server_sign'  => '964635241a3e5e76980f2572e5f63452',
            's_s_c_web_server_sign2' => '3ca802a38ffc5831fa293ac2819b1204',
            'url'                    => 'https://2captcha.com/demo/keycaptcha',
        ]);
    } catch (\Exception $e) {
        die($e->getMessage());
    }
    
    die('Captcha solved: ' . $result->code);

    Python

    # 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 = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')
    
    solver = TwoCaptcha(api_key)
    
    try:
        result = solver.keycaptcha(
            s_s_c_user_id=184015,
            s_s_c_session_id='9ff29e0176e78eb7ba59314f92dbac1b',
            s_s_c_web_server_sign='964635241a3e5e76980f2572e5f63452',
            s_s_c_web_server_sign2='3ca802a38ffc5831fa293ac2819b1204',
            url='https://2captcha.com/demo/keycaptcha')
    
    except Exception as e:
        sys.exit(e)
    
    else:
        sys.exit('solved: ' + str(result))

    Java

    // https://github.com/2captcha/2captcha-java
    
    package examples;
    
    import com.twocaptcha.TwoCaptcha;
    import com.twocaptcha.captcha.KeyCaptcha;
    
    public class KeyCaptchaExample {
        public static void main(String[] args) {
            TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
            KeyCaptcha captcha = new KeyCaptcha();
            captcha.setUserId(184015);
            captcha.setSessionId("9ff29e0176e78eb7ba59314f92dbac1b");
            captcha.setWebServerSign("964635241a3e5e76980f2572e5f63452");
            captcha.setWebServerSign2("3ca802a38ffc5831fa293ac2819b1204");
            captcha.setUrl("https://2captcha.com/demo/keycaptcha");
            try {
                solver.solve(captcha);
                System.out.println("Captcha solved: " + captcha.getCode());
            } catch (Exception e) {
                System.out.println("Error occurred: " + e.getMessage());
            }
        }
    }

    C#

    // https://github.com/2captcha/2captcha-csharp
    
    using System;
    using System.Linq;
    using TwoCaptcha.Captcha;
    
    namespace TwoCaptcha.Examples
    {
        public class KeyCaptchaExample
        {
            public void Main()
            {
                TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
                KeyCaptcha captcha = new KeyCaptcha();
                captcha.SetUserId(184015);
                captcha.SetSessionId("9ff29e0176e78eb7ba59314f92dbac1b");
                captcha.SetWebServerSign("964635241a3e5e76980f2572e5f63452");
                captcha.SetWebServerSign2("3ca802a38ffc5831fa293ac2819b1204");
                captcha.SetUrl("https://2captcha.com/demo/keycaptcha");
                try
                {
                    solver.Solve(captcha).Wait();
                    Console.WriteLine("Captcha solved: " + captcha.Code);
                }
                catch (AggregateException e)
                {
                    Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
                }
            }
        }
    }

    Go

    // https://github.com/2captcha/2captcha-go
    
    package main
    
    import (
        "fmt"
        "log"
        "github.com/2captcha/2captcha-go"
    )
    
    func main() {
        client := api2captcha.NewClient("API_KEY")
        cap := api2captcha.KeyCaptcha{
            UserId: 184015,
            SessionId: "9ff29e0176e78eb7ba59314f92dbac1b",
            WebServerSign: "964635241a3e5e76980f2572e5f63452",
            WebServerSign2: "3ca802a38ffc5831fa293ac2819b1204",
            Url: "https://2captcha.com/demo/keycaptcha",   
        }
        code, err := client.Solve(cap.ToRequest())
        if err != nil {
            log.Fatal(err);
        }
        fmt.Println("code "+code)
    }

    C++

    // 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::keycaptcha_t cap;
    cap.set_user_id (184015);
    cap.set_session_id ("9ff29e0176e78eb7ba59314f92dbac1b");
    cap.set_web_server_sign ("964635241a3e5e76980f2572e5f63452");
    cap.set_web_server_sign2 ("3ca802a38ffc5831fa293ac2819b1204");
    cap.set_url ("https://2captcha.com/demo/keycaptcha");
    
    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;   
    }

    Ruby

    # https://github.com/2captcha/2captcha-ruby
    require 'api_2captcha'
    
    client =  Api2Captcha.new("YOUR_API_KEY")
    
    result = client.keycaptcha({
      s_s_c_user_id: 10,
      s_s_c_session_id: '493e52c37c10c2bcdf4a00cbc9ccd1e8',
      s_s_c_web_server_sign: '9006dc725760858e4c0715b835472f22-pz-',
      s_s_c_web_server_sign2: '2ca3abe86d90c6142d5571db98af6714',
      pageurl: 'https://www.keycaptcha.ru/demo-magnetic/'
    })

    等待结果,结果可能如下所示:

    ebdb5a6bf76da6887db60ef2041ab946|964635241a3e5e76980f2572e5f63452|http://back10.keycaptcha.com/swfs/ckc/5bded85426de3c57a7529a84bd0d4d08-|9ff29e0176e78eb7ba59314f92dbac1b|1

    手动操作:

    1. 向我们的API URL:https://2captcha.com/in.php发送HTTP GET或POST请求,method设置为keycaptcha,并提供在上一步请求中找到的值作为相应请求参数的值,整页URL作为pageurl的值。
      请求URL示例:
      https://2captcha.com/in.php?key=1abc234de56fab7c89012d34e56fa7b8&s_s_c_user_id=10&s_s_c_session_id=9ff29e0176e78eb7ba59314f92dbac1b&s_s_c_web_server_sign=964635241a3e5e76980f2572e5f63452&s_s_c_web_server_sign2=3ca802a38ffc5831fa293ac2819b1204&method=keycaptcha&pageurl=http://2captcha.com/demo/keycaptcha

    2. 如果一切正常,服务器将返回您的captcha ID:

      OK|2122988149
      否则服务器将返回错误代码.

    3. 15-20秒后发送GET请求以获取结果:

      GET https://2captcha.com/res.php?key=YOUR_API_KEY&action=get&id=2122988149
      如果captcha已破解,服务器将响应答案令牌:

      OK|ebdb5a6bf76da6887db60ef2041ab946|964635241a3e5e76980f2572e5f63452|http://back10.keycaptcha.com/swfs/ckc/5bded85426de3c57a7529a84bd0d4d08-|9ff29e0176e78eb7ba59314f92dbac1b|1
      如果captcha未破解,服务器将返回 CAPCHA_NOT_READY结果。在5秒内重复您的请求。如果出现问题,服务器将返回错误代码.

  3. 找到并删除以下包含keycaptcha JavaScript文件的部分:

    <script language="JavaScript" src="http://backs.keycaptcha.com/swfs/cap.js"></script>
  4. 找到并删除包含的id="div_for_keycaptcha"div:

    <div id="div_for_keycaptcha"...>...</div>
  5. 找到包含id="capcode"的元素并将其值更改为从我们的服务器收到的响应:

    <input name="capcode" id="capcode" value="1|2|3|4|5" type="hidden">
  6. 点击"检查"按钮提交表格。