Skip to main content
Glama
abdessamad-elamrani

MalwareAnalyzerMCP

objdump

Analyze object files to display headers, disassemble code, or examine sections for malware investigation.

Instructions

Display information from object files

Example usage:

  • Display file headers: { "target": "suspicious.o" }

  • Disassemble code: { "target": "suspicious.exe", "disassemble": true }

  • Show section headers: { "target": "suspicious.exe", "headers": true }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYesTarget file or data to analyze
optionsNoAdditional command-line options
disassembleNoDisassemble executable sections
headersNoDisplay the contents of the section headers

Implementation Reference

  • Core handler logic for executing the 'objdump' tool: checks if specialized command, validates input using the tool's schema, builds the shell command using buildCommand, executes it via terminalManager.shellCommand, and returns the result.
    if (commands[name]) {
      try {
        const cmdConfig = commands[name];
        
        // Validate arguments against schema
        const validationResult = cmdConfig.schema.safeParse(args);
        if (!validationResult.success) {
          return {
            content: [{ 
              type: "text", 
              text: `Error: Invalid parameters for ${name} command.\n${JSON.stringify(validationResult.error.format())}`
            }],
            isError: true,
          };
        }
        
        // Build the command string
        const commandStr = cmdConfig.buildCommand(validationResult.data);
        console.error(`Executing specialized command: ${commandStr}`);
        
        // Execute the command via the terminal manager
        const result = await terminalManager.shellCommand(commandStr);
        console.error(`${name} command executed with PID: ${result.pid}, blocked: ${result.isBlocked}`);
        
        return {
          content: [{ type: "text", text: JSON.stringify(result) }],
        };
      } catch (error) {
        console.error(`Error executing ${name} command:`, error);
        return {
          content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }],
          isError: true,
        };
      }
  • serverMCP.js:113-121 (registration)
    Registers the 'objdump' tool (among specialized tools) in the MCP tools list by dynamically mapping from the commands configuration to include name, description, and inputSchema.
    const specializedTools = Object.values(commands).map(cmd => ({
      name: cmd.name,
      description: cmd.description + (cmd.helpText ? '\n' + cmd.helpText : ''),
      inputSchema: zodToJsonSchema(cmd.schema),
    }));
    
    return {
      tools: [...basicTools, ...specializedTools],
    };
  • Zod input schema definition for the 'objdump' tool, extending the base schema with optional boolean parameters for disassembly and headers.
    schema: baseCommandSchema.extend({
      disassemble: z.boolean().optional().describe("Disassemble executable sections"),
      headers: z.boolean().optional().describe("Display the contents of the section headers")
    }),
  • Helper function that constructs the specific 'objdump' shell command string based on provided arguments, adding appropriate flags or defaulting to file headers.
    buildCommand: (args) => {
      let options = args.options ? args.options : '';
      
      if (args.disassemble) {
        options += ' -d';
      }
      
      if (args.headers) {
        options += ' -h';
      }
      
      // Default to displaying file headers if no specific options provided
      if (!options && !args.disassemble && !args.headers) {
        options = ' -f';
      }
      
      return `objdump${options} ${args.target}`;
    },

Latest Blog Posts

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/abdessamad-elamrani/MalwareAnalyzerMCP'

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