1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +00:00

Add passphrase support for privatekeys in ssh-publickey-acceptance

This commit is contained in:
dmiller
2017-09-08 18:10:17 +00:00
parent e400493b30
commit aa18e592db
3 changed files with 6 additions and 7 deletions

View File

@@ -95,7 +95,7 @@ function SSHConnection:password_auth (username, password)
end
---
-- Attempts to authenticate using provided publickey.
-- Attempts to authenticate using provided private key.
--
-- @param username A username to authenticate as.
-- @param privatekey_file A path to a privatekey.
@@ -105,10 +105,7 @@ function SSHConnection:publickey_auth (username, privatekey_file, passphrase)
if not self.session then
return false
end
print(self.session)
print(username)
print(privatekey_file)
if libssh2.userauth_publickey(self.session, username, privatekey_file, passphrase) then
if libssh2.userauth_publickey(self.session, username, privatekey_file, passphrase or "") then
self.authenticated = true
return true
else