Merge pull request #13 from bcook-r7/land-6039-mssql_idf

catch more network exceptions
bug/bundler_fix
wvu-r7 2015-10-02 18:35:23 -05:00
commit e64804d136
2 changed files with 25 additions and 8 deletions

View File

@ -385,12 +385,18 @@ module Exploit::Remote::MSSQL
disconnect if self.sock
connect
# Send a prelogin packet and check that encryption is not enabled
if mssql_prelogin() != ENCRYPT_NOT_SUP
print_error("Encryption is not supported")
begin
# Send a prelogin packet and check that encryption is not enabled
if mssql_prelogin() != ENCRYPT_NOT_SUP
print_error("Encryption is not supported")
return false
end
rescue EOFError
print_error("Probable server or network failure.")
return false
end
if datastore['USE_WINDOWS_AUTHENT']
idx = 0
@ -623,7 +629,12 @@ module Exploit::Remote::MSSQL
# Packet header and total length including header
pkt = "\x10\x01" + [pkt.length + 8].pack('n') + [0].pack('n') + [1].pack('C') + "\x00" + pkt
resp = mssql_send_recv(pkt)
begin
resp = mssql_send_recv(pkt)
rescue EOFError
print_error("Probable server or network failure.")
return false
end
end

View File

@ -94,10 +94,16 @@ class Metasploit3 < Msf::Auxiliary
sql += "CLOSE table_cursor "
sql += "DEALLOCATE table_cursor "
if mssql_login_datastore
result = mssql_query(sql, false)
else
print_error('Login failed')
begin
if mssql_login_datastore
result = mssql_query(sql, false)
column_data = result[:rows]
else
print_error('Login failed')
return
end
rescue Rex::ConnectionRefused => e
print_error("Connection failed: #{e}")
return
end