Verbose messages on why a connection is closed

bug/bundler_fix
HD Moore 2014-09-28 17:41:21 -07:00
parent 4966082de5
commit 8fa666b75d
1 changed files with 12 additions and 5 deletions

View File

@ -761,12 +761,14 @@ module Exploit::Remote::SMBServer
rescue ::IOError, ::EOFError,
::Errno::ECONNRESET, ::Errno::ENOTCONN, ::Errno::ECONNABORTED,
::Errno::ETIMEDOUT, ::Errno::ENETRESET, ::Errno::ESHUTDOWN
vprint_status("Dropping connection from #{smb[:name]} due to exception: #{$!.class} #{$!}")
smb_stop(c)
return
end
# The client said it had data, but lied, kill the session
unless buff and buff.length > 0
vprint_status("Dropping connection from #{smb[:name]} due to empty payload...")
smb_stop(c)
return
end
@ -776,6 +778,7 @@ module Exploit::Remote::SMBServer
# Prevent a simplistic DoS if the buffer is too big
if smb[:data].length > (1024*1024*datastore['SMBServerMaximumBuffer'])
vprint_status("Dropping connection from #{smb[:name]} due to oversized buffer of #{smb[:data].length} bytes...")
smb_stop(c)
return
end
@ -823,10 +826,11 @@ module Exploit::Remote::SMBServer
pkt = CONST::SMB_BASE_PKT.make_struct
pkt.from_s(buff)
# Only response to requests, ignore server replies
# Only respond to requests, ignore server replies
if (pkt['Payload']['SMB'].v['Flags1'] & 128 != 0)
print_status("Ignoring server response from #{smb[:name]}")
next
vprint_status("Dropping connection from #{smb[:name]} due to missing client request flag")
smb_stop(c)
return
end
cmd = pkt['Payload']['SMB'].v['Command']
@ -895,7 +899,10 @@ module Exploit::Remote::SMBServer
end
# Purge any idle connections to rescue file descriptors
purge_list.each { |sc| smb_stop(sc) }
purge_list.each do |sc|
vprint_status("Dropping connection from #{@state[sc][:name]} due to idle timeout...")
smb_stop(sc)
end
end
end