Handle exceptions in mysql_login
parent
268de941c7
commit
261e095e5e
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue