Nmap Development mailing list archives

Re: [NSE] smb-ls fixes and improvements


From: Pierre LALET <pierre () droids-corp org>
Date: Mon, 9 Mar 2015 20:00:12 +0100

Hi Henri,

Thanks for the review!

On Mon, Mar 09, 2015 at 07:09:49PM +0100, Henri Doreau wrote:
* improvement: Would it make sense to identify the service port on
which share was found in the host registry? So that scripts can
efficiently interact with hosts running multiple SMB instances?

It could, but port discovery is hidden deep in the smb module (it
seems that start() discovers the ports by itself, giving priority to
445 if available).

* style: Limit depth of nested blocks. At the start of the action()
function of smb-ls, you can flatten the structure by doing:
"""
 -- give priority to specified shares if specified
  if arg_shares ~= nil then
     arg_shares = stdnse.strsplit(",", arg_shares)
  elseif arg_share ~= nil then
     arg_shares = {arg_share}
  else
     arg_shares = host.registry['smb_shares']
  end
"""

Agreed.

* It was already in the script, but this lua idiom either needs a
rewrite or a comment! :)
"""
  local lstab = tab.new((arg_checksum and 4 or 3))
"""

Would this be helpful?

"""
           -- three columns per row, plus one for checksum if requested
           local lstab = tab.new((arg_checksum and 4 or 3))
"""

As for the behavior regarding recursion I would be ok with the default
value from zero to one, unless others have different opinion on the
matter. Anyone?

No recursion seems to me a better default value than infinite
recursion for such a script, particularly with the share discovery
feature.

Thanks agains,

-- 
Pierre
_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: