render.extract_forms
Extract all forms from webpages to identify potential security vulnerabilities during bug bounty hunting and automated reconnaissance.
Instructions
Extract all forms from a webpage
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to extract forms from |
Implementation Reference
- src/tools/render.ts:135-193 (registration)Registration of the 'render.extract_forms' tool, including schema and handler function.server.tool( 'render.extract_forms', { description: 'Extract all forms from a webpage', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL to extract forms from' }, }, required: ['url'], }, }, async ({ url }: any): Promise<ToolResult> => { let page: Page | null = null; try { const browserInstance = await getBrowser(); page = await browserInstance.newPage(); await page.goto(url, { waitUntil: 'networkidle2', timeout: 30000 }); const forms = await page.$$eval('form', (forms) => forms.map((form, index) => ({ index, action: form.action, method: form.method, enctype: form.enctype, inputs: Array.from(form.querySelectorAll('input')).map((input: any) => ({ name: input.name, type: input.type, id: input.id, placeholder: input.placeholder, required: input.required, })), textareas: Array.from(form.querySelectorAll('textarea')).map((textarea: any) => ({ name: textarea.name, id: textarea.id, placeholder: textarea.placeholder, })), selects: Array.from(form.querySelectorAll('select')).map((select: any) => ({ name: select.name, id: select.id, options: Array.from(select.options).map((opt: any) => opt.value), })), })) ); await page.close(); return formatToolResult(true, { url, forms, count: forms.length, }); } catch (error: any) { if (page) await page.close().catch(() => {}); return formatToolResult(false, null, error.message); } } );
- src/tools/render.ts:147-191 (handler)Handler function that uses Puppeteer to load the URL and extract form details including inputs, textareas, and selects.async ({ url }: any): Promise<ToolResult> => { let page: Page | null = null; try { const browserInstance = await getBrowser(); page = await browserInstance.newPage(); await page.goto(url, { waitUntil: 'networkidle2', timeout: 30000 }); const forms = await page.$$eval('form', (forms) => forms.map((form, index) => ({ index, action: form.action, method: form.method, enctype: form.enctype, inputs: Array.from(form.querySelectorAll('input')).map((input: any) => ({ name: input.name, type: input.type, id: input.id, placeholder: input.placeholder, required: input.required, })), textareas: Array.from(form.querySelectorAll('textarea')).map((textarea: any) => ({ name: textarea.name, id: textarea.id, placeholder: textarea.placeholder, })), selects: Array.from(form.querySelectorAll('select')).map((select: any) => ({ name: select.name, id: select.id, options: Array.from(select.options).map((opt: any) => opt.value), })), })) ); await page.close(); return formatToolResult(true, { url, forms, count: forms.length, }); } catch (error: any) { if (page) await page.close().catch(() => {}); return formatToolResult(false, null, error.message); }
- src/tools/render.ts:137-146 (schema)Input schema for the tool, requiring a 'url' parameter.{ description: 'Extract all forms from a webpage', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL to extract forms from' }, }, required: ['url'], }, },