2009-08-05 21:21:45 +00:00
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2009-08-05 21:21:45 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2010-11-11 22:43:22 +00:00
|
|
|
# http://metasploit.com/framework/
|
2009-08-05 21:21:45 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-08-05 21:21:45 +00:00
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
include Msf::Exploit::Remote::Udp
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-08-05 21:21:45 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
2010-11-24 19:35:38 +00:00
|
|
|
'Name' => 'DB2 Discovery Service Detection',
|
2009-08-05 21:21:45 +00:00
|
|
|
'Version' => '$Revision$',
|
|
|
|
'Description' => 'This module simply queries the DB2 discovery service for information.',
|
|
|
|
'Author' => [ 'MC' ],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-08-05 21:21:45 +00:00
|
|
|
register_options([Opt::RPORT(523),], self.class)
|
|
|
|
|
|
|
|
deregister_options('RHOST')
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-08-05 21:21:45 +00:00
|
|
|
pkt = "DB2GETADDR" + "\x00" + "SQL05000" + "\x00"
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
2010-09-20 08:06:27 +00:00
|
|
|
connect_udp
|
2009-08-05 21:21:45 +00:00
|
|
|
|
|
|
|
udp_sock.put(pkt)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-08-05 21:21:45 +00:00
|
|
|
res = udp_sock.read(1024).split(/\x00/)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-09-20 08:06:27 +00:00
|
|
|
if (res)
|
|
|
|
report_note(
|
|
|
|
:host => ip,
|
|
|
|
:proto => 'udp',
|
|
|
|
:port => datastore['RPORT'],
|
|
|
|
:type => 'SERVICE_INFO',
|
|
|
|
:data => res[2] + "_" + res[1]
|
2009-08-05 21:21:45 +00:00
|
|
|
)
|
2010-09-20 08:06:27 +00:00
|
|
|
report_service(
|
|
|
|
:host => ip,
|
|
|
|
:port => datastore['RPORT'],
|
|
|
|
:proto => 'udp',
|
|
|
|
:name => "ibm-db2",
|
|
|
|
:info => res[2] + "_" + res[1]
|
2010-06-16 16:20:30 +00:00
|
|
|
)
|
2010-09-20 08:06:27 +00:00
|
|
|
print_status("Host #{ip} node name is " + res[2] + " with a product id of " + res[1] )
|
|
|
|
else
|
|
|
|
print_error("Unable to determine version info for #{ip}")
|
|
|
|
end
|
|
|
|
|
|
|
|
disconnect_udp
|
2009-08-05 21:21:45 +00:00
|
|
|
|
|
|
|
rescue ::Rex::ConnectionError
|
2010-04-30 08:40:19 +00:00
|
|
|
rescue ::Errno::EPIPE
|
2009-08-05 21:21:45 +00:00
|
|
|
|
|
|
|
end
|
2010-09-20 08:06:27 +00:00
|
|
|
|
2009-08-05 21:21:45 +00:00
|
|
|
end
|
|
|
|
end
|