1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 22:21:29 +00:00

Rectifies an error when smb.list_dialects() fails. Closes #1726

This commit is contained in:
nnposter
2019-09-05 22:36:26 +00:00
parent 59c53f07fd
commit 991a2fa888

View File

@@ -51,24 +51,21 @@ hostrule = function(host)
end end
action = function(host,port) action = function(host,port)
local status, supported_dialects local status, supported_dialects = smb.list_dialects(host)
local output = stdnse.output_table()
status, supported_dialects = smb.list_dialects(host)
if status then if status then
for i, v in pairs(supported_dialects) do -- Mark SMBv1 as insecure for i, v in pairs(supported_dialects) do -- Mark SMBv1 as insecure
if v == "NT LM 0.12" then if v == "NT LM 0.12" then
supported_dialects[i] = v .. " (SMBv1) [dangerous, but default]" supported_dialects[i] = v .. " (SMBv1) [dangerous, but default]"
end end
end end
if #supported_dialects > 0 then
local output = stdnse.output_table()
output.dialects = supported_dialects output.dialects = supported_dialects
end
if #output.dialects>0 then
return output return output
else end
end
stdnse.debug1("No dialects were accepted") stdnse.debug1("No dialects were accepted")
if nmap.verbosity()>1 then if nmap.verbosity()>1 then
return "No dialects accepted. Something may be blocking the responses" return "No dialects accepted. Something may be blocking the responses"
end end
end end
end