ssh_keyscan
Retrieve SSH key fingerprints from remote hosts to verify server identity and establish secure connections for system administration tasks.
Instructions
Obtener fingerprint de claves SSH de un host
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | Yes | Host para obtener claves SSH |
Implementation Reference
- src/index.js:630-661 (handler)The main handler for the 'ssh_keyscan' tool. It validates the host input, constructs the ssh-keyscan command with optional port, executes it using the shared executePowerShell function, and formats the response with output and metadata.case 'ssh_keyscan': log('info', `🔑 Obteniendo claves SSH: ${args.host}`); // Validar formato de host if (!args.host || !/^[\w\.\-]+$/.test(args.host)) { throw new Error('Formato de host inválido'); } const port = args.port || 22; const keyCommand = `ssh-keyscan -p ${port} ${args.host}`; const keyResult = await executePowerShell(keyCommand, args.timeout); return { content: [ { type: 'text', text: `🔑 Claves SSH de ${args.host}:${port}:\n\n${keyResult.output}` } ], isError: false, metadata: { tool: 'ssh_keyscan', host: args.host, port: port, exitCode: keyResult.exitCode, executionTime: keyResult.executionTime, rateLimitInfo: { remainingRequests: rateLimiter.getRemainingRequests() }, timestamp: new Date().toISOString() } };
- src/index.js:468-490 (schema)The input schema and registration details for the 'ssh_keyscan' tool, defining parameters like host (required), port (default 22), and timeout.{ name: 'ssh_keyscan', description: 'Obtener fingerprint de claves SSH de un host', inputSchema: { type: 'object', properties: { host: { type: 'string', description: 'Host para obtener claves SSH' }, port: { type: 'number', description: 'Puerto SSH (opcional, default: 22)', default: 22 }, timeout: { type: 'number', description: 'Timeout en milisegundos (opcional)' } }, required: ['host'] } }
- src/index.js:399-493 (registration)The ListToolsRequestSchema handler where all tools including 'ssh_keyscan' are registered and listed.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: 'ssh_execute', description: 'Ejecutar comandos en máquinas remotas vía SSH usando clave SSH', inputSchema: { type: 'object', properties: { host: { type: 'string', description: 'Dirección IP o hostname del servidor remoto' }, user: { type: 'string', description: 'Nombre de usuario para SSH' }, command: { type: 'string', description: 'Comando a ejecutar en el servidor remoto' }, keyPath: { type: 'string', description: 'Ruta a la clave SSH privada (opcional)' }, timeout: { type: 'number', description: 'Timeout en milisegundos (opcional)' } }, required: ['host', 'user', 'command'] } }, { name: 'powershell_execute', description: 'Ejecutar comandos PowerShell localmente', inputSchema: { type: 'object', properties: { command: { type: 'string', description: 'Comando PowerShell a ejecutar' }, timeout: { type: 'number', description: 'Timeout en milisegundos (opcional)' } }, required: ['command'] } }, { name: 'ssh_scan', description: 'Escanear red para encontrar hosts SSH disponibles', inputSchema: { type: 'object', properties: { target: { type: 'string', description: 'Red a escanear (ej: 192.168.1.0/24) o host individual' }, timeout: { type: 'number', description: 'Timeout en milisegundos (opcional)' } }, required: ['target'] } }, { name: 'ssh_keyscan', description: 'Obtener fingerprint de claves SSH de un host', inputSchema: { type: 'object', properties: { host: { type: 'string', description: 'Host para obtener claves SSH' }, port: { type: 'number', description: 'Puerto SSH (opcional, default: 22)', default: 22 }, timeout: { type: 'number', description: 'Timeout en milisegundos (opcional)' } }, required: ['host'] } } ] }; });