2010-04-30 08:40:19 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
2009-07-14 16:48:56 +00:00
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/projects/Framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::TNS
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2009-12-05 14:30:22 +00:00
|
|
|
'Name' => 'TNSLsnr Command Issuer',
|
2009-07-14 16:48:56 +00:00
|
|
|
'Description' => %q{
|
2009-12-05 14:30:22 +00:00
|
|
|
This module allows for the sending of arbitrary TNS commands in order
|
|
|
|
to gather information.
|
2009-07-14 16:48:56 +00:00
|
|
|
Inspired from tnscmd.pl from www.jammed.com/~jwa/hacks/security/tnscmd/tnscmd
|
|
|
|
},
|
|
|
|
'Author' => ['MC'],
|
|
|
|
'License' => MSF_LICENSE,
|
2009-07-23 02:55:51 +00:00
|
|
|
'Version' => '$Revision$',
|
2009-07-14 16:48:56 +00:00
|
|
|
'DisclosureDate' => 'Feb 1 2009'))
|
|
|
|
|
2010-04-30 08:40:19 +00:00
|
|
|
register_options(
|
2009-07-14 16:48:56 +00:00
|
|
|
[
|
|
|
|
Opt::RPORT(1521),
|
|
|
|
OptString.new('CMD', [ false, 'Something like ping, version, status, etc..', '(CONNECT_DATA=(COMMAND=VERSION))']),
|
|
|
|
], self.class)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
connect
|
|
|
|
|
|
|
|
command = datastore['CMD']
|
|
|
|
|
|
|
|
pkt = tns_packet(command)
|
|
|
|
|
|
|
|
print_status("Sending '#{command}' to #{rhost}:#{rport}")
|
|
|
|
sock.put(pkt)
|
|
|
|
print_status("writing #{pkt.length} bytes.")
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-06-22 18:58:38 +00:00
|
|
|
select(nil,nil,nil,0.5)
|
2009-07-14 16:48:56 +00:00
|
|
|
|
|
|
|
print_status("reading")
|
|
|
|
res = sock.get_once(-1,5)
|
2009-12-02 17:38:13 +00:00
|
|
|
res = res.tr("[\200-\377]","[\000-\177]")
|
|
|
|
res = res.tr("[\000-\027\]",".")
|
|
|
|
res = res.tr("\177",".")
|
2009-07-14 16:48:56 +00:00
|
|
|
puts res
|
|
|
|
|
2010-04-30 08:40:19 +00:00
|
|
|
disconnect
|
2009-07-14 16:48:56 +00:00
|
|
|
end
|
|
|
|
end
|