Amazon CAPTCHA
Token-based method for automated solving of Amazon AWS CAPTCHA.
Task types
- AmazonTaskProxyless - we use our own proxies pool to load and solve the captcha
- AmazonTask - we use your proxies
Task specification
Property | Type | Required | Description |
---|---|---|---|
type | String | Yes | Task type: AmazonTaskProxyless AmazonTask |
websiteURL | String | Yes | The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users |
websiteKey | String | Yes | Value of key parameter you found on the page |
iv | String | Yes | Value of iv parameter you found on the |
context | String | Yes | Value of context parameter you found on the page |
challengeScript | String | No | The source URL of challenge.js script on the page |
captchaScript | String | No | The source URL of captcha.js script on the page |
Important: for each request to our API, you need to get a new values
websiteKey
iv
context
. The values ofwebsiteKey
iv
context
must be searched in the page code.
AmazonTask Task type specification
AmazonTask
extends AmazonTaskProxyless
adding a set of proxy-related parameters listed below
Property | Type | Required | Description |
---|---|---|---|
proxyType | String | Yes | Proxy type: http socks4 socks5 |
proxyAddress | String | Yes | Proxy IP address or hostname |
proxyPort | Integer | Yes | Proxy port |
proxyLogin | String | No | Login for basic authentication on the proxy |
proxyPassword | String | No | Password for basic authentication on the proxy |
Request examples
Method: createTask
API endpoint: https://api.2captcha.com/createTask
AmazonTaskProxyless request example
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "AmazonTaskProxyless",
"websiteURL": "https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
"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",
"websiteKey": "AQIDA...wZwdADFLWk7XOA==",
"context": "qoJYgnKsc...aormh/dYYK+Y=",
"iv": "CgAAXFFFFSAAABVk"
}
}
AmazonTask request example
{
"clientKey": "YOUR_API_KEY",
"task": {
"type":"AmazonTask",
"websiteURL": "https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
"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",
"websiteKey": "AQIDA...wZwdADFLWk7XOA==",
"context": "qoJYgnKsc...aormh/dYYK+Y=",
"iv": "CgAAXFFFFSAAABVk",
"proxyType": "http",
"proxyAddress": "1.2.3.4",
"proxyPort": "8080",
"proxyLogin": "user23",
"proxyPassword": "p4$w0rd"
}
}
Result example
Method: getTaskResult
API endpoint: https://api.2captcha.com/getTaskResult
{
"errorId": 0,
"status": "ready",
"solution": {
"captcha_voucher": "eyJ0eXAiO...oQjTnJlBvAW4",
"existing_token": "f8ab5749-f916-...5D8yAA39JtKVbw="
},
"cost": "0.00145",
"ip": "1.2.3.4",
"createTime": 1692863536,
"endTime": 1692863556,
"solveCount": 0
}
Code examples
// https://github.com/2captcha/2captcha-php
require(__DIR__ . '/../src/autoloader.php');
$solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');
try {a
$result = $solver->amazon_waf([
'sitekey' => 'AQIDAHjcYu/Gj...AMGgGCSqGSIb3DQEHATAeBglg',
'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);
# 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.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))
// https://github.com/2captcha/2captcha-csharp
using System;
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);
}
}
}
}
// https://github.com/2captcha/2captcha-java
using System;
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);
}
}
}
}
// 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.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(captcha.ToRequest())
if err != nil {
log.Fatal(err);
}
fmt.Println("code "+code)
}
require 'api_2captcha'
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"
})