KeyCaptcha is a type of captcha where you have to solve a simple puzzle.
How to solve KeyCaptcha
1.
Find the following KeyCaptcha parameters in page's source code:
s_s_c_user_id
s_s_c_session_id
s_s_c_web_server_sign
s_s_c_web_server_sign2
2.Send these parameters to to 2Captcha API.
php
python
java
csharp
go
cpp
// 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' => '5f31a2bc933d3-4.0.0.001',
's_s_c_web_server_sign' => '9006dc725760858e4c0715b835472f22-pz-',
's_s_c_web_server_sign2' => '2ca3abe86d90c6142d5571db98af6714',
'url' => 'https://2captcha.com/demo/keycaptcha',
]);
} 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 = 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='5f31a2bc933d3-4.0.0.001',
s_s_c_web_server_sign='4f84e4fe41cf688d8d94361489ecd75c-pz-',
s_s_c_web_server_sign2='a9af97bb0a645eec495f2527e431a21b',
url='https://2captcha.com/demo/keycaptcha')
except Exception as e:
sys.exit(e)
else:
sys.exit('solved: ' + str(result))
// 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("5f31a2bc933d3-4.0.0.001");
captcha.setWebServerSign("9006dc725760858e4c0715b835472f22");
captcha.setWebServerSign2("2ca3abe86d90c6142d5571db98af6714");
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());
}
}
}
// 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("5f31a2bc933d3-4.0.0.001");
captcha.SetWebServerSign("9006dc725760858e4c0715b835472f22");
captcha.SetWebServerSign2("2ca3abe86d90c6142d5571db98af6714");
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);
}
}
}
}
// 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: "5f31a2bc933d3-4.0.0.001",
WebServerSign: "9006dc725760858e4c0715b835472f22-pz-",
WebServerSign2: "2ca3abe86d90c6142d5571db98af6714",
Url: "https://2captcha.com/demo/keycaptcha",
}
code, err := client.Solve(cap.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::keycaptcha_t cap;
cap.set_user_id (184015);
cap.set_session_id ("493e52c37c10c2bcdf4a00cbc9ccd1e8");
cap.set_web_server_sign ("9006dc725760858e4c0715b835472f22");
cap.set_web_server_sign2 ("2ca3abe86d90c6142d5571db98af6714");
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;
}
ebdb5a6bf76da6887db60ef2041ab946|9006dc725760858e4c0715b835472f22|http://back10.keycaptcha.com/swfs/ckc/5bded85426de3c57a7529a84bd0d4d08-|493e52c37c10c2bcdf4a00cbc9ccd1e8|1
2.1
Send a HTTP GET or POST request to our API URL:
Request URL example:
https://2captcha.com/in.php
with method
set to keycaptcha
and provide values found on previous step in your request as values for corresponding request parameters and also full page URL as value for pageurl.Request URL example:
https://2captcha.com/in.php?key=1abc234de56fab7c89012d34e56fa7b8&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&method=keycaptcha&pageurl=http://demo.2captcha.com/keycaptcha
2.2
If everything is fine server will return the ID of your captcha:
Otherwise server will return an error code.
OK|2122988149
2.3
After 15-20 seconds send GET request to get the result:
If captcha is already solved server will respond with the answer token:
If captcha is not solved yet server will return
GET https://2captcha.com/res.php?key=YOUR_API_KEY&action=get&id=2122988149
OK|ebdb5a6bf76da6887db60ef2041ab946|9006dc725760858e4c0715b835472f22|http://back10.keycaptcha.com/swfs/ckc/5bded85426de3c57a7529a84bd0d4d08-|493e52c37c10c2bcdf4a00cbc9ccd1e8|1
CAPCHA_NOT_READY
result. Repeat your request in 5 seconds. If something went wrong server will return an error code.
3.
Locate and delete the following block which inclides keycaptcha JavaScript file:
<script language="JavaScript" src="http://backs.keycaptcha.com/swfs/cap.js"></script>
4.
Locate and delete the
div
with id="div_for_keycaptcha"
: <div id="div_for_keycaptcha"...>...</div>
5.
Locate the element with
id="capcode"
and change it's value to the response received from our server: <input name="capcode" id="capcode" value="1|2|3|4|5" type="hidden">
6.
Click on "Check" button to submit the form.