2010-01-25 15:58:24 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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(
|
|
|
|
[
|
|
|
|
OptBool.new('VERBOSE', [ true, 'Verbose output', false])
|
|
|
|
], self.class)
|
2010-01-25 15:58:24 +00:00
|
|
|
|
|
|
|
deregister_options('USERNAME' , 'PASSWORD')
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def run_host(ip)
|
2010-01-25 16:25:29 +00:00
|
|
|
verbose = datastore['VERBOSE']
|
2010-01-25 15:58:24 +00:00
|
|
|
begin
|
|
|
|
|
|
|
|
info = db2_probe(2)
|
|
|
|
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(
|
|
|
|
: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
|
|
|
|
|
|
|
|
rescue ::Rex::ConnectionError
|
|
|
|
print_error("#{rhost}:#{rport} : Unable to attempt probe") if verbose
|
|
|
|
return :done
|
|
|
|
rescue ::Rex::Proto::DRDA::RespError => e
|
|
|
|
print_error("#{rhost}:#{rport} : Error in connecting to DB2 instance: #{e}") if verbose
|
|
|
|
return :error
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|