mirror of
https://github.com/nmap/nmap.git
synced 2025-12-28 02:19:04 +00:00
Re-indent some scripts. Whitespace-only commit
https://secwiki.org/w/Nmap/Code_Standards
This commit is contained in:
@@ -66,92 +66,92 @@ dependencies = {"smb-brute"}
|
||||
|
||||
|
||||
hostrule = function(host)
|
||||
return smb.get_port(host) ~= nil
|
||||
return smb.get_port(host) ~= nil
|
||||
end
|
||||
|
||||
action = function(host)
|
||||
local status, shares, extra
|
||||
local response = {}
|
||||
local status, shares, extra
|
||||
local response = {}
|
||||
|
||||
-- Get the list of shares
|
||||
status, shares, extra = smb.share_get_list(host)
|
||||
if(status == false) then
|
||||
return stdnse.format_output(false, string.format("Couldn't enumerate shares: %s", shares))
|
||||
end
|
||||
-- Get the list of shares
|
||||
status, shares, extra = smb.share_get_list(host)
|
||||
if(status == false) then
|
||||
return stdnse.format_output(false, string.format("Couldn't enumerate shares: %s", shares))
|
||||
end
|
||||
|
||||
-- Find out who the current user is
|
||||
local result, username, domain = smb.get_account(host)
|
||||
if(result == false) then
|
||||
username = "<unknown>"
|
||||
domain = ""
|
||||
end
|
||||
-- Find out who the current user is
|
||||
local result, username, domain = smb.get_account(host)
|
||||
if(result == false) then
|
||||
username = "<unknown>"
|
||||
domain = ""
|
||||
end
|
||||
|
||||
if(extra ~= nil and extra ~= '') then
|
||||
table.insert(response, extra)
|
||||
end
|
||||
if(extra ~= nil and extra ~= '') then
|
||||
table.insert(response, extra)
|
||||
end
|
||||
|
||||
for i = 1, #shares, 1 do
|
||||
local share = shares[i]
|
||||
local share_output = {}
|
||||
share_output['name'] = share['name']
|
||||
for i = 1, #shares, 1 do
|
||||
local share = shares[i]
|
||||
local share_output = {}
|
||||
share_output['name'] = share['name']
|
||||
|
||||
if(type(share['details']) ~= 'table') then
|
||||
share_output['warning'] = string.format("Couldn't get details for share: %s", share['details'])
|
||||
else
|
||||
local details = share['details']
|
||||
if(type(share['details']) ~= 'table') then
|
||||
share_output['warning'] = string.format("Couldn't get details for share: %s", share['details'])
|
||||
else
|
||||
local details = share['details']
|
||||
|
||||
table.insert(share_output, string.format("Type: %s", details['sharetype']))
|
||||
table.insert(share_output, string.format("Comment: %s", details['comment']))
|
||||
table.insert(share_output, string.format("Users: %s, Max: %s", details['current_users'], details['max_users']))
|
||||
table.insert(share_output, string.format("Path: %s", details['path']))
|
||||
end
|
||||
table.insert(share_output, string.format("Type: %s", details['sharetype']))
|
||||
table.insert(share_output, string.format("Comment: %s", details['comment']))
|
||||
table.insert(share_output, string.format("Users: %s, Max: %s", details['current_users'], details['max_users']))
|
||||
table.insert(share_output, string.format("Path: %s", details['path']))
|
||||
end
|
||||
|
||||
|
||||
-- A share of 'NT_STATUS_OBJECT_NAME_NOT_FOUND' indicates this isn't a fileshare
|
||||
if(share['user_can_write'] == "NT_STATUS_OBJECT_NAME_NOT_FOUND") then
|
||||
-- Print details for a non-file share
|
||||
if(share['anonymous_can_read']) then
|
||||
table.insert(share_output, "Anonymous access: READ <not a file share>")
|
||||
else
|
||||
table.insert(share_output, "Anonymous access: <none> <not a file share>")
|
||||
end
|
||||
-- A share of 'NT_STATUS_OBJECT_NAME_NOT_FOUND' indicates this isn't a fileshare
|
||||
if(share['user_can_write'] == "NT_STATUS_OBJECT_NAME_NOT_FOUND") then
|
||||
-- Print details for a non-file share
|
||||
if(share['anonymous_can_read']) then
|
||||
table.insert(share_output, "Anonymous access: READ <not a file share>")
|
||||
else
|
||||
table.insert(share_output, "Anonymous access: <none> <not a file share>")
|
||||
end
|
||||
|
||||
-- Don't bother printing this if we're already anonymous
|
||||
if(username ~= '') then
|
||||
if(share['user_can_read']) then
|
||||
table.insert(share_output, "Current user ('" .. username .. "') access: READ <not a file share>")
|
||||
else
|
||||
table.insert(share_output, "Current user ('" .. username .. "') access: <none> <not a file share>")
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Print details for a file share
|
||||
if(share['anonymous_can_read'] and share['anonymous_can_write']) then
|
||||
table.insert(share_output, "Anonymous access: READ/WRITE")
|
||||
elseif(share['anonymous_can_read'] and not(share['anonymous_can_write'])) then
|
||||
table.insert(share_output, "Anonymous access: READ")
|
||||
elseif(not(share['anonymous_can_read']) and share['anonymous_can_write']) then
|
||||
table.insert(share_output, "Anonymous access: WRITE")
|
||||
else
|
||||
table.insert(share_output, "Anonymous access: <none>")
|
||||
end
|
||||
-- Don't bother printing this if we're already anonymous
|
||||
if(username ~= '') then
|
||||
if(share['user_can_read']) then
|
||||
table.insert(share_output, "Current user ('" .. username .. "') access: READ <not a file share>")
|
||||
else
|
||||
table.insert(share_output, "Current user ('" .. username .. "') access: <none> <not a file share>")
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Print details for a file share
|
||||
if(share['anonymous_can_read'] and share['anonymous_can_write']) then
|
||||
table.insert(share_output, "Anonymous access: READ/WRITE")
|
||||
elseif(share['anonymous_can_read'] and not(share['anonymous_can_write'])) then
|
||||
table.insert(share_output, "Anonymous access: READ")
|
||||
elseif(not(share['anonymous_can_read']) and share['anonymous_can_write']) then
|
||||
table.insert(share_output, "Anonymous access: WRITE")
|
||||
else
|
||||
table.insert(share_output, "Anonymous access: <none>")
|
||||
end
|
||||
|
||||
if(username ~= '') then
|
||||
if(share['user_can_read'] and share['user_can_write']) then
|
||||
table.insert(share_output, "Current user ('" .. username .. "') access: READ/WRITE")
|
||||
elseif(share['user_can_read'] and not(share['user_can_write'])) then
|
||||
table.insert(share_output, "Current user ('" .. username .. "') access: READ")
|
||||
elseif(not(share['user_can_read']) and share['user_can_write']) then
|
||||
table.insert(share_output, "Current user ('" .. username .. "') access: WRITE")
|
||||
else
|
||||
table.insert(share_output, "Current user ('" .. username .. "') access: <none>")
|
||||
end
|
||||
end
|
||||
end
|
||||
if(username ~= '') then
|
||||
if(share['user_can_read'] and share['user_can_write']) then
|
||||
table.insert(share_output, "Current user ('" .. username .. "') access: READ/WRITE")
|
||||
elseif(share['user_can_read'] and not(share['user_can_write'])) then
|
||||
table.insert(share_output, "Current user ('" .. username .. "') access: READ")
|
||||
elseif(not(share['user_can_read']) and share['user_can_write']) then
|
||||
table.insert(share_output, "Current user ('" .. username .. "') access: WRITE")
|
||||
else
|
||||
table.insert(share_output, "Current user ('" .. username .. "') access: <none>")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(response, share_output)
|
||||
end
|
||||
table.insert(response, share_output)
|
||||
end
|
||||
|
||||
return stdnse.format_output(true, response)
|
||||
return stdnse.format_output(true, response)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user