Rapid7 Vulnerability & Exploit Database

Microsoft SQL Server Find and Sample Data

Back to Search

Microsoft SQL Server Find and Sample Data



This script will search through all of the non-default databases on the SQL Server for columns that match the keywords defined in the TSQL KEYWORDS option. If column names are found that match the defined keywords and data is present in the associated tables, the script will select a sample of the records from each of the affected tables. The sample size is determined by the SAMPLE_SIZE option, and results output in a CSV format.


  • Scott Sutherland <scott.sutherland@netspi.com>
  • Robin Wood <robin@digininja.org>
  • humble-desser <humble.desser@gmail.com>
  • Carlos Perez <carlos_perez@darkoperator.com>
  • hdm <x@hdm.io>
  • todb <todb@metasploit.com>


Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use auxiliary/admin/mssql/mssql_findandsampledata
msf auxiliary(mssql_findandsampledata) > show actions
msf auxiliary(mssql_findandsampledata) > set ACTION < action-name >
msf auxiliary(mssql_findandsampledata) > show options
    ...show and set options...
msf auxiliary(mssql_findandsampledata) > run 

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security