From 78a526761b68cadf7599de03f0ea7134219daab6 Mon Sep 17 00:00:00 2001 From: dmiller Date: Tue, 9 Jan 2018 17:35:41 +0000 Subject: [PATCH] Avoid erroring when -sV but scripts directory is missing or modified --- nse_main.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nse_main.lua b/nse_main.lua index cf81d9ad7..a78beca74 100644 --- a/nse_main.lua +++ b/nse_main.lua @@ -818,7 +818,10 @@ local function get_chosen_scripts (rules) t, path = cnse.fetchscript(rule..".nse"); end if t == nil then - error("'"..rule.."' did not match a category, filename, or directory"); + -- Avoid erroring if -sV but no scripts are present + if not (cnse.scriptversion and rule == "version") then + error("'"..rule.."' did not match a category, filename, or directory"); + end elseif t == "file" and not files_loaded[path] then script_params.selection = "file path"; script_params.verbosity = true;