Amazon captcha solver: Code example for bypassing the Amazon captcha
2Captcha launched an Amazon captcha bypass service.
The service can be used to bypass any type of Amazon AWS captchas.
Motivation: Amazon captchas typically restrict access to services and information based on our social and cultural backgrounds, physical and cognitive abilities, the devices or networks we connect from, and other criteria.
2Captcha - is a anti captcha service for bypass any captcha through API queries. Payment only for successfully solving queries.
This article describes the process of interaction with the captcha solver API.
What is Amazon AWS captcha?
Amazon captcha is part of the Amazon AWS system. The captcha is designed to block bots and automated systems.
Amazon captcha are simple puzzles for humans and complex puzzles for computers that help screen out automated systems and parsers.
Typically, captcha is used when complete blocking of traffic is unacceptable, but letting all traffic through creates too much load due to the number of robots, such as parsers.
If a visitor's query looks suspicious, Amazon shows the captcha in the form of a puzzle. Instead of the puzzle, the user has the option to choose an alternative - audio captcha.
If the captcha is solved successfully, the user is returned to the page. If the solution is not successful, the user is presented with a new puzzle until the task is solved.
Amazon randomly creates and sorts puzzles to ensure that the tasks are unique to users. And it regularly adds new types of puzzles to remain effective in combating automation methods.
In addition to going through the puzzles themselves, Amazon also uses user data collection to verify that the task has been completed by a human and prevent automated queries.
Amazon captcha can limit access to many bots. But it can't completely eliminate all automated systems.
How to bypass Amazon AWS captcha
The ways to automate the solving process:
- Puzzles can be solved using machine learning;
- Puzzles can be solved quickly by using motivated workers who perform tasks on recognition services.
Amaozon captcha solver: How to solve Amazon AWS captcha using bypass API
The task of automating the bypass is solved by specialized services.
The process of solving using an API is as follows:
- The customer passes a set of required parameters from the captcha placement page to the service, where it is solved by a worker;
- After that, the customer requests a set of parameters to be passed to the appropriate fields to solve the captcha on the target page.
This process is fast and reliable, and it can be used to solve any type of task, including Amazon puzzles.
Payment is only for successfully solved puzzles.
Solving Amazon captcha using the API is a great way to automate the bypassing process.
To use the API a user must register on 2Captcha. Once the profile is activated, the user can start using the API.
The following describes the process of interacting with the API and code samples in the most popular programming languages.
Send request
Send an API request to in.php
with parameters. List of required parameters:
Parameter | Description |
---|---|
key |
API key |
method |
amazon_waf means sending Amazon WAF captcha |
sitekey |
the value of the sitekey parameter that is placed on the target page |
iv |
the value of the iv parameter that is placed on the target page |
context |
The value of the context parameter that is placed on the target page |
challenge_script |
the URL of challenge.js script |
captcha_script |
the URL of captcha.js script |
pageurl |
Full URL of the target page |
If everything is OK you will receive the response with your request ID.
If everything is OK you will receive the response with your request id
.
Example:
{
OK|xxxxxx
}
The id
should be used to query the result.
If an error occurred while sending the request, an error response should be returned. A list of all errors with a description are collected on the API page.
Make a 15-20 seconds timeout then submit a HTTP GET request to API URL res.php
to get the result.
Getting a response
Send an API request to res.php
with parameters. List of required parameters:
Parameter | Description |
---|---|
key |
API key |
action |
get means a request to get a response |
id |
ID returned in response to a request to in.php |
json | Additional parameter: 0 - instructing the server to return a response in text format, -1 - instructing the server to return a response in JSON format |
In response, the API should return a token. The received token should be used to pass the puzzle in the format:
{
"status": 1,
"request": {
"captcha_voucher":"xxxxx",
"existing_token":"xxxxx"
}
}
If the recognition process is not finished yet, the server will return CAPCHA_NOT_READY
result.
If something goes wrong, the server will return an error code.
A list of all errors with a description is collected on the API page.
Code examples
Bypassing Amazon AWS captcha in Java
import com.twocaptcha.TwoCaptcha;
import com.twocaptcha.captcha.AmazonWaf;
public class AmazonWaf {
public static void main(String[] args) {
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
solver.setHost("2captcha.com");
AmazonWaf captcha = new AmazonWaf();
captcha.setSiteKey("AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AF5H1K/siwSLK7RfstKtN5bAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglg");
captcha.setUrl("https://non-existent-example.execute-api.us-east-1.amazonaws.com");
captcha.setIV("test_iv");
captcha.setContext("test_context");
try {
solver.solve(captcha);
System.out.println("Captcha solved: " + captcha.getCode());
} catch (Exception e) {
System.out.println("Error occurred: " + e.getMessage());
}
}
}
Bypassing Amazon AWS captcha in PHP
require(__DIR__ . '/../src/autoloader.php');
$solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');
try {a
$result = $solver->amazon_waf([
'sitekey' => 'AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AF5H1K/siwSLK7RfstKtN5bAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglg',
'url' => 'https://non-existent-example.execute-api.us-east-1.amazonaws.com',
'iv' => 'test_iv',
'context' => 'test_context'
]);
} catch (\Exception $e) {
die($e->getMessage());
}
die('Captcha solved: ' . $result->code);
Bypassing Amazon AWS captcha in Python
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.amazon_waf(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
iv='CgAHbCe2GgAAAAAj',
context='9BUgmlm48F92WUoqv97a49ZuEJJ50TCk9MVr3C7WMtQ0X6flVbufM4n8mjFLmbLVAPgaQ1Jydeaja94iAS49ljb+sUNLoukWedAQZKrlY4RdbOOzvcFqmD/ZepQFS9N5w15Exr4VwnVq+HIxTsDJwRviElWCdzKDebN/mk8/eX2n7qJi5G3Riq0tdQw9+C4diFZU5E97RSeahejOAAJTDqduqW6uLw9NsjJBkDRBlRjxjn5CaMMo5pYOxYbGrM8Un1JH5DMOLeXbq1xWbC17YSEoM1cRFfTgOoc+VpCe36Ai9Kc='
url='https://non-existent-example.execute-api.us-east-1.amazonaws.com/latest')
except Exception as e:
sys.exit(e)
else:
sys.exit('solved: ' + str(result))
Bypassing Amazon AWS captcha in Ruby
client = Api2Captcha.new("YOUR_API_KEY")
result = client.amazon_waf({
sitekey: '0x1AAAAAAAAkg0s2VIOD34y5',
iv: 'CgAHbCe2GgAAAAAj',
context: '9BUgmlm48F92WUoqv97a49ZuEJJ50TCk9MVr3C7WMtQ0X6flVbufM4n8mjFLmbLVAPgaQ1Jydeaja94iAS49ljb+sUNLoukWedAQZKrlY4RdbOOzvcFqmD/ZepQFS9N5w15Exr4VwnVq+HIxTsDJwRviElWCdzKDebN/mk8/eX2n7qJi5G3Riq0tdQw9+C4diFZU5E97RSeahejOAAJTDqduqW6uLw9NsjJBkDRBlRjxjn5CaMMo5pYOxYbGrM8Un1JH5DMOLeXbq1xWbC17YSEoM1cRFfTgOoc+VpCe36Ai9Kc=',
pageurl: 'https://non-existent-example.execute-api.us-east-1.amazonaws.com/latest',
challenge_script: "https://41bcdd4fb3cb.610cd090.us-east-1.token.awswaf.com/41bcdd4fb3cb/0d21de737ccb/cd77baa6c832/challenge.js",
captcha_script: "https://41bcdd4fb3cb.610cd090.us-east-1.captcha.awswaf.com/41bcdd4fb3cb/0d21de737ccb/cd77baa6c832/captcha.js"
})
Bypassing Amazon AWS captcha in C#
using System.Linq;
using TwoCaptcha.Captcha;
namespace TwoCaptcha.Examples
{
public class AmazonWafExample
{
public void Main()
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
AmazonWaf captcha = new AmazonWaf();
captcha.SetSiteKey("AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AF5H1K/siwSLK7RfstKtN5bAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglg");
captcha.SetUrl("https://non-existent-example.execute-api.us-east-1.amazonaws.com");
captcha.SetContext("test_iv");
captcha.SetIV("test_context");
try
{
solver.Solve(captcha).Wait();
Console.WriteLine("Captcha solved: " + captcha.Code);
}
catch (AggregateException e)
{
Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
}
}
}
}
Bypassing Amazon AWS captcha in Golang
import (
"fmt"
"log"
"github.com/2captcha/2captcha-go"
)
func main() {
client := api2captcha.NewClient("API_KEY")
cap := api2captcha.AmazonWAF{
Iv: "CgAHbCe2GgAAAAAj",
SiteKey: "0x1AAAAAAAAkg0s2VIOD34y5",
Url: "https://non-existent-example.execute-api.us-east-1.amazonaws.com/latest",
Context: "9BUgmlm48F92WUoqv97a49ZuEJJ50TCk9MVr3C7WMtQ0X6flVbufM4n8mjFLmbLVAPgaQ1Jydeaja94iAS49ljb",
ChallengeScript: "https://41bcdd4fb3cb.610cd090.us-east-1.token.awswaf.com/41bcdd4fb3cb/0d21de737ccb/cd77baa6c832/challenge.js"
CaptchaScript: "https://41bcdd4fb3cb.610cd090.us-east-1.captcha.awswaf.com/41bcdd4fb3cb/0d21de737ccb/cd77baa6c832/captcha.js",
}
code, err := client.Solve(cap.ToRequest())
if err != nil {
log.Fatal(err);
}
fmt.Println("code "+code)
}
Price
The price for 1000 recognitions is $2.99.
References
Detailed information on bypassing Amazon captcha is published on the API page.
Additional information on working with the service for customers is available on the FAQ page.
Code examples in different programming languages:
Code examples for working with the service on the official page in GitHub.