db_status
Check Metasploit database connection status to verify database connectivity for penetration testing operations and exploit management.
Instructions
Check Metasploit database status
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/index.ts:403-434 (handler)Handler for the 'db_status' tool. Executes the Metasploit 'db_status' command using the executeMsfCommand helper and returns the formatted result or error.case "db_status": { try { const status = await executeMsfCommand([`db_status`]); return { content: [ { type: "text", text: JSON.stringify( { success: true, status, }, null, 2 ), }, ], }; } catch (error: any) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: error.message, }), }, ], }; } }
- src/index.ts:137-144 (registration)Registration of the 'db_status' tool in the MCP tools array, including name, description, and empty input schema.{ name: "db_status", description: "Check Metasploit database status", inputSchema: { type: "object", properties: {}, }, },
- src/index.ts:27-40 (helper)Helper function used by the db_status handler to execute Metasploit commands via msfconsole with timeout and buffer limits.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"); } }