Stop throwing an exception on module initialization, delay this until connect() to avoid breaking module enumeration tools. Clean up the tabs and indents. Delete the broken rescue clause with no begin
git-svn-id: file:///home/svn/framework3/trunk@7696 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
5c271db9b5
commit
fda1083d13
|
@ -30,29 +30,38 @@ module Exploit::ORACLE
|
|||
)
|
||||
|
||||
begin
|
||||
olang = ENV['NLS_LANG']
|
||||
ENV['NLS_LANG'] = 'US-ASCII'
|
||||
require 'oci8'
|
||||
rescue ::LoadError
|
||||
print_error("oci8 module not loaded, is installed ok?")
|
||||
raise RuntimeError, "The oci8 module is not available!"
|
||||
ENV['NLS_LANG'] = olang
|
||||
@oci8_loaded = true
|
||||
rescue ::Exception => e
|
||||
@oci8_loaded = false
|
||||
@oci8_error = e
|
||||
end
|
||||
end
|
||||
|
||||
def connect
|
||||
if(not @oci8_loaded)
|
||||
raise RuntimeError, "Could not load the Oracle driver (oci8): #{@oci8_error}"
|
||||
end
|
||||
|
||||
# Create a Connection to the Database
|
||||
if datastore['DBUSER'] == 'SYS' || datastore['DBUSER'] == 'SYSTEM'
|
||||
handle = OCI8.new(datastore['DBUSER'],
|
||||
handle = OCI8.new(
|
||||
datastore['DBUSER'],
|
||||
datastore['DBPASS'],
|
||||
"//#{datastore['RHOST']}:#{datastore['RPORT']}/#{datastore['SID']}",
|
||||
:SYSDBA)
|
||||
:SYSDBA
|
||||
)
|
||||
else
|
||||
handle = OCI8.new(datastore['DBUSER'],
|
||||
handle = OCI8.new(
|
||||
datastore['DBUSER'],
|
||||
datastore['DBPASS'],
|
||||
"//#{datastore['RHOST']}:#{datastore['RPORT']}/#{datastore['SID']}")
|
||||
"//#{datastore['RHOST']}:#{datastore['RPORT']}/#{datastore['SID']}"
|
||||
)
|
||||
end
|
||||
# 23.11 passing a raise call after the print_error, so we get the error message and the error is passed on in case the module needs it (eg, login_brute)
|
||||
rescue ::OCIError => e
|
||||
# print_error("#{e.class} #{e.to_s}")
|
||||
raise
|
||||
|
||||
end
|
||||
|
||||
def disconnect
|
||||
|
@ -146,3 +155,4 @@ module Exploit::ORACLE
|
|||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue