1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 21:21:31 +00:00

o [NSE] Improved error handling and reporting and re-designed communication

class in RPC library with patch from Djalal Harouni. [Patrik]
This commit is contained in:
patrik
2010-04-22 20:25:38 +00:00
parent c0456bb22e
commit 71ca5cceba
7 changed files with 854 additions and 591 deletions

View File

@@ -1,5 +1,8 @@
# Nmap Changelog ($Id$); -*-text-*- # Nmap Changelog ($Id$); -*-text-*-
o [NSE] Improved error handling and reporting and re-designed communication
class in RPC library with patch from Djalal Harouni. [Patrik]
o Upgraded the included libpcap to version 1.1.1. [David] o Upgraded the included libpcap to version 1.1.1. [David]
o [NSE] Add some special use IPv4 addresses to isPrivate which are described in o [NSE] Add some special use IPv4 addresses to isPrivate which are described in

File diff suppressed because it is too large Load Diff

View File

@@ -42,7 +42,7 @@ action = function(host, port)
status, mounts = rpc.Helper.ShowMounts( host, port ) status, mounts = rpc.Helper.ShowMounts( host, port )
if ( not(status) or mounts == nil ) then if ( not(status) or mounts == nil ) then
return " \n\n Failed to list mount points" return stdnse.format_output(false, mounts)
end end
for _, mount in ipairs( mounts ) do for _, mount in ipairs( mounts ) do
@@ -54,7 +54,7 @@ action = function(host, port)
if ( status ) then if ( status ) then
table.insert(item, ("uid: %d; gid: %d; mode: %s (%d)"):format(attribs.uid, attribs.gid, rpc.Util.ToAclText( attribs.mode ), rpc.Util.ToAclMode( attribs.mode )) ) table.insert(item, ("uid: %d; gid: %d; mode: %s (%d)"):format(attribs.uid, attribs.gid, rpc.Util.ToAclText( attribs.mode ), rpc.Util.ToAclMode( attribs.mode )) )
else else
table.insert(item, "ERROR: Mount failed") table.insert(item, string.format("ERROR: %s", attribs))
end end
table.insert(result, item) table.insert(result, item)

View File

@@ -47,7 +47,7 @@ action = function(host, port)
status, mounts = rpc.Helper.ShowMounts( host, port ) status, mounts = rpc.Helper.ShowMounts( host, port )
if ( not(status) ) then if ( not(status) ) then
return " \n\n Failed to list mount points" return stdnse.format_output(false, mounts)
end end
for _, v in ipairs( mounts ) do for _, v in ipairs( mounts ) do
@@ -72,7 +72,7 @@ action = function(host, port)
table.sort(files) table.sort(files)
if hasmore then if hasmore then
files.name = v.name .. string.format(" (Output limited to %d files)", max_files ) files.name = v.name .. string.format(" (Output limited to %d files, see nfs-dirlist.maxfiles)", max_files )
else else
files.name = v.name files.name = v.name
end end
@@ -80,7 +80,7 @@ action = function(host, port)
table.insert( result, files ) table.insert( result, files )
else else
files.name = v.name files.name = v.name
table.insert(files, "ERROR: Mount failed") table.insert(files, string.format("ERROR: %s",dirlist))
table.insert( result, files ) table.insert( result, files )
end end

View File

@@ -39,7 +39,7 @@ action = function(host, port)
status, mounts = rpc.Helper.ShowMounts( host, port ) status, mounts = rpc.Helper.ShowMounts( host, port )
if not status or mounts == nil then if not status or mounts == nil then
return " \n\n Failed to list mount points" return stdnse.format_output(false, mounts)
end end
for _, v in ipairs( mounts ) do for _, v in ipairs( mounts ) do

View File

@@ -40,26 +40,22 @@ action = function(host, port)
local status, mounts = rpc.Helper.ShowMounts( host, port ) local status, mounts = rpc.Helper.ShowMounts( host, port )
if ( not(status) ) then if ( not(status) ) then
return " \n\n Failed to list mount points" return stdnse.format_output(false, mounts)
end end
for _, v in ipairs( mounts ) do for _, v in ipairs( mounts ) do
local entry = {} local entry = {}
local status, stats = rpc.Helper.ExportStats(host, port, v.name) local status, stats = rpc.Helper.ExportStats(host, port, v.name)
if ( not(status) and stats:match("Version %d not supported") ) then
return " \n\n " .. stats
end
entry.name = v.name entry.name = v.name
if status and stats then if (not(status)) then
table.insert(entry, string.format("ERROR: %s", stats))
else
table.insert( entry, string.format("Block size: %d", stats.block_size) ) table.insert( entry, string.format("Block size: %d", stats.block_size) )
table.insert( entry, string.format("Total blocks: %d", stats.total_blocks) ) table.insert( entry, string.format("Total blocks: %d", stats.total_blocks) )
table.insert( entry, string.format("Free blocks: %d", stats.free_blocks) ) table.insert( entry, string.format("Free blocks: %d", stats.free_blocks) )
table.insert( entry, string.format("Available blocks: %d", stats.available_blocks) ) table.insert( entry, string.format("Available blocks: %d", stats.available_blocks) )
else
table.insert( entry, "ERROR: Mount failed")
end end
table.insert( result, entry ) table.insert( result, entry )
end end

View File

@@ -31,7 +31,7 @@ action = function(host, port)
local status, rpcinfo = rpc.Helper.RpcInfo( host, port ) local status, rpcinfo = rpc.Helper.RpcInfo( host, port )
if ( not(status) ) then if ( not(status) ) then
return return stdnse.format_output(false, rpcinfo)
end end
for progid, v in pairs(rpcinfo) do for progid, v in pairs(rpcinfo) do