johnalbertini14-glitch/openclaw-skills / skills/0xclanky/captcha-relay
captcha-relay
FlaggedHuman-in-the-loop CAPTCHA solving with two modes: screenshot (default, zero infrastructure) and token relay (requires network access). Screenshot mode captures the page with a grid overlay, sends it to the human, and injects clicks based on their reply. Token relay mode detects CAPTCHA type + sitekey, serves the real widget on a relay page for native solving, and injects the token via CDP.
| File | Kind | Size |
|---|---|---|
| ARCHITECTURE.md | markdown | 4.2 KB |
| README.md | markdown | 4.0 KB |
| SKILL.md | skill md | 3.6 KB |
| TAILSCALE.md | markdown | 3.0 KB |
| _meta.json | config | 458 B |
| browser-relay-cli.js | script | 981 B |
| fallback/screenshot.js | script | 5.2 KB |
| index.js | script | 5.4 KB |
| lib/browser-relay.js | script | 7.9 KB |
| lib/cdp.js | script | 2.8 KB |
| lib/detect.js | script | 2.8 KB |
| lib/inject.js | script | 4.5 KB |
| lib/server.js | script | 2.6 KB |
| lib/templates/browser-relay.html | other | 7.5 KB |
| lib/templates/hcaptcha.html | other | 1.8 KB |
| lib/templates/recaptcha-v2.html | other | 1.9 KB |
| lib/templates/turnstile.html | other | 1.8 KB |
| lib/tunnel.js | script | 4.2 KB |
| package-lock.json | manifest | 17.2 KB |
| package.json | manifest | 443 B |
lib/inject.js
View on GitHub/**
* Inject CAPTCHA token back into the automated browser via CDP
*/
const { CdpSession, getCdpWsUrl, getPageTargets } = require('./cdp');
const INJECTION_SCRIPTS = {
'recaptcha-v2': (token) => `
(() => {
// Set the textarea value
const ta = document.querySelector('#g-recaptcha-response') ||
document.querySelector('[name="g-recaptcha-response"]');
if (ta) {
ta.value = ${JSON.stringify(token)};
ta.style.display = 'block'; // make visible temporarily for events
ta.dispatchEvent(new Event('input', { bubbles: true }));
ta.style.display = '';
}
// Try to call the registered callback
try {
// Method 1: data-callback attribute
const widget = document.querySelector('.g-recaptcha');
if (widget && widget.dataset.callback) {
window[widget.dataset.callback](${JSON.stringify(token)});
return 'callback-attr';
}
} catch(e) {}
try {
// Method 2: grecaptcha internal
if (typeof ___grecaptcha_cfg !== 'undefined') {
const clients = ___grecaptcha_cfg.clients;
for (const key of Object.keys(clients)) {
const client = clients[key];
// Walk the object tree to find callback
const walk = (obj, depth) => {
if (depth > 4 || !obj) return;
for (const k of Object.keys(obj)) {
if (typeof obj[k] === 'function' && k === 'callback') {
obj[k](${JSON.stringify(token)});
return true;
}
if (typeof obj[k] === 'object') {
if (walk(obj[k], depth + 1)) return true;
}
}
};
walk(client, 0);
}
return 'internal-callback';
}
} catch(e) {}
// Method 3: grecaptcha.execute style
try {
if (typeof grecaptcha !== 'undefined' && grecaptcha.getResponse) {
return 'grecaptcha-available';
}
} catch(e) {}
return 'textarea-only';
})()
`,
'hcaptcha': (token) => `
(() => {
const ta = document.querySelector('[name="h-captcha-response"]') ||
document.querySelector('textarea[name="h-captcha-response"]');
if (ta) ta.value = ${JSON.stringify(token)};
// Set iframe response too
const iframes = document.querySelectorAll('iframe[data-hcaptcha-response]');
iframes.forEach(f => f.setAttribute('data-hcaptcha-response', ${JSON.stringify(token)}));
// Call hcaptcha callback
try {
const widget = document.querySelector('.h-captcha');
if (widget && widget.dataset.callback) {
window[widget.dataset.callback](${JSON.stringify(token)});
return 'callback';
}
} catch(e) {}
// Try hcaptcha internal
try {
if (typeof hcaptcha !== 'undefined') {
// Trigger via internal event system
const evt = new CustomEvent('hcaptcha-success', { detail: { token: ${JSON.stringify(token)} } });
window.dispatchEvent(evt);
return 'event-dispatched';
}
} catch(e) {}
return 'textarea-only';
})()
`,
'turnstile': (token) => `
(() => {
const ta = document.querySelector('[name="cf-turnstile-response"]') ||
document.querySelector('input[name="cf-turnstile-response"]');
if (ta) ta.value = ${JSON.stringify(token)};
// Try turnstile callback
try {
const widget = document.querySelector('.cf-turnstile');
if (widget && widget.dataset.callback) {
window[widget.dataset.callback](${JSON.stringify(token)});
return 'callback';
}
} catch(e) {}
return 'textarea-only';
})()
`,
};
async function injectToken({ type, token, cdpPort = 18800 }) {
// Use page target WS URL (not browser-level) for Runtime.evaluate
const targets = await getPageTargets(cdpPort);
const target = targets.find(t => !t.url.startsWith('chrome://')) || targets[0];
if (!target) throw new Error('No page targets found for injection');
const wsUrl = target.webSocketDebuggerUrl;
const session = new CdpSession(wsUrl);
await session.connect();
try {
const scriptFn = INJECTION_SCRIPTS[type];
if (!scriptFn) throw new Error(`No injection script for type: ${type}`);
const result = await session.send('Runtime.evaluate', {
expression: scriptFn(token),
returnByValue: true,
});
return result.result.value;
} finally {
session.close();
}
}
module.exports = { injectToken };
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |