Skip to main content
Glama

metasploit_search

Search Metasploit modules by service or platform to identify relevant exploits for penetration testing and security assessments.

Instructions

Search for Metasploit modules based on detected services

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serviceYesService name or version
platformNoTarget platform

Implementation Reference

  • Main handler function that executes Metasploit search via msfconsole, parses output, and returns ScanResult.
    async metasploitSearch(service: string, platform?: string): Promise<ScanResult> { try { let command = `msfconsole -q -x "search ${service}`; if (platform) { command += ` platform:${platform}`; } command += '; exit"'; console.error(`Executing: ${command}`); const { stdout, stderr } = await execAsync(command, { timeout: 60000 // 1 min timeout }); const modules = this.parseMetasploitSearch(stdout); return { target: service, timestamp: new Date().toISOString(), tool: 'metasploit_search', results: { modules, total_found: modules.length, search_query: service, platform_filter: platform }, status: 'success' }; } catch (error) { return { target: service, timestamp: new Date().toISOString(), tool: 'metasploit_search', results: {}, status: 'error', error: error instanceof Error ? error.message : String(error) }; } }
  • MCP tool schema defining input parameters: service (required), platform (optional).
    name: "metasploit_search", description: "Search for Metasploit modules based on detected services", inputSchema: { type: "object", properties: { service: { type: "string", description: "Service name or version" }, platform: { type: "string", description: "Target platform" } }, required: ["service"] } },
  • src/index.ts:528-530 (registration)
    Tool dispatch registration in the main switch statement that routes calls to the exploitTools.metasploitSearch method.
    case "metasploit_search": return respond(await this.exploitTools.metasploitSearch(args.service, args.platform));
  • Helper function to parse Metasploit console search output into structured MetasploitModule array.
    private parseMetasploitSearch(output: string): MetasploitModule[] { const modules: MetasploitModule[] = []; const lines = output.split('\n'); for (const line of lines) { // Parse metasploit module output if (line.includes('exploit/') || line.includes('auxiliary/')) { const parts = line.trim().split(/\s+/); if (parts.length >= 3) { modules.push({ name: parts[0], description: parts.slice(2).join(' '), platform: [], // Would need more detailed parsing targets: [], rank: parts[1] || 'Unknown', disclosed: '', references: [] }); } } } return modules; }
  • TypeScript interface defining the structure of Metasploit modules returned by the tool.
    export interface MetasploitModule { name: string; description: string; platform: string[]; targets: string[]; rank: string; disclosed: string; references: string[]; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/adriyansyah-mf/mcp-pentest'

If you have feedback or need assistance with the MCP directory API, please join our Discord server