Attempts to determine the operating system, computer name, domain, workgroup, and current time over the SMB protocol (ports 445 or 139). This is done by starting a session with the anonymous account (or with a proper user account, if one is given; it likely doesn't make a difference); in response to a session starting, the server will send back all this information.
The following fields may be included in the output, depending on the cirumstances (e.g. the workgroup name is mutually exclusive with domain and forest names) and the information available:
- Computer name
- Domain name
- Forest name
- NetBIOS computer name
- NetBIOS domain name
- System time
Some systems, like Samba, will blank out their name (and only send their domain). Other systems (like embedded printers) will simply leave out the information. Other systems will blank out various pieces (some will send back 0 for the current time, for example).
Retrieving the name and operating system of a server is a vital step in targeting an attack against it, and this script makes that retrieval easy. Additionally, if a penetration tester is choosing between multiple targets, the time can help identify servers that are being poorly maintained (for more information/random thoughts on using the time, see http://www.skullsecurity.org/blog/?p=76.
Although the standard
smb* script arguments can be used,
they likely won't change the outcome in any meaningful way. However,
will speed up the script on targets that do not allow guest access.
randomseed, smbbasic, smbport, smbsignSee the documentation for the smb library.
smbdomain, smbhash, smbnoguest, smbpassword, smbtype, smbusernameSee the documentation for the smbauth library.
nmap --script smb-os-discovery.nse -p445 127.0.0.1 sudo nmap -sU -sS --script smb-os-discovery.nse -p U:137,T:139 127.0.0.1
Host script results: | smb-os-discovery: | OS: Windows Server (R) 2008 Standard 6001 Service Pack 1 (Windows Server (R) 2008 Standard 6.0) | OS CPE: cpe:/o:microsoft:windows_2008::sp1 | Computer name: Sql2008 | NetBIOS computer name: SQL2008 | Domain name: lab.test.local | Forest name: test.local | FQDN: Sql2008.lab.test.local | NetBIOS domain name: LAB |_ System time: 2011-04-20T13:34:06-05:00
Author: Ron Bowes
License: Same as Nmap--See http://nmap.org/book/man-legal.html