1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-10 09:49:05 +00:00

Add ssh banner to ssh-auth-methods

This commit is contained in:
dmiller
2024-03-27 19:51:37 +00:00
parent 17ee0b3362
commit b7ee15c186
6 changed files with 3393 additions and 2333 deletions

View File

@@ -147,6 +147,23 @@ function SSHConnection:list (username)
return false
end
---
-- Attempt to retrieve the server's pre-auth banner
--
-- Need to attempt auth first (for instance by calling list)
--
-- @return The server's banner or nil on failure.
function SSHConnection:banner ()
if not self.session then
return nil
end
local status, banner = pcall(libssh2.userauth_banner, self.session)
if status then
return banner
end
return nil
end
---
-- Attempts to read public key file
--