Replace 'rescue nil' with DRY-violating versions :(
parent
85c5de07ec
commit
4966082de5
|
@ -736,8 +736,16 @@ module Exploit::Remote::SMBServer
|
|||
end
|
||||
|
||||
def smb_stop(c)
|
||||
|
||||
# Make sure the socket is closed
|
||||
c.close rescue nil
|
||||
begin
|
||||
c.close
|
||||
# Handle any number of errors that a double-close or failed shutdown can trigger
|
||||
rescue ::IOError, ::EOFError,
|
||||
::Errno::ECONNRESET, ::Errno::ENOTCONN, ::Errno::ECONNABORTED,
|
||||
::Errno::ETIMEDOUT, ::Errno::ENETRESET, ::Errno::ESHUTDOWN
|
||||
end
|
||||
|
||||
# Delete the state table entry
|
||||
@state.delete(c)
|
||||
end
|
||||
|
@ -746,8 +754,16 @@ module Exploit::Remote::SMBServer
|
|||
smb = @state[c]
|
||||
smb[:data] ||= ''
|
||||
|
||||
# Capture any low-level timeout exceptions to prevent it from bubbling
|
||||
buff = c.get_once(-1, 0.25) rescue nil
|
||||
buff = ''
|
||||
begin
|
||||
buff = c.get_once(-1, 0.25)
|
||||
# Handle any number of errors that a read can trigger depending on socket state
|
||||
rescue ::IOError, ::EOFError,
|
||||
::Errno::ECONNRESET, ::Errno::ENOTCONN, ::Errno::ECONNABORTED,
|
||||
::Errno::ETIMEDOUT, ::Errno::ENETRESET, ::Errno::ESHUTDOWN
|
||||
smb_stop(c)
|
||||
return
|
||||
end
|
||||
|
||||
# The client said it had data, but lied, kill the session
|
||||
unless buff and buff.length > 0
|
||||
|
|
Loading…
Reference in New Issue