Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit 729db6a

Browse files
committed
Handle binding error on initialisation
1 parent 9491d82 commit 729db6a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

payloads/reverse_tcp.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@ def client_connected(socket, event_emitter)
106106
def prepare(mod)
107107
return true unless listen_with_wpxf
108108

109-
@server = TCPServer.new(bind_to_address, lport)
109+
begin
110+
@server = TCPServer.new(bind_to_address, lport)
111+
rescue StandardError => e
112+
mod.emit_error "Failed to start the TCP handler: #{e}"
113+
return false
114+
end
115+
110116
mod.emit_success "Started reverse TCP handler on #{lport}"
111117
@network_thread = Thread.new do
112118
socket = @server.accept

0 commit comments

Comments
 (0)