mirror of
https://github.com/nmap/nmap.git
synced 2026-05-13 08:46:45 +00:00
Improved debugging/output for NFS scripts
This commit is contained in:
parent
16504696a5
commit
0cfdf2a372
3 changed files with 19 additions and 10 deletions
|
|
@ -395,13 +395,13 @@ hostaction = function(host)
|
|||
mnt_comm = rpc.Comm:new('mountd', host.registry.nfs.mountver)
|
||||
status, result = mnt_comm:Connect(ahost, host.registry.nfs.mountport)
|
||||
if ( not(status) ) then
|
||||
stdnse.debug4("ShowMounts: %s", result)
|
||||
stdnse.debug1("ShowMounts: %s", result)
|
||||
return false, result
|
||||
end
|
||||
status, mounts = mnt:Export(mnt_comm)
|
||||
mnt_comm:Disconnect()
|
||||
if ( not(status) ) then
|
||||
stdnse.debug4("ShowMounts: %s", mounts)
|
||||
stdnse.debug1("ShowMounts: %s", mounts)
|
||||
end
|
||||
return status, mounts
|
||||
end,
|
||||
|
|
@ -415,14 +415,14 @@ hostaction = function(host)
|
|||
|
||||
status, err = mnt_comm:Connect(host, host.registry.nfs.mountport)
|
||||
if not status then
|
||||
stdnse.debug4("MountPath: %s", err)
|
||||
stdnse.debug1("MountPath: %s", err)
|
||||
return nil, err
|
||||
end
|
||||
|
||||
status, fhandle = mnt:Mount(mnt_comm, path)
|
||||
if not status then
|
||||
mnt_comm:Disconnect()
|
||||
stdnse.debug4("MountPath: %s", fhandle)
|
||||
stdnse.debug1("MountPath: %s", fhandle)
|
||||
return nil, fhandle
|
||||
end
|
||||
|
||||
|
|
@ -435,7 +435,7 @@ hostaction = function(host)
|
|||
nfs_comm = rpc.Comm:new('nfs', host.registry.nfs.nfsver)
|
||||
status, err = nfs_comm:Connect(host, host.registry.nfs.nfsport)
|
||||
if not status then
|
||||
stdnse.debug4("NfsOpen: %s", err)
|
||||
stdnse.debug1("NfsOpen: %s", err)
|
||||
return nil, err
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -83,6 +83,10 @@ action = function(host, port)
|
|||
return stdnse.format_output(false, mounts)
|
||||
end
|
||||
|
||||
if #mounts < 1 then
|
||||
return "No NFS mounts available"
|
||||
end
|
||||
|
||||
for _, v in ipairs( mounts ) do
|
||||
local entry = v.name .. " " .. stdnse.strjoin(" ", v)
|
||||
table.insert( result, entry )
|
||||
|
|
|
|||
|
|
@ -259,6 +259,11 @@ mainaction = function(host)
|
|||
return stdnse.format_output(false, mounts)
|
||||
end
|
||||
|
||||
if #mounts < 1 then
|
||||
stdnse.debug1("No NFS mounts available")
|
||||
return nil
|
||||
end
|
||||
|
||||
for _, v in ipairs(mounts) do
|
||||
local err
|
||||
status, err = nfs_filesystem_info(nfs_info, v.name, fs_info)
|
||||
|
|
@ -279,13 +284,13 @@ hostaction = function(host)
|
|||
mnt_comm = rpc.Comm:new('mountd', host.registry.nfs.mountver)
|
||||
status, result = mnt_comm:Connect(ahost, host.registry.nfs.mountport)
|
||||
if ( not(status) ) then
|
||||
stdnse.debug4("ShowMounts: %s", result)
|
||||
stdnse.debug1("ShowMounts: %s", result)
|
||||
return false, result
|
||||
end
|
||||
status, mounts = mnt:Export(mnt_comm)
|
||||
mnt_comm:Disconnect()
|
||||
if ( not(status) ) then
|
||||
stdnse.debug4("ShowMounts: %s", mounts)
|
||||
stdnse.debug1("ShowMounts: %s", mounts)
|
||||
end
|
||||
return status, mounts
|
||||
end,
|
||||
|
|
@ -299,14 +304,14 @@ hostaction = function(host)
|
|||
|
||||
status, err = mnt_comm:Connect(host, host.registry.nfs.mountport)
|
||||
if not status then
|
||||
stdnse.debug4("MountPath: %s", err)
|
||||
stdnse.debug1("MountPath: %s", err)
|
||||
return nil, err
|
||||
end
|
||||
|
||||
status, fhandle = mnt:Mount(mnt_comm, path)
|
||||
if not status then
|
||||
mnt_comm:Disconnect()
|
||||
stdnse.debug4("MountPath: %s", fhandle)
|
||||
stdnse.debug1("MountPath: %s", fhandle)
|
||||
return nil, fhandle
|
||||
end
|
||||
|
||||
|
|
@ -319,7 +324,7 @@ hostaction = function(host)
|
|||
nfs_comm = rpc.Comm:new('nfs', host.registry.nfs.nfsver)
|
||||
status, err = nfs_comm:Connect(host, host.registry.nfs.nfsport)
|
||||
if not status then
|
||||
stdnse.debug4("NfsOpen: %s", err)
|
||||
stdnse.debug1("NfsOpen: %s", err)
|
||||
return nil, err
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue