1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 04:09:01 +00:00

Handle libssh2 errors on connect. Closes #2616. Fixes #1014

This commit is contained in:
dmiller
2024-10-04 18:21:25 +00:00
parent b507356091
commit f1325d7c6f
5 changed files with 22 additions and 15 deletions

View File

@@ -41,8 +41,9 @@ portrule = shortport.ssh
function action (host, port)
local result = stdnse.output_table()
local helper = libssh2_util.SSHConnection:new()
if not helper:connect(host, port) then
return "Failed to connect to ssh server"
local status, err = helper:connect_pcall(host, port)
if not status then
return "Failed to connect to ssh server: " .. err
end
local authmethods = helper:list(username)