From dcd3a62e884cd3fb72a888fa7f793d1e7fb00a6e Mon Sep 17 00:00:00 2001 From: Spencer McIntyre Date: Tue, 4 Nov 2025 17:51:21 -0500 Subject: [PATCH] Switch to the new fiber relay manager --- Gemfile.lock | 6 +++--- lib/rex/post/channel/socket_abstraction.rb | 6 ------ lib/rex/post/meterpreter/channels/pools/stream_pool.rb | 9 --------- lib/rex/post/meterpreter/channels/socket_abstraction.rb | 9 --------- .../stdapi/net/socket_subsystem/tcp_client_channel.rb | 6 ++++++ 5 files changed, 9 insertions(+), 27 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9a1e05e8d9..da04bc84aa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -231,7 +231,7 @@ GEM irb (~> 1.10) reline (>= 0.3.8) diff-lcs (1.6.2) - dnsruby (1.73.0) + dnsruby (1.73.1) base64 (>= 0.2) logger (~> 1.6) simpleidn (~> 0.2.1) @@ -494,7 +494,7 @@ GEM rex-core rex-struct2 rex-text - rex-core (0.1.34) + rex-core (0.1.35) rex-encoder (0.1.8) metasm rex-arch @@ -528,7 +528,7 @@ GEM metasm rex-core rex-text - rex-socket (0.1.62) + rex-socket (0.1.64) dnsruby rex-core rex-sslscan (0.1.13) diff --git a/lib/rex/post/channel/socket_abstraction.rb b/lib/rex/post/channel/socket_abstraction.rb index d8067e7444..3275717c4a 100644 --- a/lib/rex/post/channel/socket_abstraction.rb +++ b/lib/rex/post/channel/socket_abstraction.rb @@ -47,12 +47,6 @@ module Rex end end - def close - super - channel.cleanup_abstraction - channel.close - end - attr_accessor :channel end end diff --git a/lib/rex/post/meterpreter/channels/pools/stream_pool.rb b/lib/rex/post/meterpreter/channels/pools/stream_pool.rb index 70f3db52ab..fc04fdf268 100644 --- a/lib/rex/post/meterpreter/channels/pools/stream_pool.rb +++ b/lib/rex/post/meterpreter/channels/pools/stream_pool.rb @@ -80,15 +80,6 @@ class StreamPool < Rex::Post::Meterpreter::Channels::Pool end end - # - # Closes the local half of the pool stream. - # - def dio_close_handler(packet) - rsock.close - - return super(packet) - end - # # Cleans up resources used by the channel. # diff --git a/lib/rex/post/meterpreter/channels/socket_abstraction.rb b/lib/rex/post/meterpreter/channels/socket_abstraction.rb index 22db0a1f73..6a064d9fd5 100644 --- a/lib/rex/post/meterpreter/channels/socket_abstraction.rb +++ b/lib/rex/post/meterpreter/channels/socket_abstraction.rb @@ -76,15 +76,6 @@ module SocketAbstraction end end - # - # Performs a close operation on the right side of the local stream. - # - def dio_close_handler(packet) - rsock.close - - return super(packet) - end - # # Cleans up the stream abstraction. # diff --git a/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb b/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb index 38724721c1..ecd7f73c13 100644 --- a/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb +++ b/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb @@ -89,6 +89,12 @@ class TcpClientChannel < Rex::Post::Meterpreter::Stream rsock.synchronize_access { rsock.initsock(@params) } end + def monitor_rsock(name = 'MonitorRemote') + # call #close on exit instead of #close_write because this is triggered in response to lsock.close + # lsock.close -> rsock EOF -> #close -> Meterpreter close + monitor_sock(rsock, sink: self, name: name, on_exit: method(:close)) + end + # # Closes the write half of the connection. #