2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

KeyCaptchaの突破方法

Posted at
  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. これらのパラメータをAPIに送信します。

    SDKを使用する場合 (推奨):

PHP
    // https://github.com/2captchacom/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://{{ hostname }}/demo/keycaptcha',
        ]);
    } catch (\Exception $e) {
        die($e->getMessage());
    }

    die('Captcha solved: ' . $result->code);
    ```
    </details>

    <details><summary>Python</summary>
    ```python
    # https://github.com/2captchacom/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://{{ hostname }}/demo/keycaptcha')

    except Exception as e:
        sys.exit(e)

    else:
        sys.exit('solved: ' + str(result))
Java
    // https://github.com/2captchacom/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://{{ hostname }}/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/2captchacom/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://{{ hostname }}/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/2captchacom/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://{{ hostname }}/demo/keycaptcha",   
        }
        code, err := client.Solve(cap.ToRequest())
        if err != nil {
            log.Fatal(err);
        }
        fmt.Println("code "+code)
    }
C++
    // https://github.com/2captchacom/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://{{ hostname }}/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;   
    }
結果は次のようになります。:

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

手動:

1. HTTP GETまたはPOSTリクエストをAPI URL: `https://{{ hostname }}/in.php`に送信、`method`を `keycaptcha`に設定して、リクエストの前のステップで見つかった値を対応するリクエストパラメータの値として、フルページURLをpageurlの値として送信します。リクエストURLの例:
    `https://{{ hostname }}/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://{{ hostname }}/demo/keycaptcha`
2. 何も問題がなければ、サーバーはCAPTCHAのIDを返します。

    `OK|2122988149`
    それ以外の場合、サーバーは[エラーコード](/api-docs#error_handling)を返します。

3. 15-20秒後にGETリクエストを送信して結果を取得します。

    `GET https://{{ hostname }}/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秒以内にリクエストを繰り返してください。何か問題が発生した場合、サーバーは [エラーコード](/api-docs#error_handling)を返します。
  1. keycaptcha JavaScriptファイルを含む次のブロックを見つけて削除します。

    <script language="JavaScript" src="http://backs.keycaptcha.com/swfs/cap.js"></script>
    
  2. id="div_for_keycaptcha"divを見つけて削除します。

    <div id="div_for_keycaptcha"...>...</div>
    
  3. id="capcode" で要素を見つけ、その値をサーバーから受信した応答に変更します。

    <input name="capcode" id="capcode" value="1|2|3|4|5" type="hidden">
    
  4. 「確認」ボタンをクリックしてフォームを送信してください。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?