Skip to content

Commit bedbffa

Browse files
committed
Land rapid7#3700, @ringt fix for oracle_login
* Avoid retrying logins when connection cannot be stablished
2 parents 6d2bc23 + 38c36b4 commit bedbffa

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

modules/auxiliary/admin/oracle/oracle_login.rb

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,28 @@ def run
4444
print_status("Starting brute force on #{datastore['RHOST']}:#{datastore['RPORT']}...")
4545

4646
fd = CSV.foreach(list) do |brute|
47+
datastore['DBUSER'] = brute[2].downcase
48+
datastore['DBPASS'] = brute[3].downcase
4749

48-
datastore['DBUSER'] = brute[2].downcase
49-
datastore['DBPASS'] = brute[3].downcase
50-
51-
begin
52-
connect
53-
disconnect
54-
rescue ::OCIError => e
50+
begin
51+
connect
52+
disconnect
53+
rescue ::OCIError => e
54+
if e.to_s =~ /^ORA-12170:\s/
55+
print_error("#{datastore['RHOST']}:#{datastore['RPORT']} Connection timed out")
56+
break
57+
end
5558
else
56-
if (not e)
57-
report_auth_info(
59+
report_auth_info(
5860
:host => "#{datastore['RHOST']}",
5961
:port => "#{datastore['RPORT']}",
6062
:sname => 'oracle',
6163
:user => "#{datastore['SID']}/#{datastore['DBUSER']}",
6264
:pass => "#{datastore['DBPASS']}",
6365
:active => true
64-
)
65-
print_status("Found user/pass of: #{datastore['DBUSER']}/#{datastore['DBPASS']} on #{datastore['RHOST']} with sid #{datastore['SID']}")
66-
end
67-
end
66+
)
67+
print_status("Found user/pass of: #{datastore['DBUSER']}/#{datastore['DBPASS']} on #{datastore['RHOST']} with sid #{datastore['SID']}")
68+
end
6869
end
6970
end
7071
end

0 commit comments

Comments
 (0)