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/admin/oracle/tnscmd.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::TNS78def initialize(info = {})9super(update_info(info,10'Name' => 'Oracle TNS Listener Command Issuer',11'Description' => %q{12This module allows for the sending of arbitrary TNS commands in order13to gather information.14Inspired from tnscmd.pl from www.jammed.com/~jwa/hacks/security/tnscmd/tnscmd15},16'Author' => ['MC'],17'License' => MSF_LICENSE,18'DisclosureDate' => '2009-02-01'19))2021register_options(22[23Opt::RPORT(1521),24OptString.new('CMD', [ false, 'Something like ping, version, status, etc..', '(CONNECT_DATA=(COMMAND=VERSION))']),25])26end2728def run2930begin31connect3233command = datastore['CMD']3435pkt = tns_packet(command)3637print_status("Sending '#{command}' to #{rhost}:#{rport}")38sock.put(pkt)39print_status("writing #{pkt.length} bytes.")4041select(nil,nil,nil,0.5)4243print_status("reading")44res = sock.get_once(-1,5) || ''45res = res.tr("[\200-\377]","[\000-\177]")46res = res.tr("[\000-\027\]",".")47res = res.tr("\177",".")48print_status(res)4950disconnect51end52rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout => e53print_error e.message54rescue ::Timeout::Error, ::Errno::EPIPE,Errno::ECONNRESET => e55print_error e.message56end57end585960