Skip to main content
Glama
beacon.ts4.67 kB
/** * Beacon-related MCP tools */ import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { CobaltStrikeClient } from '../api/client.js'; export function createBeaconTools(client: CobaltStrikeClient): Tool[] { return [ { name: 'list_beacons', description: 'List all active beacons in the Cobalt Strike teamserver', inputSchema: { type: 'object', properties: {}, }, }, { name: 'get_beacon', description: 'Get detailed information about a specific beacon by ID', inputSchema: { type: 'object', properties: { beaconId: { type: 'string', description: 'The ID of the beacon to retrieve', }, }, required: ['beaconId'], }, }, { name: 'execute_beacon_command', description: 'Execute a command on a beacon (e.g., "whoami", "ls", "shell", "powershell", etc.)', inputSchema: { type: 'object', properties: { beaconId: { type: 'string', description: 'The ID of the beacon to execute the command on', }, command: { type: 'string', description: 'The command to execute (e.g., "whoami", "ls", "shell whoami", "powershell Get-Process")', }, args: { type: 'array', items: { type: 'string' }, description: 'Optional arguments for the command', }, }, required: ['beaconId', 'command'], }, }, { name: 'get_beacon_output', description: 'Get the output from a beacon (console output)', inputSchema: { type: 'object', properties: { beaconId: { type: 'string', description: 'The ID of the beacon to get output from', }, }, required: ['beaconId'], }, }, { name: 'get_beacon_task', description: 'Get the status and output of a specific beacon task', inputSchema: { type: 'object', properties: { beaconId: { type: 'string', description: 'The ID of the beacon', }, taskId: { type: 'string', description: 'The ID of the task to retrieve', }, }, required: ['beaconId', 'taskId'], }, }, { name: 'kill_beacon', description: 'Kill/remove a beacon from the teamserver', inputSchema: { type: 'object', properties: { beaconId: { type: 'string', description: 'The ID of the beacon to kill', }, }, required: ['beaconId'], }, }, { name: 'note_beacon', description: 'Add or update a note on a beacon', inputSchema: { type: 'object', properties: { beaconId: { type: 'string', description: 'The ID of the beacon to note', }, note: { type: 'string', description: 'The note text to add to the beacon', }, }, required: ['beaconId', 'note'], }, }, ]; } export async function handleBeaconTool( name: string, args: any, client: CobaltStrikeClient ): Promise<string> { switch (name) { case 'list_beacons': const beacons = await client.listBeacons(); return JSON.stringify(beacons, null, 2); case 'get_beacon': const beacon = await client.getBeacon(args.beaconId); return JSON.stringify(beacon, null, 2); case 'execute_beacon_command': const taskId = await client.executeBeaconCommand( args.beaconId, args.command, args.args ); return JSON.stringify({ taskId, message: 'Command submitted successfully' }, null, 2); case 'get_beacon_output': const output = await client.getBeaconOutput(args.beaconId); return JSON.stringify({ output }, null, 2); case 'get_beacon_task': const task = await client.getBeaconTask(args.beaconId, args.taskId); return JSON.stringify(task, null, 2); case 'kill_beacon': const killed = await client.killBeacon(args.beaconId); return JSON.stringify({ success: killed, message: killed ? 'Beacon killed successfully' : 'Failed to kill beacon' }, null, 2); case 'note_beacon': const noted = await client.noteBeacon(args.beaconId, args.note); return JSON.stringify({ success: noted, message: noted ? 'Note added successfully' : 'Failed to add note' }, null, 2); default: throw new Error(`Unknown beacon tool: ${name}`); } }

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/MickeyDB/Cobalt-Strike-MCP'

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