Skip to main content
Glama

metasploit_search

Find Metasploit modules by searching for specific services or platforms to identify relevant exploits and auxiliary tools for security testing.

Instructions

Search for Metasploit modules based on detected services

Input Schema

NameRequiredDescriptionDefault
platformNoTarget platform
serviceYesService name or version

Input Schema (JSON Schema)

{ "properties": { "platform": { "description": "Target platform", "type": "string" }, "service": { "description": "Service name or version", "type": "string" } }, "required": [ "service" ], "type": "object" }

Implementation Reference

  • Main handler function that executes msfconsole search for the given service (optionally filtered by platform), parses the output using parseMetasploitSearch, and returns a structured 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) }; } }
  • Helper function to parse the stdout output from msfconsole search command into an array of MetasploitModule objects.
    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; }
  • Tool schema definition including input schema for service (required) and optional platform parameters.
    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-529 (registration)
    Tool dispatch/registration in the main switch statement that calls the exploitTools.metasploitSearch method.
    case "metasploit_search": return respond(await this.exploitTools.metasploitSearch(args.service, args.platform));
  • Type definition/interface for Metasploit modules returned in the search results.
    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