1
0
mirror of https://github.com/nmap/nmap.git synced 2026-02-11 07:56:35 +00:00

Small code cleaning.

This commit is contained in:
djalal
2010-10-31 21:37:06 +00:00
parent b18df4d50a
commit 3744d4c0ac
2 changed files with 17 additions and 17 deletions

View File

@@ -258,11 +258,11 @@ action = function(host, port)
end
if nfs_info.maxfiles > 0 then
local args, str = {}, ""
local args = {}
args['name'] = 'Arguments:'
str = string.format("maxfiles: %d (file listing output limited) ",
nfs_info.maxfiles)
table.insert(args, str)
table.insert(args,
string.format("maxfiles: %d (file listing output limited)\n",
nfs_info.maxfiles))
table.insert(o, args)
end
@@ -272,16 +272,17 @@ action = function(host, port)
end
for _, v in ipairs(mounts) do
local results, access, str, err = {}, {}, ""
local results, access, err = {}, {}
status, err = nfs_ls(nfs_info, v.name, results, access)
if not status then
table.insert(o, string.format("NFS Export %s", v.name))
table.insert(o, string.format("ERROR: %s", err))
else
str = "\n NFS Export: " .. results[1].filename
table.insert(o,
string.format("NFS Export: %s", results[1].filename))
if #access ~= 0 then
str = str .. "\n NFS Access: " .. access[1]
table.insert(o, string.format("NFS Access: %s", access[1]))
end
table.insert(o, str)
table.insert(o, report(nfs_info, results))
end
end

View File

@@ -90,7 +90,7 @@ local function report(nfs, tables)
tab_avail, tab_use, tab_bs)
for _, t in ipairs(tables) do
tab.nextrow(outtab)
tab.addrow(outtab, (" %s"):format(t.filesystem), t.size,
tab.addrow(outtab, " "..t.filesystem, t.size,
t.used, t.available, t.use, t.bsize)
end
elseif nfs.version == 3 then
@@ -100,9 +100,8 @@ local function report(nfs, tables)
tab_avail, tab_use, tab_maxfs, tab_linkmax)
for _, t in ipairs(tables) do
tab.nextrow(outtab)
tab.addrow(outtab, (" %s"):format(t.filesystem), t.size,
t.used, t.available, t.use, t.maxfilesize,
t.linkmax)
tab.addrow(outtab, " "..t.filesystem, t.size, t.used,
t.available, t.use, t.maxfilesize, t.linkmax)
end
end
@@ -183,7 +182,7 @@ local function nfs_filesystem_info(nfs, mount, filesystem)
end
action = function(host, port)
local o, fs_info, mounts, status = {}, {}, {}, {}
local fs_info, mounts, status = {}, {}, {}
local nfs_info =
{
host = host,
@@ -200,10 +199,10 @@ action = function(host, port)
local err
status, err = nfs_filesystem_info(nfs_info, v.name, fs_info)
if (not(status)) then
return stdnse.format_output(false, err)
return stdnse.format_output(false,
string.format("%s: %s", v.name, err))
end
end
table.insert(o, report(nfs_info, fs_info))
return stdnse.format_output(true, o)
return stdnse.format_output(true, report(nfs_info, fs_info))
end