2010-04-30 08:40:19 +00:00
|
|
|
##
|
2009-04-30 15:51:06 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2009-04-30 15:51:06 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
include Msf::Exploit::Remote::TNS
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2010-11-24 19:43:49 +00:00
|
|
|
'Name' => 'Oracle TNS Listener Service Version Query',
|
2009-04-30 15:51:06 +00:00
|
|
|
'Description' => %q{
|
|
|
|
This module simply queries the tnslsnr service for the Oracle build.
|
|
|
|
},
|
|
|
|
'Author' => ['CG'],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'DisclosureDate' => 'Jan 7 2009'))
|
|
|
|
|
2010-09-20 08:06:27 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(1521)
|
|
|
|
], self.class)
|
2009-04-30 15:51:06 +00:00
|
|
|
|
2010-09-20 08:06:27 +00:00
|
|
|
deregister_options('RHOST')
|
2009-04-30 15:51:06 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
|
|
|
begin
|
|
|
|
connect
|
|
|
|
|
|
|
|
pkt = tns_packet("(CONNECT_DATA=(COMMAND=VERSION))")
|
|
|
|
|
|
|
|
sock.put(pkt)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-06-22 18:58:38 +00:00
|
|
|
select(nil,nil,nil,0.5)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-04-30 15:51:06 +00:00
|
|
|
data = sock.get_once
|
|
|
|
|
|
|
|
if ( data and data =~ /\\*.TNSLSNR for (.*)/ )
|
2010-02-11 18:29:24 +00:00
|
|
|
ora_version = data.match(/\\*.TNSLSNR for (.*)/)[1]
|
2010-02-11 17:57:33 +00:00
|
|
|
report_service(
|
2009-04-30 15:51:06 +00:00
|
|
|
:host => ip,
|
|
|
|
:port => datastore['RPORT'],
|
2010-02-11 17:57:33 +00:00
|
|
|
:name => "oracle",
|
2010-02-11 18:29:24 +00:00
|
|
|
:info => ora_version
|
2009-04-30 15:51:06 +00:00
|
|
|
)
|
2010-02-11 18:29:24 +00:00
|
|
|
print_good("#{ip}:#{datastore['RPORT']} Oracle - Version: " + ora_version)
|
2009-04-30 15:51:06 +00:00
|
|
|
else
|
2010-06-11 19:01:17 +00:00
|
|
|
print_error( "#{ip}:#{datastore['RPORT']} Oracle - Version: Unknown")
|
2009-04-30 15:51:06 +00:00
|
|
|
end
|
|
|
|
disconnect
|
|
|
|
rescue ::Rex::ConnectionError
|
|
|
|
rescue ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|