Skip to content

Commit

Permalink
be more robust and careful breaking from the accept thread
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Cook committed Jan 23, 2016
1 parent 91700f1 commit a587975
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/msf/core/handler/reverse_tcp.rb
Expand Up @@ -91,15 +91,18 @@ def start_handler
# Accept a client connection
begin
client = listener_sock.accept
if !client
wlog("#{handler_name}: No client received in call to accept, exiting...")
else
if client
self.pending_connections += 1
lqueue.push(client)
end
rescue StandardError
wlog("#{handler_name}: Exception raised during listener accept: #{$ERROR_INFO}\n\n#{$ERROR_POSITION.join("\n")}")
break
rescue Errno::ENOTCONN
nil
rescue StandardError => e
wlog [
"#{handler_name}: Exception raised during listener accept: #{e.class}",
"#{$ERROR_INFO}",
"#{$ERROR_POSITION.join("\n")}"
].join("\n")
end
end
}
Expand Down

0 comments on commit a587975

Please sign in to comment.