1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-17 13:09:02 +00:00

When reporting files mactime use "MODIFICATION TIME" or "ACCESS TIME" or "CHANGE TIME" instead of "DATE".

This commit is contained in:
djalal
2010-08-02 11:20:29 +00:00
parent 010bcf1b78
commit 47e39cefbf

View File

@@ -29,12 +29,12 @@ These access permissions are shown only with NFSv3:
-- 111/tcp open rpcbind -- 111/tcp open rpcbind
-- | nfs-ls: -- | nfs-ls:
-- | Arguments: -- | Arguments:
-- | maxfiles: 10 (file listing output limited) time: mtime -- | maxfiles: 10 (file listing output limited)
-- | -- |
-- | NFS Export: /mnt/nfs/files -- | NFS Export: /mnt/nfs/files
-- | NFS Access: Read Lookup NoModify NoExtend NoDelete NoExecute -- | NFS Access: Read Lookup NoModify NoExtend NoDelete NoExecute
-- | -- |
-- | PERMISSION UID GID SIZE DATE FILENAME -- | PERMISSION UID GID SIZE MODIFICATION TIME FILENAME
-- | drwxr-xr-x 1000 100 4096 2010-06-17 12:28 /mnt/nfs/files -- | drwxr-xr-x 1000 100 4096 2010-06-17 12:28 /mnt/nfs/files
-- | drwxr--r-- 1000 1002 4096 2010-05-14 12:58 sources -- | drwxr--r-- 1000 1002 4096 2010-05-14 12:58 sources
-- | -rw------- 1000 1002 23606 2010-06-17 12:28 notes -- | -rw------- 1000 1002 23606 2010-06-17 12:28 notes
@@ -42,7 +42,7 @@ These access permissions are shown only with NFSv3:
-- | NFS Export: /home/storage/backup -- | NFS Export: /home/storage/backup
-- | NFS Access: Read Lookup Modify Extend Delete NoExecute -- | NFS Access: Read Lookup Modify Extend Delete NoExecute
-- | -- |
-- | PERMISSION UID GID SIZE DATE FILENAME -- | PERMISSION UID GID SIZE MODIFICATION TIME FILENAME
-- | drwxr-xr-x 1000 100 4096 2010-06-11 22:31 /home/storage/backup -- | drwxr-xr-x 1000 100 4096 2010-06-11 22:31 /home/storage/backup
-- | -rw-r--r-- 1000 1002 0 2010-06-10 08:34 filetest -- | -rw-r--r-- 1000 1002 0 2010-06-10 08:34 filetest
-- | drwx------ 1000 100 16384 2010-02-05 17:05 lost+found -- | drwx------ 1000 100 16384 2010-02-05 17:05 lost+found
@@ -56,11 +56,11 @@ These access permissions are shown only with NFSv3:
-- @args nfs-ls.human If set to <code>1</code> or <code>true</code>, -- @args nfs-ls.human If set to <code>1</code> or <code>true</code>,
-- shows file sizes in a human readable format with suffixes like -- shows file sizes in a human readable format with suffixes like
-- <code>KB</code> and <code>MB</code>. -- <code>KB</code> and <code>MB</code>.
-- @args nfs-ls.time Specifies which one of the mac times to use in the -- @args nfs-ls.time Specifies which one of the last mac times to use in
-- files attributes output. Possible values are: -- the files attributes output. Possible values are:
-- * <code>m</code>: modification time (mtime) -- * <code>m</code>: last modification time (mtime)
-- * <code>a</code>: access time (atime) -- * <code>a</code>: last access time (atime)
-- * <code>c</code>: change time (ctime) -- * <code>c</code>: last change time (ctime)
-- The default value is <code>m</code> (mtime). -- The default value is <code>m</code> (mtime).
-- Created 05/28/2010 - v0.1 - combined nfs-dirlist and nfs-acls scripts -- Created 05/28/2010 - v0.1 - combined nfs-dirlist and nfs-acls scripts
@@ -205,15 +205,23 @@ local function nfs_ls(nfs, mount, results, access)
return status, dirs return status, dirs
end end
local function report(table) local function report(nfs, table)
local outtab = tab.new(6) local outtab, time = tab.new(6), ""
if nfs.time == "mtime" then
time = "MODIFICATION TIME"
elseif nfs.time == "atime" then
time = "ACCESS TIME"
elseif nfs.time == "ctime" then
time = "CHANGE TIME"
end
tab.nextrow(outtab) tab.nextrow(outtab)
tab.add(outtab, 1, " PERMISSION") tab.add(outtab, 1, " PERMISSION")
tab.add(outtab, 2, "UID") tab.add(outtab, 2, "UID")
tab.add(outtab, 3, "GID") tab.add(outtab, 3, "GID")
tab.add(outtab, 4, "SIZE") tab.add(outtab, 4, "SIZE")
tab.add(outtab, 5, "DATE") tab.add(outtab, 5, time)
tab.add(outtab, 6, "FILENAME") tab.add(outtab, 6, "FILENAME")
for _,f in pairs(table) do for _,f in pairs(table) do
@@ -227,7 +235,6 @@ end
action = function(host, port) action = function(host, port)
local o, results, mounts, status = {}, {}, {} local o, results, mounts, status = {}, {}, {}
local vbs = nmap.verbosity()
local nfs_info = local nfs_info =
{ {
host = host, host = host,
@@ -236,7 +243,6 @@ action = function(host, port)
maxfiles = tonumber(nmap.registry.args['nfs-ls.maxfiles']) or 10, maxfiles = tonumber(nmap.registry.args['nfs-ls.maxfiles']) or 10,
time = nmap.registry.args['nfs-ls.time'] or "", time = nmap.registry.args['nfs-ls.time'] or "",
human = nmap.registry.args['nfs-ls.human'] or nil, human = nmap.registry.args['nfs-ls.human'] or nil,
--dirs = nmap.registry.args['nfs-ls.dirs'] or nil,
--recurs = tonumber(nmap.registry.args['nfs-ls.recurs']) or 1, --recurs = tonumber(nmap.registry.args['nfs-ls.recurs']) or 1,
} }
@@ -248,14 +254,12 @@ action = function(host, port)
nfs_info.time = "mtime" nfs_info.time = "mtime"
end end
if vbs > 1 then if nfs_info.maxfiles > 0 then
local args, str = {}, "" local args, str = {}, ""
args['name'] = 'Arguments:' args['name'] = 'Arguments:'
if nfs_info.maxfiles > 0 then str = string.format("maxfiles: %d (file listing output limited) ",
str = str .. string.format("maxfiles: %d (file listing output limited) ",
nfs_info.maxfiles) nfs_info.maxfiles)
end table.insert(args, str)
table.insert(args, string.format("%s time: %s", str, nfs_info.time))
table.insert(o, args) table.insert(o, args)
end end
@@ -275,7 +279,7 @@ action = function(host, port)
str = str .. "\n NFS Access: " .. access[1] str = str .. "\n NFS Access: " .. access[1]
end end
table.insert(o, str) table.insert(o, str)
table.insert(o, report(results)) table.insert(o, report(nfs_info, results))
end end
end end