search_auxiliary
Find Metasploit auxiliary modules for security testing by searching with queries and filtering by type like scanner or admin.
Instructions
Search for auxiliary modules in Metasploit
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query for auxiliary modules | |
| type | No | Optional: Filter by auxiliary type |
Implementation Reference
- src/index.ts:288-326 (handler)Handler function for the 'search_auxiliary' tool. Extracts query and optional type parameters, constructs Metasploit search command for auxiliary modules, executes it via msfconsole, and returns formatted JSON results or error.
case "search_auxiliary": { const { query, type } = args as { query: string; type?: string }; const searchQuery = type ? `search type:auxiliary ${type} ${query}` : `search type:auxiliary ${query}`; try { const results = await executeMsfCommand([searchQuery]); return { content: [ { type: "text", text: JSON.stringify( { success: true, query, type: type || null, results, }, null, 2 ), }, ], }; } catch (error: any) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: error.message, }), }, ], }; } } - src/index.ts:90-108 (registration)Registration of the 'search_auxiliary' tool in the tools array, including name, description, and input schema definition.
{ name: "search_auxiliary", description: "Search for auxiliary modules in Metasploit", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query for auxiliary modules", }, type: { type: "string", enum: ["scanner", "admin", "dos", "fuzzers", "gather"], description: "Optional: Filter by auxiliary type", }, }, required: ["query"], }, }, - src/index.ts:93-107 (schema)Input schema definition for the 'search_auxiliary' tool, specifying query (required) and optional type filter with enum values.
inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query for auxiliary modules", }, type: { type: "string", enum: ["scanner", "admin", "dos", "fuzzers", "gather"], description: "Optional: Filter by auxiliary type", }, }, required: ["query"], }, - src/index.ts:27-40 (helper)Helper function used by search_auxiliary handler to execute Metasploit commands via msfconsole.
async function executeMsfCommand(commands: string[]): Promise<string> { const commandString = commands.join("; "); const fullCommand = `msfconsole -q -x "${commandString}; exit"`; try { const { stdout, stderr } = await execAsync(fullCommand, { timeout: 60000, // 60 second timeout maxBuffer: 10 * 1024 * 1024, // 10MB buffer }); return stdout || stderr; } catch (error: any) { throw new Error(error.message || "Command execution failed"); } }