NinjaSurfer Docs / Captcha ← Back to the site
Docs · Captcha

Captcha

A native captcha module inside the browser engine: it clears supported challenges without executing a single line of JavaScript in the page — perception through the accessibility path, action through the engine's humanized input, so everything it does looks like a real user.


The short version

The module is always on — there is no enable switch. Two entry points:

What a vendor rebrand changes — labels, hosts, layout sizes — is data, updated through the signature pack without a rebuild.

Supported challenges

Family Kind Notes
Cloudflare Turnstile checkbox (interstitial + widget) also look-alike gates
reCAPTCHA v2 checkbox + audio flow audio transcribed by a configured STT endpoint (or the local Whisper server — see below)
reCAPTCHA v2 / hCaptcha image grids tiles located by perception, chosen by a configured vision model (--captcha-llm-*)
GeeTest v3/v4 slide puzzle the gap is found in the pixels of a native screenshot; dragged with a human velocity profile; no backend needed
AWS WAF checkbox
Akamai / PerimeterX press & hold a humanized press-hold-release (1.4–2.2 s, jittered); div-only widget, seen through the text-node perception fallback

Invisible challenges (Turnstile invisible, reCAPTCHA v3) have nothing to act on: they are passive scoring, reported as not_found.

Launch switches

sh
--captcha-auto               # automatic mode from the start
--captcha-interval=3         # idle re-check period, seconds (1..60, default 3)
--captcha-timeout=30         # verification budget per solve, seconds (1..300)
--captcha-llm-url/key/model  # optional vision backend (image grids)
--captcha-stt-url/key/model  # optional STT backend (reCAPTCHA audio)
--captcha-signatures=URL     # signature pack: https://… (loopback http and
                             # file:// allowed)

Remote endpoints must be https (loopback http allowed); keys travel only in the Authorization header and never appear in logs.

The automatic mode

One watcher per tab: after each committed navigation (and once when watching starts) it runs the same pipeline as resolveCaptcha — detection is part of it, so a page without a captcha costs one observation and nothing else. Tabs opened later are picked up by the sweep.

The idle watch is two-tier, so the default 3 s period costs almost nothing: every tick is a frame-tree scan — pure browser process, microseconds, the renderer untouched — and the full accessibility observation (milliseconds of renderer CPU per tab) runs only when a challenge frame is present (every real family has one) or every ~15 s as a fallback for frame-less gates.

Guards: one solve at a time per tab, a per-tab cooldown, never twice for the same navigation, and failures are never auto-retried (call captcha_resolve for deliberate retries).

Runtime control on a running browser

CDP (any client connected to the browser):

json
{"id":1,"method":"Browser.setCaptchaAuto","params":{
  "targetId":"<any tab>","enabled":true}}
→ {"enabled":true}

{"id":2,"method":"Browser.resolveCaptcha","params":{
  "targetId":"<the page>","timeoutSeconds":30}}
→ {"status":"solved","provider":"cloudflare","message":"challenge cleared"}

{"id":3,"method":"Browser.setCaptchaOptions","params":{
  "targetId":"<any tab>","options":"{\"signaturesUrl\":\"https://ops.example/pack.json\"}"}}
→ {"options":"{…the normalized options now in effect…}"}

status ∈ solved | not_found | disabled | timeout | failed | tab_closed | unsupported. The auto toggle and the options are process-global (all tabs); targetId only routes the call. setCaptchaOptions accepts the same keys as the runtime view: auto, intervalSeconds, timeoutSeconds, the llm*/stt* backends and signaturesUrl — setting a pack URL reloads the pack live.

Signature packs

A pack is a small JSON an operator serves (any static host — S3, a CDN, your own endpoint); the engine is the client. It carries everything a vendor rebrand touches, so fixes land server-side without a rebuild:

json
{
  "version": 2,
  "providers": {
    "cloudflare": {
      "frame_hosts": ["challenges.cloudflare.com"],
      "checkbox_names": ["verify you are human"],
      "entry_names": [], "audio_buttons": [], "play_buttons": [],
      "response_fields": [], "verify_buttons": [], "refresh_buttons": [],
      "geometry": {"cell_min_px": 40}
    }
  }
}

Flow logic — a genuinely new interaction type — is the only part that needs an engine update; everything short of it is data.

CLI

start accepts the launch switches directly:

sh
npx ninjasurfer start my-profile --captcha-auto --captcha-interval=5 \
  --captcha-stt-url=https://stt.example/v1/audio/transcriptions --captcha-stt-key=…

--local-stt (with an optional --stt-model) starts the local Whisper server described under Backends and passes its --captcha-stt-* switches to the browser for you.

MCP

The MCP server exposes three tools (they map 1:1 to the CDP commands above):

An engine build without the captcha module answers with a clear "this engine build has no captcha module" instead of a raw protocol error.

Backends