Retrieving MS SQL server information

System administrators and penetration testers often need to gather as much host information as possible. MS SQL databases are common in infrastructures based on Microsoft technologies, and Nmap can help us gather information from them.

This recipe shows how to retrieve information from an MS SQL server.

How to do it...

To retrieve information from an MS SQL server by using Nmap, run the following command:

$ nmap -p1433 --script ms-sql-info <target>

MS SQL server information, such as instance name, version number, and port, will be included in the script output:

PORT     STATE SERVICE 
1433/tcp open  ms-sql-s 

Host script results: 
| ms-sql-info: 
|   Windows server name: CLDRN-PC 
|   [192.168.1.102\MSSQLSERVER] 
| Instance ...

Get Nmap 6: Network Exploration and Security Auditing Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.