From 8bc9473a557d3304f98675631241259bcb57b207 Mon Sep 17 00:00:00 2001 From: nnposter Date: Wed, 28 Dec 2016 18:23:58 +0000 Subject: [PATCH] Adds support for Ed25519 keys to script ssh-hostkey --- CHANGELOG | 2 ++ nselib/ssh2.lua | 3 +++ scripts/ssh-hostkey.nse | 3 +++ 3 files changed, 8 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 2622f0062..00cc59e74 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ # Nmap Changelog ($Id$); -*-text-*- +o [NSE] Script ssh-hostkey now recognizes and reports Ed25519 keys [nnposter] + o [NSE][GH#627] Fixed script hang in several brute scripts due to the "threads" script-arg not being converted to a number. Error message was "nselib/brute.lua:1188: attempt to compare number with string" [Arne Beer] diff --git a/nselib/ssh2.lua b/nselib/ssh2.lua index 25461a26c..2d039f929 100644 --- a/nselib/ssh2.lua +++ b/nselib/ssh2.lua @@ -314,6 +314,9 @@ fetch_host_key = function( host, port, key_type ) elseif key_type == 'ecdsa-sha2-nistp521' then algorithm = "ECDSA" bits = "521" + elseif key_type == 'ssh-ed25519' then + algorithm = "EdDSA" + bits = "256" else stdnse.debug1("Unsupported key type: %s", key_type ) end diff --git a/scripts/ssh-hostkey.nse b/scripts/ssh-hostkey.nse index 8001ee67c..dbf33647f 100644 --- a/scripts/ssh-hostkey.nse +++ b/scripts/ssh-hostkey.nse @@ -300,6 +300,9 @@ local function portaction(host, port) key = ssh2.fetch_host_key( host, port, "ecdsa-sha2-nistp521" ) if key then table.insert( keys, key ) end + key = ssh2.fetch_host_key( host, port, "ssh-ed25519" ) + if key then table.insert( keys, key ) end + if #keys == 0 then return nil end