AmazonTask | AWS WAF Captcha and Challenge
Solving CAPTCHA and challenge in AWS WAF
This task will be performed using our proxy servers.
Possible captcha variants
Request parameters
Option 1
type
<string>requiredAmazonTaskProxyless
websiteURL
<string>requiredThe address of the main page where the captcha is solved.
websiteKey
<string>requiredCan be found in the apiKey
field when rendering the captcha
captchaScript
<string>requiredLink to jsapi.js on html page, has the form <Integration URL>/jsapi.js
cookieSolution
<boolean>optionalDefault false. If you require an ‘aws-waf-token’ cookie, then specify a value of true. Otherwise you will get "captcha_voucher" and "existing_token" in response.
Option 2
type
<string>requiredAmazonTaskProxyless
websiteURL
<string>requiredThe address of the main page where the captcha is solved.
challengeScript
<string>requiredLink to challenge.js (see description below)
captchaScript
<string>optionalLink to captcha.js (maybe missing if you just have a challenge)
websiteKey
<string>requiredA string that can be retrieved from an html page with a captcha or with javascript by executing the window.gokuProps.key
context
<string>requiredA string that can be retrieved from an html page with a captcha or with javascript by executing the window.gokuProps.context
iv
<string>requiredA string that can be retrieved from an html page with a captcha or with javascript by executing the window.gokuProps.iv
cookieSolution
<boolean>optionalBy default false. If you need to use cookies "aws-waf-token", specify the value true. Otherwise, what you will get in return is "captcha_voucher" and "existing_token".
How to get websiteKey, context, iv and challengeScript parameters
When you go to a website, you get a 405 response and an html page with a captcha. It is from this page that you can get all the parameters:
Task Creation Methods
Option 1
https://api.capmonster.cloud/createTask
Request
{
"clientKey": "API_KEY",
"task": {
"type": "AmazonTaskProxyless",
"websiteURL": "https://example.com/index.html",
"websiteKey": "h15hX7brbaRTR...Za1_1",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
"captchaScript": "https://234324vgvc23.yejk.captcha-sdk.awswaf.com/234324vgvc23/jsapi.js",
"cookieSolution": true
}
}
Response
{
"errorId":0,
"taskId":407533072
}
Option 2
https://api.capmonster.cloud/createTask
Request
{
"clientKey": "API_KEY",
"task": {
"type": "AmazonTaskProxyless",
"websiteURL": "https://example.com",
"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",
"cookieSolution": true
}
}
Response
{
"errorId":0,
"taskId":407533072
}
Get task result method
Use the getTaskResult method to get the AmazonTask solution.
https://api.capmonster.cloud/getTaskResult
Request
{
"clientKey":"API_KEY",
"taskId": 407533072
}
Response
{
"errorId":0,
"status":"ready",
"solution": {
"cookies": {
"aws-waf-token": "10115f5b-ebd8-45c7-851e-cfd4f6a82e3e:EAoAua1QezAhAAAA:dp7sp2rXIRcnJcmpWOC1vIu+yq/A3EbR6b6K7c67P49usNF1f1bt/Af5pNcZ7TKZlW+jIZ7QfNs8zjjqiu8C9XQq50Pmv2DxUlyFtfPZkGwk0d27Ocznk18/IOOa49Rydx+/XkGA7xoGLNaUelzNX34PlyXjoOtL0rzYBxMAQy0D1tn+Q5u97kJBjs5Mytqu9tXPIPCTSn4dfXv5llSkv9pxBEnnhwz6HEdmdJMdfur+YRW1MgCX7i3L2Y0/CNL8kd8CEhTMzwyoXekrzBM="
},
"userAgent": "userAgentPlaceholder"
}
}
Use SDK Library
- JavaScript
- Python
- C#
// https://github.com/ZennoLab/capmonstercloud-client-js
import { CapMonsterCloudClientFactory, ClientOptions, AmazonProxylessRequest } from '@zennolab_com/capmonstercloud-client';
document.addEventListener('DOMContentLoaded', async () => {
const cmcClient = CapMonsterCloudClientFactory.Create(new ClientOptions({ clientKey: '<your capmonster.cloud API key>' }));
console.log(await cmcClient.getBalance());
const amazonRequest = new AmazonProxylessRequest({
websiteURL: 'https://example.com',
websiteKey: 'websiteKey',
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',
context: 'qoJYgnKsc...aormh/dYYK+Y=',
iv: 'CgAAXFFFFSAAABVk',
});
console.log(await cmcClient.Solve(amazonRequest));
});
# https://github.com/ZennoLab/capmonstercloud-client-python
import asyncio
from capmonstercloudclient import CapMonsterClient, ClientOptions
from capmonstercloudclient.requests import AmazonWafProxylessRequest
client_options = ClientOptions(api_key="your_api_key") # Replace with your CapMonster Cloud API key
cap_monster_client = CapMonsterClient(options=client_options)
amazon_waf_request = AmazonWafProxylessRequest(
websiteUrl="https://example.com", # URL с CAPTCHA
challengeScript="https://example.com/path/to/challenge.js",
captchaScript="https://example.com/path/to/captcha.js",
websiteKey="your_website_key",
context="your_context_value",
iv="your_iv_value",
cookieSolution=False
)
async def solve_captcha():
return await cap_monster_client.solve_captcha(amazon_waf_request)
responses = asyncio.run(solve_captcha())
print(responses)
// https://github.com/ZennoLab/capmonstercloud-client-dotnet
using Zennolab.CapMonsterCloud.Requests;
using Zennolab.CapMonsterCloud;
class Program
{
static async Task Main(string[] args)
{
var clientOptions = new ClientOptions
{
ClientKey = "your_api_key" // Replace with your CapMonster Cloud API key
};
var cmCloudClient = CapMonsterCloudClientFactory.Create(clientOptions);
var amazonWafRequest = new AmazonWafProxylessRequest
{
WebsiteUrl = "https://example.com", // URL with the captcha
ChallengeScript = "URL_of_challenge.js",
CaptchaScript = "URL_of_captcha.js",
WebsiteKey = "website_key",
Context = "context_value",
Iv = "iv_value",
CookieSolution = false
};
var solveResult = await cmCloudClient.SolveAsync(amazonWafRequest);
Console.WriteLine("ExistingToken: " + solveResult.Solution.ExistingToken); // Adjust based on your expected solution format
Console.WriteLine("CaptchaVoucher: " + solveResult.Solution.CaptchaVoucher);
}
}