db_workspaces
List all available workspaces in Metasploit Framework to organize and manage penetration testing data for security assessments.
Instructions
List all Metasploit workspaces
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:436-467 (handler)Handler for the db_workspaces tool: executes the 'workspace' command in Metasploit console to list all workspaces and returns the result in JSON format.case "db_workspaces": { try { const workspaces = await executeMsfCommand([`workspace`]); return { content: [ { type: "text", text: JSON.stringify( { success: true, workspaces, }, null, 2 ), }, ], }; } catch (error: any) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: error.message, }), }, ], }; } }
- src/index.ts:145-152 (registration)Registration of the db_workspaces tool in the tools array, including its name, description, and empty input schema.{ name: "db_workspaces", description: "List all Metasploit workspaces", inputSchema: { type: "object", properties: {}, }, },
- src/index.ts:148-151 (schema)Input schema for the db_workspaces tool: accepts no parameters.inputSchema: { type: "object", properties: {}, },
- src/index.ts:27-40 (helper)Helper function executeMsfCommand used by db_workspaces handler to run Metasploit console commands.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"); } }