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 |
fallback/screenshot.js
View on GitHub/**
* Screenshot-based CAPTCHA relay (fallback for domain-locked CAPTCHAs)
* Takes screenshot, overlays numbered grid, sends to human via Telegram
*/
const { CdpSession, getCdpWsUrl } = require('../lib/cdp');
const sharp = require('sharp');
const path = require('path');
const fs = require('fs');
/**
* Detect grid dimensions from CAPTCHA iframe
*/
const GRID_DETECT_SCRIPT = `
(() => {
// Try reCAPTCHA bframe
const bframe = document.querySelector('iframe[src*="recaptcha/api2/bframe"]');
if (bframe) {
try {
const doc = bframe.contentDocument;
const tds = doc.querySelectorAll('td[role="button"]');
const rows = doc.querySelectorAll('tr').length;
const cols = tds.length / rows;
const prompt = doc.querySelector('.rc-imageselect-desc-no-canonical')?.textContent ||
doc.querySelector('.rc-imageselect-desc')?.textContent || '';
const table = doc.querySelector('table.rc-imageselect-table');
const rect = table ? table.getBoundingClientRect() : null;
const frameRect = bframe.getBoundingClientRect();
return {
found: true, rows, cols, prompt,
gridClip: rect ? {
x: Math.round(frameRect.x + rect.x),
y: Math.round(frameRect.y + rect.y),
w: Math.round(rect.width),
h: Math.round(rect.height)
} : null
};
} catch(e) {
return { found: true, rows: 3, cols: 3, prompt: '', gridClip: null, error: e.message };
}
}
return { found: false };
})()
`;
async function captureAndAnnotate(cdpPort = 18800) {
const wsUrl = await getCdpWsUrl(cdpPort);
const session = new CdpSession(wsUrl);
await session.connect();
try {
// Detect grid
const gridInfo = await session.send('Runtime.evaluate', {
expression: GRID_DETECT_SCRIPT,
returnByValue: true,
});
const grid = gridInfo.result.value;
// Take screenshot
const screenshotResult = await session.send('Page.captureScreenshot', {
format: 'png',
clip: grid.gridClip ? {
x: grid.gridClip.x,
y: grid.gridClip.y,
width: grid.gridClip.w,
height: grid.gridClip.h,
scale: 1,
} : undefined,
});
const imgBuffer = Buffer.from(screenshotResult.data, 'base64');
const metadata = await sharp(imgBuffer).metadata();
const { width, height } = metadata;
const rows = grid.rows || 3;
const cols = grid.cols || 3;
// Create SVG overlay with numbered cells
const cellW = Math.floor(width / cols);
const cellH = Math.floor(height / rows);
const fontSize = Math.min(cellW, cellH) * 0.3;
let svgParts = [`<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg">`];
let cellNum = 1;
for (let r = 0; r < rows; r++) {
for (let c = 0; c < cols; c++) {
const cx = c * cellW + cellW / 2;
const cy = r * cellH + cellH / 2;
// Number circle
svgParts.push(`<circle cx="${cx}" cy="${cy}" r="${fontSize * 0.7}" fill="rgba(0,0,0,0.6)" stroke="white" stroke-width="2"/>`);
svgParts.push(`<text x="${cx}" y="${cy + fontSize * 0.35}" text-anchor="middle" fill="white" font-size="${fontSize}" font-family="Arial" font-weight="bold">${cellNum}</text>`);
// Grid lines
if (c > 0) svgParts.push(`<line x1="${c * cellW}" y1="0" x2="${c * cellW}" y2="${height}" stroke="rgba(255,255,255,0.3)" stroke-width="1"/>`);
if (r > 0) svgParts.push(`<line x1="0" y1="${r * cellH}" x2="${width}" y2="${r * cellH}" stroke="rgba(255,255,255,0.3)" stroke-width="1"/>`);
cellNum++;
}
}
svgParts.push('</svg>');
const annotated = await sharp(imgBuffer)
.composite([{ input: Buffer.from(svgParts.join('')), top: 0, left: 0 }])
.png()
.toBuffer();
const outPath = path.join('/tmp', `captcha-grid-${Date.now()}.png`);
fs.writeFileSync(outPath, annotated);
return {
imagePath: outPath,
imageBuffer: annotated,
prompt: grid.prompt || 'Select the correct images',
rows,
cols,
totalCells: rows * cols,
};
} finally {
session.close();
}
}
/**
* Inject cell clicks into reCAPTCHA grid
*/
async function injectGridClicks(cells, cdpPort = 18800) {
const wsUrl = await getCdpWsUrl(cdpPort);
const session = new CdpSession(wsUrl);
await session.connect();
try {
const script = `
(() => {
const cells = ${JSON.stringify(cells)};
const bframe = document.querySelector('iframe[src*="recaptcha/api2/bframe"]');
if (!bframe) return 'no-bframe';
const doc = bframe.contentDocument;
const tds = doc.querySelectorAll('td[role="button"]');
cells.forEach(c => { if (tds[c - 1]) tds[c - 1].click(); });
// Click verify after a short delay
setTimeout(() => {
const verify = doc.querySelector('#recaptcha-verify-button');
if (verify) verify.click();
}, 500);
return 'clicked-' + cells.join(',');
})()
`;
const result = await session.send('Runtime.evaluate', {
expression: script,
returnByValue: true,
});
return result.result.value;
} finally {
session.close();
}
}
module.exports = { captureAndAnnotate, injectGridClicks };
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 |