mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Improved debugging/output for NFS scripts
This commit is contained in:
@@ -395,13 +395,13 @@ hostaction = function(host)
|
|||||||
mnt_comm = rpc.Comm:new('mountd', host.registry.nfs.mountver)
|
mnt_comm = rpc.Comm:new('mountd', host.registry.nfs.mountver)
|
||||||
status, result = mnt_comm:Connect(ahost, host.registry.nfs.mountport)
|
status, result = mnt_comm:Connect(ahost, host.registry.nfs.mountport)
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
stdnse.debug4("ShowMounts: %s", result)
|
stdnse.debug1("ShowMounts: %s", result)
|
||||||
return false, result
|
return false, result
|
||||||
end
|
end
|
||||||
status, mounts = mnt:Export(mnt_comm)
|
status, mounts = mnt:Export(mnt_comm)
|
||||||
mnt_comm:Disconnect()
|
mnt_comm:Disconnect()
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
stdnse.debug4("ShowMounts: %s", mounts)
|
stdnse.debug1("ShowMounts: %s", mounts)
|
||||||
end
|
end
|
||||||
return status, mounts
|
return status, mounts
|
||||||
end,
|
end,
|
||||||
@@ -415,14 +415,14 @@ hostaction = function(host)
|
|||||||
|
|
||||||
status, err = mnt_comm:Connect(host, host.registry.nfs.mountport)
|
status, err = mnt_comm:Connect(host, host.registry.nfs.mountport)
|
||||||
if not status then
|
if not status then
|
||||||
stdnse.debug4("MountPath: %s", err)
|
stdnse.debug1("MountPath: %s", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
end
|
end
|
||||||
|
|
||||||
status, fhandle = mnt:Mount(mnt_comm, path)
|
status, fhandle = mnt:Mount(mnt_comm, path)
|
||||||
if not status then
|
if not status then
|
||||||
mnt_comm:Disconnect()
|
mnt_comm:Disconnect()
|
||||||
stdnse.debug4("MountPath: %s", fhandle)
|
stdnse.debug1("MountPath: %s", fhandle)
|
||||||
return nil, fhandle
|
return nil, fhandle
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -435,7 +435,7 @@ hostaction = function(host)
|
|||||||
nfs_comm = rpc.Comm:new('nfs', host.registry.nfs.nfsver)
|
nfs_comm = rpc.Comm:new('nfs', host.registry.nfs.nfsver)
|
||||||
status, err = nfs_comm:Connect(host, host.registry.nfs.nfsport)
|
status, err = nfs_comm:Connect(host, host.registry.nfs.nfsport)
|
||||||
if not status then
|
if not status then
|
||||||
stdnse.debug4("NfsOpen: %s", err)
|
stdnse.debug1("NfsOpen: %s", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,10 @@ action = function(host, port)
|
|||||||
return stdnse.format_output(false, mounts)
|
return stdnse.format_output(false, mounts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if #mounts < 1 then
|
||||||
|
return "No NFS mounts available"
|
||||||
|
end
|
||||||
|
|
||||||
for _, v in ipairs( mounts ) do
|
for _, v in ipairs( mounts ) do
|
||||||
local entry = v.name .. " " .. stdnse.strjoin(" ", v)
|
local entry = v.name .. " " .. stdnse.strjoin(" ", v)
|
||||||
table.insert( result, entry )
|
table.insert( result, entry )
|
||||||
|
|||||||
@@ -259,6 +259,11 @@ mainaction = function(host)
|
|||||||
return stdnse.format_output(false, mounts)
|
return stdnse.format_output(false, mounts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if #mounts < 1 then
|
||||||
|
stdnse.debug1("No NFS mounts available")
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
for _, v in ipairs(mounts) do
|
for _, v in ipairs(mounts) do
|
||||||
local err
|
local err
|
||||||
status, err = nfs_filesystem_info(nfs_info, v.name, fs_info)
|
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)
|
mnt_comm = rpc.Comm:new('mountd', host.registry.nfs.mountver)
|
||||||
status, result = mnt_comm:Connect(ahost, host.registry.nfs.mountport)
|
status, result = mnt_comm:Connect(ahost, host.registry.nfs.mountport)
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
stdnse.debug4("ShowMounts: %s", result)
|
stdnse.debug1("ShowMounts: %s", result)
|
||||||
return false, result
|
return false, result
|
||||||
end
|
end
|
||||||
status, mounts = mnt:Export(mnt_comm)
|
status, mounts = mnt:Export(mnt_comm)
|
||||||
mnt_comm:Disconnect()
|
mnt_comm:Disconnect()
|
||||||
if ( not(status) ) then
|
if ( not(status) ) then
|
||||||
stdnse.debug4("ShowMounts: %s", mounts)
|
stdnse.debug1("ShowMounts: %s", mounts)
|
||||||
end
|
end
|
||||||
return status, mounts
|
return status, mounts
|
||||||
end,
|
end,
|
||||||
@@ -299,14 +304,14 @@ hostaction = function(host)
|
|||||||
|
|
||||||
status, err = mnt_comm:Connect(host, host.registry.nfs.mountport)
|
status, err = mnt_comm:Connect(host, host.registry.nfs.mountport)
|
||||||
if not status then
|
if not status then
|
||||||
stdnse.debug4("MountPath: %s", err)
|
stdnse.debug1("MountPath: %s", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
end
|
end
|
||||||
|
|
||||||
status, fhandle = mnt:Mount(mnt_comm, path)
|
status, fhandle = mnt:Mount(mnt_comm, path)
|
||||||
if not status then
|
if not status then
|
||||||
mnt_comm:Disconnect()
|
mnt_comm:Disconnect()
|
||||||
stdnse.debug4("MountPath: %s", fhandle)
|
stdnse.debug1("MountPath: %s", fhandle)
|
||||||
return nil, fhandle
|
return nil, fhandle
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -319,7 +324,7 @@ hostaction = function(host)
|
|||||||
nfs_comm = rpc.Comm:new('nfs', host.registry.nfs.nfsver)
|
nfs_comm = rpc.Comm:new('nfs', host.registry.nfs.nfsver)
|
||||||
status, err = nfs_comm:Connect(host, host.registry.nfs.nfsport)
|
status, err = nfs_comm:Connect(host, host.registry.nfs.nfsport)
|
||||||
if not status then
|
if not status then
|
||||||
stdnse.debug4("NfsOpen: %s", err)
|
stdnse.debug1("NfsOpen: %s", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user