2010-01-25 15:58:24 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2010-01-25 15:58:24 +00:00
|
|
|
# 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/
|
2010-01-25 15:58:24 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2010-01-28 23:08:39 +00:00
|
|
|
|
2010-01-25 15:58:24 +00:00
|
|
|
include Msf::Exploit::Remote::DB2
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
include Msf::Auxiliary::Report
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-01-25 15:58:24 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'DB2 Probe Utility',
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'Description' => 'This module queries a DB2 instance information.',
|
|
|
|
'Author' => ['todb'],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2010-01-25 16:25:29 +00:00
|
|
|
register_options(
|
|
|
|
[
|
2010-06-17 15:16:39 +00:00
|
|
|
OptInt.new('TIMEOUT', [true, 'Timeout for the DB2 probe', 5])
|
2010-01-25 16:25:29 +00:00
|
|
|
], self.class)
|
2010-01-25 15:58:24 +00:00
|
|
|
|
|
|
|
deregister_options('USERNAME' , 'PASSWORD')
|
|
|
|
end
|
|
|
|
|
2010-06-17 15:16:39 +00:00
|
|
|
def to
|
|
|
|
return 5 if datastore['TIMEOUT'].to_i.zero?
|
|
|
|
datastore['TIMEOUT'].to_i
|
|
|
|
end
|
2010-01-25 15:58:24 +00:00
|
|
|
|
|
|
|
def run_host(ip)
|
|
|
|
begin
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-06-17 15:16:39 +00:00
|
|
|
info = db2_probe(to)
|
2010-01-25 15:58:24 +00:00
|
|
|
if info[:excsatrd]
|
2010-01-25 16:25:29 +00:00
|
|
|
inst,plat,ver,pta = info[:instance_name],info[:platform],info[:version],info[:plaintext_auth]
|
2010-02-08 18:54:50 +00:00
|
|
|
report_info = "Platform: #{plat}, Version: #{ver}, Instance: #{inst}, Plain-Authentication: #{pta ? "OK" : "NO"}"
|
2010-02-08 20:12:35 +00:00
|
|
|
print_status("#{ip}:#{rport} DB2 - #{report_info}")
|
2010-02-08 18:54:50 +00:00
|
|
|
report_service(
|
2010-04-30 08:40:19 +00:00
|
|
|
:host => rhost,
|
2010-01-28 23:08:39 +00:00
|
|
|
:port => rport,
|
|
|
|
:name => "db2",
|
2010-02-08 18:54:50 +00:00
|
|
|
:info => report_info
|
|
|
|
)
|
2010-01-25 15:58:24 +00:00
|
|
|
end
|
|
|
|
disconnect
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-06-17 15:16:39 +00:00
|
|
|
rescue ::Rex::ConnectionRefused
|
2011-07-15 15:33:35 +00:00
|
|
|
vprint_error("#{rhost}:#{rport} : Cannot connect to host")
|
2010-06-17 15:16:39 +00:00
|
|
|
return :done
|
2010-01-25 15:58:24 +00:00
|
|
|
rescue ::Rex::ConnectionError
|
2011-07-15 15:33:35 +00:00
|
|
|
vprint_error("#{rhost}:#{rport} : Unable to attempt probe")
|
2010-01-25 15:58:24 +00:00
|
|
|
return :done
|
|
|
|
rescue ::Rex::Proto::DRDA::RespError => e
|
2011-07-15 15:33:35 +00:00
|
|
|
vprint_error("#{rhost}:#{rport} : Error in connecting to DB2 instance: #{e}")
|
2010-01-25 15:58:24 +00:00
|
|
|
return :error
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|