Nmap Development mailing list archives

Re: [NSE] smb-os-discovery - Augment version detection of SMB related services


From: Tom Sellers <nmap () fadedcode net>
Date: Wed, 30 Mar 2016 16:30:36 -0500

On 3/30/2016 2:42 PM, David Fifield wrote:
On Wed, Mar 30, 2016 at 10:33:59AM -0700, nmap () fadedcode net wrote:
I've created Github PR 348 ( [1]https://github.com/nmap/nmap/pull/348 ) that
enables smb-os-discovery to augment the version detection of certain SMB
related services.

Here is the text of the PR.  You may want to visit the PR at Github if the
formatting below is unreadable.

The attached changes allow smb-os-discovery.nse to augment nmap's standard
version detection with data that it has discovered. It will only update the
version information for the port that was used by smb-os-discovery.nse.

The change requires that smb.lua be modified to return the port in the response
table that smb.get_os returns. This should be non-disruptive for other scripts.

Wow, looks good, and didn't take much code.

I suppose there isn't a way for smb.lua to report whether a port is
using TCP or UDP? The heuristic of checking for port 445 or 139 seems
fine, though.
https://github.com/nmap/nmap/pull/348/commits/cb3c48e45c46ef7b25e65ad723b7c45e4b28f94f#diff-d27b09af6ff16d6d25e34705e3d51fceR193
(Or maybe it's not a heuristic and the specific port numbers are part of
SMB.)

Thanks for looking at it David. The calls in SMB.lua aren't storing the port
protocol. In each case that I could find it was hard coding the protocol
for a given port [1,2].  I could have called smb.get_port just like smb.get_os
does but I wanted to make sure that I was used the exact port that was
used to query the target for OS information and smb.get_port doesn't return
the proto either.


1. https://github.com/nmap/nmap/blob/master/nselib/smb.lua#L219
2. https://github.com/nmap/nmap/blob/master/nselib/smb.lua#L308


Tom


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


Current thread: