elevate.ts•2.22 kB
/**
* Elevate operation-related MCP tools
*/
import { Tool } from '@modelcontextprotocol/sdk/types.js';
import { CobaltStrikeClient } from '../api/client.js';
export function createElevateTools(client: CobaltStrikeClient): Tool[] {
return [
{
name: 'elevate_beacon',
description: 'Elevate to a new beacon with higher privileges',
inputSchema: {
type: 'object',
properties: {
beaconId: {
type: 'string',
description: 'The ID of the beacon',
},
listener: {
type: 'string',
description: 'Listener name for the elevated beacon',
},
technique: {
type: 'string',
description: 'Elevation technique (e.g., "uac-token-duplication", "uac-token-duplication")',
},
},
required: ['beaconId', 'listener'],
},
},
{
name: 'elevate_command',
description: 'Elevate a command with higher privileges',
inputSchema: {
type: 'object',
properties: {
beaconId: {
type: 'string',
description: 'The ID of the beacon',
},
command: {
type: 'string',
description: 'Command to execute with elevated privileges',
},
technique: {
type: 'string',
description: 'Elevation technique',
},
},
required: ['beaconId', 'command'],
},
},
];
}
export async function handleElevateTool(
name: string,
args: any,
client: CobaltStrikeClient
): Promise<string> {
switch (name) {
case 'elevate_beacon':
const elevateBeaconResult = await client.elevateBeacon(args.beaconId, args.listener, args.technique);
return JSON.stringify({ taskId: elevateBeaconResult, message: 'Elevate beacon command submitted' }, null, 2);
case 'elevate_command':
const elevateCommandResult = await client.elevateCommand(args.beaconId, args.command, args.technique);
return JSON.stringify({ taskId: elevateCommandResult, message: 'Elevate command submitted' }, null, 2);
default:
throw new Error(`Unknown elevate tool: ${name}`);
}
}