From 9fb374c743a7606abb969bb3f9a5e3865c5d31d5 Mon Sep 17 00:00:00 2001 From: dmiller Date: Wed, 17 Dec 2014 03:32:11 +0000 Subject: [PATCH] Make ssh1 and ssh2 fetch_host_key return the same structure This was indirectly causing the crash reported here: http://seclists.org/nmap-dev/2014/q4/332 ssh1.fetch_host_key now returns a table with the full_key value containing a key as it would be output by ssh-keygen. The previous value named full_key is now named "key". --- nselib/ssh1.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nselib/ssh1.lua b/nselib/ssh1.lua index 190f80b52..62d5c1ccc 100644 --- a/nselib/ssh1.lua +++ b/nselib/ssh1.lua @@ -107,7 +107,8 @@ fetch_host_key = function(host, port) fp_input = mod:tobin()..exp:tobin() return {exp=exp,mod=mod,bits=host_key_bits,key_type='rsa1',fp_input=fp_input, - full_key=exp:todec()..' '..mod:todec(),algorithm="RSA1", + full_key=('%d %s %s'):format(host_key_bits, exp:todec(), mod:todec()), + key=('%s %s'):format(exp:todec(), mod:todec()), algorithm="RSA1", fingerprint=openssl.md5(fp_input)} end end