Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

67 lines (56 sloc) 1.659 kB
# oracle_login.rc
# Author: nebulus
<ruby>
hosts = {}
host_id_to_ip = {}
# map hosts ip to host_id
begin
framework.db.hosts.each do |host|
# don't really like having to do that but only way I could tie them together as notes were missing ip
host_id_to_ip[host.id] = host.address
end
rescue ActiveRecord::ConnectionNotEstablished
puts "DB not connected..."
# Uncomment if you want auto-reconnect and retry (on really large scans the db connector can time out)
# self.run_single('db_connect <creds>')
# puts "trying again..."
# retry
end
begin
framework.db.notes.each do |note|
if ( note.ntype == 'oracle_sid' )
data = note.data
if(data =~ /PORT=(\d+), SID=(\S*)$/)
ip = host_id_to_ip[note.host_id]
port = "#{$1}"
sid = "#{$2}"
if(sid != '')
hosts["#{ip}"] = {'RPORT' => port, 'SID' => sid}
end
else
puts "Bad regexp (#{note.inspect})"
end
end
end
rescue ActiveRecord::ConnectionNotEstablished
puts "DB not connected..."
# Uncomment if you want auto-reconnect and retry (on really large scans the db connector can time out)
# self.run_single('db_connect <creds>')
# puts "trying again..."
# retry
end
self.run_single("use auxiliary/admin/oracle/oracle_login")
hosts.each do |rhost|
begin
self.run_single("set RHOST #{rhost[0]}")
self.run_single("set RPORT #{rhost[1]['RPORT']}")
self.run_single("set SID #{rhost[1]['SID']}")
self.run_single('exploit')
puts "DB not connected..."
# Uncomment if you want auto-reconnect and retry (on really large scans the db connector can time out)
# self.run_single('db_connect <creds>')
# puts "trying again..."
# retry
end
end
</ruby>
Jump to Line
Something went wrong with that request. Please try again.