config.ts•3.69 kB
/**
* Configuration management-related MCP tools
*/
import { Tool } from '@modelcontextprotocol/sdk/types.js';
import { CobaltStrikeClient } from '../api/client.js';
export function createConfigTools(client: CobaltStrikeClient): Tool[] {
return [
{
name: 'get_system_information',
description: 'Get system information from teamserver',
inputSchema: {
type: 'object',
properties: {},
},
},
{
name: 'get_profile',
description: 'Get current Malleable C2 profile',
inputSchema: {
type: 'object',
properties: {},
},
},
{
name: 'update_profile',
description: 'Update Malleable C2 profile',
inputSchema: {
type: 'object',
properties: {
profile: {
type: 'string',
description: 'Profile content',
},
},
required: ['profile'],
},
},
{
name: 'get_killdate',
description: 'Get kill date',
inputSchema: {
type: 'object',
properties: {},
},
},
{
name: 'set_killdate',
description: 'Set kill date',
inputSchema: {
type: 'object',
properties: {
killdate: {
type: 'string',
description: 'Kill date (ISO 8601 format)',
},
},
required: ['killdate'],
},
},
{
name: 'get_teamserver_ip',
description: 'Get teamserver IP',
inputSchema: {
type: 'object',
properties: {},
},
},
{
name: 'set_teamserver_ip',
description: 'Set teamserver IP',
inputSchema: {
type: 'object',
properties: {
ip: {
type: 'string',
description: 'IP address',
},
},
required: ['ip'],
},
},
{
name: 'reset_data',
description: 'Reset teamserver data',
inputSchema: {
type: 'object',
properties: {},
},
},
];
}
export async function handleConfigTool(
name: string,
args: any,
client: CobaltStrikeClient
): Promise<string> {
switch (name) {
case 'get_system_information':
const sysInfo = await client.getSystemInformation();
return JSON.stringify(sysInfo, null, 2);
case 'get_profile':
const profile = await client.getProfile();
return JSON.stringify({ profile }, null, 2);
case 'update_profile':
const updateResult = await client.updateProfile(args.profile);
return JSON.stringify({ success: updateResult, message: updateResult ? 'Profile updated' : 'Failed to update profile' }, null, 2);
case 'get_killdate':
const killdate = await client.getKilldate();
return JSON.stringify({ killdate }, null, 2);
case 'set_killdate':
const setKilldateResult = await client.setKilldate(args.killdate);
return JSON.stringify({ success: setKilldateResult, message: setKilldateResult ? 'Kill date updated' : 'Failed to update kill date' }, null, 2);
case 'get_teamserver_ip':
const ip = await client.getTeamserverIP();
return JSON.stringify({ ip }, null, 2);
case 'set_teamserver_ip':
const setIPResult = await client.setTeamserverIP(args.ip);
return JSON.stringify({ success: setIPResult, message: setIPResult ? 'Teamserver IP updated' : 'Failed to update teamserver IP' }, null, 2);
case 'reset_data':
const resetResult = await client.resetData();
return JSON.stringify({ success: resetResult, message: resetResult ? 'Data reset' : 'Failed to reset data' }, null, 2);
default:
throw new Error(`Unknown config tool: ${name}`);
}
}