Skip to content

Add AWS WAF challenge solver support#348

Open
mam4dali wants to merge 1 commit intotboothman:masterfrom
mam4dali:dev
Open

Add AWS WAF challenge solver support#348
mam4dali wants to merge 1 commit intotboothman:masterfrom
mam4dali:dev

Conversation

@mam4dali
Copy link
Copy Markdown
Contributor

Summary

IMDB has started returning HTTP 202 responses with AWS WAF challenges instead of page content.
This PR adds automatic challenge solving so the library continues to work transparently.

Changes

  • New Aws.php: PHP port of the AWS WAF challenge algorithm (AES-GCM encryption, CRC fingerprinting, bandwidth/scrypt/PoW solvers). Based on tveronesi/imdbinfo (MIT License).
  • Modified Request.php: Detect 202 status, fetch challenge HTML, solve via Aws, retry with token cookie. Token is cached to avoid re-solving on every request.
  • composer.json: Added ext-openssl requirement.
  • bootstrap.php: Added Aws.php autoload entry.

How it works

  1. Request gets HTTP 202 → solveAwsChallenge() is triggered
  2. If response body is empty (e.g. GraphQL API), challenge HTML is fetched from the main domain
  3. Challenge is solved and the token is sent as aws-waf-token cookie on retry
  4. Token is persisted to file (~280s TTL) so subsequent requests skip solving

Implement AWS WAF challenge solver (Aws.php) ported from tveronesi/imdbinfo (MIT).
Handle HTTP 202 challenge responses in Request class with automatic retry.
Cache solved token to file to avoid re-solving on subsequent requests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant