NSE: Fix potential crashes in ms-sql scripts and refactor deprecated format_output

This commit is contained in:
Jeffrey Shalom 2026-06-12 10:39:02 +05:30
parent d8c9880cd5
commit 2a7358dfe1
6 changed files with 17 additions and 15 deletions

View file

@ -145,9 +145,12 @@ do_action, portrule, hostrule = mssql.Helper.InitScript(process_instance)
action = function(...)
local scriptOutput = do_action(...)
if not scriptOutput then
return nil
end
if ( not(stdnse.get_script_args( {'ms-sql-xp-cmdshell.cmd', 'mssql-xp-cmdshell.cmd'} ) ) ) then
table.insert(scriptOutput, 1, "(Use --script-args=ms-sql-xp-cmdshell.cmd='<CMD>' to change command.)")
end
return stdnse.format_output( true, scriptOutput )
return scriptOutput
end