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