2009-01-12 05:18:05 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2009-01-12 05:18:05 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::MSSQL
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Microsoft SQL Server Generic Query',
|
|
|
|
'Description' => %q{
|
|
|
|
This module will allow for simple SQL statements to be executed against a
|
|
|
|
MSSQL/MSDE instance given the appropiate credentials.
|
|
|
|
},
|
2014-07-11 17:45:23 +00:00
|
|
|
'Author' => [ 'tebo <tebo[at]attackresearch.com>' ],
|
2013-08-30 21:28:54 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'URL', 'http://www.attackresearch.com' ],
|
|
|
|
[ 'URL', 'http://msdn.microsoft.com/en-us/library/cc448435(PROT.10).aspx'],
|
|
|
|
]
|
|
|
|
))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('SQL', [ false, 'The SQL query to execute', 'select @@version']),
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def auxiliary_commands
|
|
|
|
{ "select" => "Run a select query (a LIMIT clause is probably a really good idea)" }
|
|
|
|
end
|
|
|
|
|
|
|
|
def cmd_select(*args)
|
|
|
|
datastore["SQL"] = "select #{args.join(" ")}"
|
|
|
|
run
|
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
mssql_query(datastore['SQL'], true) if mssql_login_datastore
|
|
|
|
disconnect
|
|
|
|
end
|
2009-01-12 05:18:05 +00:00
|
|
|
end
|