From 2ea0c3d69aa72eb452436602bb76d62b657e2184 Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 3 Aug 2017 15:21:54 +0000 Subject: [PATCH] Fetch publickeydb from Nmap's search path. Fixes #955 --- scripts/ssh-publickey-acceptance.nse | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/ssh-publickey-acceptance.nse b/scripts/ssh-publickey-acceptance.nse index f971cbfd2..b86d356e2 100644 --- a/scripts/ssh-publickey-acceptance.nse +++ b/scripts/ssh-publickey-acceptance.nse @@ -1,3 +1,4 @@ +local nmap = require "nmap" local shortport = require "shortport" local stdnse = require "stdnse" local base64 = require "base64" @@ -8,8 +9,11 @@ local io = require "io" local libssh2_util = require "libssh2-utility" description = [[ -This script takes a table of paths to private keys, passphrases, and usernames and checks each pair to -see if the target ssh server accepts them for publickey authentication. If no keys are given or the known-bad option is given, the script will check if a list of known static public keys are accepted for authentication. +This script takes a table of paths to private keys, passphrases, and usernames +and checks each pair to see if the target ssh server accepts them for publickey +authentication. If no keys are given or the known-bad option is given, the +script will check if a list of known static public keys are accepted for +authentication. ]] --- @@ -39,7 +43,7 @@ local privatekeys = stdnse.get_script_args "ssh.privatekeys" local usernames = stdnse.get_script_args "ssh.usernames" local knownbad = stdnse.get_script_args "known-bad" local publickeys = stdnse.get_script_args "ssh.publickeys" -local publickeydb = stdnse.get_script_args "publickeydb" or "nselib/data/publickeydb" +local publickeydb = stdnse.get_script_args "publickeydb" or nmap.fetchfile("nselib/data/publickeydb") portrule = shortport.port_or_service(22, 'ssh') function action (host, port)