data.ts•2.9 kB
/**
* Data operations-related MCP tools (screenshots, keystrokes, downloads)
*/
import { Tool } from '@modelcontextprotocol/sdk/types.js';
import { CobaltStrikeClient } from '../api/client.js';
export function createDataTools(client: CobaltStrikeClient): Tool[] {
return [
{
name: 'list_screenshots',
description: 'List all screenshots captured from beacons',
inputSchema: {
type: 'object',
properties: {},
},
},
{
name: 'get_screenshot',
description: 'Get a specific screenshot by ID',
inputSchema: {
type: 'object',
properties: {
screenshotId: {
type: 'string',
description: 'The ID of the screenshot',
},
},
required: ['screenshotId'],
},
},
{
name: 'list_keystrokes',
description: 'List all keystroke captures from beacons',
inputSchema: {
type: 'object',
properties: {},
},
},
{
name: 'get_keystrokes',
description: 'Get keystroke data by ID',
inputSchema: {
type: 'object',
properties: {
keystrokeId: {
type: 'string',
description: 'The ID of the keystroke capture',
},
},
required: ['keystrokeId'],
},
},
{
name: 'list_downloads',
description: 'List all file downloads from beacons',
inputSchema: {
type: 'object',
properties: {},
},
},
{
name: 'get_download',
description: 'Get download information by ID',
inputSchema: {
type: 'object',
properties: {
downloadId: {
type: 'string',
description: 'The ID of the download',
},
},
required: ['downloadId'],
},
},
];
}
export async function handleDataTool(
name: string,
args: any,
client: CobaltStrikeClient
): Promise<string> {
switch (name) {
case 'list_screenshots':
const screenshots = await client.listScreenshots();
return JSON.stringify(screenshots, null, 2);
case 'get_screenshot':
const screenshot = await client.getScreenshot(args.screenshotId);
return JSON.stringify(screenshot, null, 2);
case 'list_keystrokes':
const keystrokes = await client.listKeystrokes();
return JSON.stringify(keystrokes, null, 2);
case 'get_keystrokes':
const keystroke = await client.getKeystrokes(args.keystrokeId);
return JSON.stringify(keystroke, null, 2);
case 'list_downloads':
const downloads = await client.listDownloads();
return JSON.stringify(downloads, null, 2);
case 'get_download':
const download = await client.getDownload(args.downloadId);
return JSON.stringify(download, null, 2);
default:
throw new Error(`Unknown data tool: ${name}`);
}
}