Handle exceptions in mysql_login

bug/bundler_fix
sinn3r 2013-01-07 16:02:59 -06:00
parent 268de941c7
commit 261e095e5e
1 changed files with 26 additions and 10 deletions

View File

@ -40,6 +40,7 @@ module Exploit::Remote::MYSQL
disconnect if self.sock
connect
begin
@mysql_handle = ::RbMysql.connect({
:host => rhost,
:port => rport,
@ -50,6 +51,21 @@ module Exploit::Remote::MYSQL
:password => pass,
:db => db
})
rescue Errno::ECONNREFUSED
vprint_error("Connection refused")
return false
rescue RbMysql::ClientError
vprint_error("Connection timedout")
return false
rescue Errno::ETIMEDOUT
vprint_error("Operation timedout")
return false
rescue RbMysql::AccessDeniedError
vprint_error("Access denied")
return false
end
return true
end
def mysql_logoff