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/oracle/tnslsnr_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::Auxiliary::Report7include Msf::Auxiliary::Scanner8include Msf::Exploit::Remote::TNS910def initialize(info = {})11super(update_info(info,12'Name' => 'Oracle TNS Listener Service Version Query',13'Description' => %q{14This module simply queries the tnslsnr service for the Oracle build.15},16'Author' => ['CG'],17'License' => MSF_LICENSE,18'DisclosureDate' => '2009-01-07'))1920register_options(21[22Opt::RPORT(1521)23])24end2526def run_host(ip)27begin28connect2930pkt = tns_packet("(CONNECT_DATA=(COMMAND=VERSION))")3132sock.put(pkt)3334select(nil,nil,nil,0.5)3536data = sock.get_once3738if ( data && data =~ /\\*.TNSLSNR for (.*)/ )39ora_version = data.match(/\\*.TNSLSNR for (.*)/)[1]40report_service(41:host => ip,42:port => datastore['RPORT'],43:name => "oracle",44:info => ora_version45)46print_good("#{ip}:#{datastore['RPORT']} Oracle - Version: " + ora_version)47elsif ( data && data =~ /\(ERR=(\d+)\)/ )48case $1.to_i49when 118950print_error( "#{ip}:#{datastore['RPORT']} Oracle - Version: Unknown - Error code #{$1} - The listener could not authenticate the user")51else52print_error( "#{ip}:#{datastore['RPORT']} Oracle - Version: Unknown - Error code #{$1}")53end54else55print_error( "#{ip}:#{datastore['RPORT']} Oracle - Version: Unknown")56end57disconnect58rescue ::Rex::ConnectionError59rescue ::Errno::EPIPE60end61end62end636465