metasploit-framework/modules/auxiliary/scanner/db2/discovery.rb

68 lines
1.5 KiB
Ruby
Raw Normal View History

##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
2013-08-30 21:28:54 +00:00
include Msf::Auxiliary::Report
include Msf::Auxiliary::Scanner
include Msf::Exploit::Remote::Udp
2013-08-30 21:28:54 +00:00
def initialize
super(
'Name' => 'DB2 Discovery Service Detection',
'Description' => 'This module simply queries the DB2 discovery service for information.',
'Author' => [ 'MC' ],
'License' => MSF_LICENSE
)
2013-08-30 21:28:54 +00:00
register_options([Opt::RPORT(523),], self.class)
2013-08-30 21:28:54 +00:00
deregister_options('RHOST')
end
2013-08-30 21:28:54 +00:00
def run_host(ip)
2013-08-30 21:28:54 +00:00
pkt = "DB2GETADDR" + "\x00" + "SQL05000" + "\x00"
2013-08-30 21:28:54 +00:00
begin
2013-08-30 21:28:54 +00:00
connect_udp
2013-08-30 21:28:54 +00:00
udp_sock.put(pkt)
2013-08-30 21:28:54 +00:00
res = udp_sock.read(1024).split(/\x00/)
2013-08-30 21:28:54 +00:00
if (res)
report_note(
:host => ip,
:proto => 'udp',
:port => datastore['RPORT'],
:type => 'SERVICE_INFO',
:data => res[2] + "_" + res[1]
)
report_service(
:host => ip,
:port => datastore['RPORT'],
:proto => 'udp',
:name => "ibm-db2",
:info => res[2] + "_" + res[1]
)
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
2013-08-30 21:28:54 +00:00
disconnect_udp
2013-08-30 21:28:54 +00:00
rescue ::Rex::ConnectionError
rescue ::Errno::EPIPE
2013-08-30 21:28:54 +00:00
end
2013-08-30 21:28:54 +00:00
end
end