Adjusting exception handling

This commit adjusts the error handling to close the socket before
calling fail_with and adds specific exceptions to catch
bug/bundler_fix
Nicholas Starke 2016-05-11 17:18:51 -05:00
parent 32ae3e881e
commit 4b23d2dc58
1 changed files with 3 additions and 3 deletions

View File

@ -128,9 +128,9 @@ class MetasploitModule < Msf::Exploit::Remote
end
handler(sock)
rescue
fail_with(Failure::Unknown, "Unknown error")
sock.close
rescue Rex::AddressInUse, ::Errno::ETIMEDOUT, Rex::HostUnreachable, Rex::ConnectionTimeout, Rex::ConnectionRefused, ::Timeout::Error, ::EOFError => e
sock.close if sock
fail_with(Failure::Unknown, e.message)
end
end