Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/scanner/db2/discovery.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Auxiliary::Report7include Msf::Auxiliary::Scanner8include Msf::Exploit::Remote::Udp910def initialize11super(12'Name' => 'DB2 Discovery Service Detection',13'Description' => 'This module simply queries the DB2 discovery service for information.',14'Author' => [ 'MC' ],15'License' => MSF_LICENSE16)1718register_options([Opt::RPORT(523),])19end2021def run_host(ip)2223pkt = "DB2GETADDR" + "\x00" + "SQL05000" + "\x00"2425begin2627connect_udp28udp_sock.put(pkt)29res = udp_sock.read(1024)3031unless res32print_error("Unable to determine version info for #{ip}")33return34end3536res = res.split(/\x00/)3738report_note(39:host => ip,40:proto => 'udp',41:port => datastore['RPORT'],42:type => 'SERVICE_INFO',43:data => "#{res[2]}_#{res[1]}"44)4546report_service(47:host => ip,48:port => datastore['RPORT'],49:proto => 'udp',50:name => "ibm-db2",51:info => "#{res[2]}_#{res[1]}"52)5354print_good("Host #{ip} node name is " + res[2] + " with a product id of " + res[1] )5556rescue ::Rex::ConnectionError57rescue ::Errno::EPIPE58ensure59disconnect_udp60end6162end63end646566