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/db2_version.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::Exploit::Remote::DB27include Msf::Auxiliary::Scanner8include Msf::Auxiliary::Report910def initialize11super(12'Name' => 'DB2 Probe Utility',13'Description' => 'This module queries a DB2 instance information.',14'Author' => ['todb'],15'License' => MSF_LICENSE16)17register_options(18[19OptInt.new('TIMEOUT', [true, 'Timeout for the DB2 probe', 5])20])2122deregister_options('USERNAME' , 'PASSWORD')23end2425def to26return 5 if datastore['TIMEOUT'].to_i.zero?27datastore['TIMEOUT'].to_i28end2930def run_host(ip)31begin3233info = db2_probe(to)34if info[:excsatrd]35inst,plat,ver,pta = info[:instance_name],info[:platform],info[:version],info[:plaintext_auth]36report_info = "Platform: #{plat}, Version: #{ver}, Instance: #{inst}, Plain-Authentication: #{pta ? "OK" : "NO"}"37print_good("#{ip}:#{rport} DB2 - #{report_info}")38report_service(39:host => rhost,40:port => rport,41:name => "db2",42:info => report_info43)44end45disconnect4647rescue ::Rex::ConnectionRefused48vprint_error("#{rhost}:#{rport} : Cannot connect to host")49return :done50rescue ::Rex::ConnectionError51vprint_error("#{rhost}:#{rport} : Unable to attempt probe")52return :done53rescue ::Rex::Proto::DRDA::RespError => e54vprint_error("#{rhost}:#{rport} : Error in connecting to DB2 instance: #{e}")55return :error56end57end58end596061