mirror of
https://github.com/rapid7/metasploit-payloads
synced 2025-03-24 18:16:24 +01:00
Don't delete channels when handling dead resources
Deleting the channels when they are dead prevents Metasploit from reading their streams before closing them.
This commit is contained in:
parent
d07f44ed46
commit
46ce044ab3
@ -667,6 +667,7 @@ class MeterpreterProcess(MeterpreterChannel):
|
|||||||
self.proc_h.kill()
|
self.proc_h.kill()
|
||||||
if self.proc_h.ptyfd is not None:
|
if self.proc_h.ptyfd is not None:
|
||||||
os.close(self.proc_h.ptyfd)
|
os.close(self.proc_h.ptyfd)
|
||||||
|
self.proc_h.ptyfd = None
|
||||||
for stream in (self.proc_h.stdin, self.proc_h.stdout, self.proc_h.stderr):
|
for stream in (self.proc_h.stdin, self.proc_h.stdout, self.proc_h.stderr):
|
||||||
if not hasattr(stream, 'close'):
|
if not hasattr(stream, 'close'):
|
||||||
continue
|
continue
|
||||||
@ -1362,7 +1363,6 @@ class PythonMeterpreter(object):
|
|||||||
self.send_packet(tlv_pack_request('core_channel_write', write_request_parts))
|
self.send_packet(tlv_pack_request('core_channel_write', write_request_parts))
|
||||||
|
|
||||||
def handle_dead_resource_channel(self, channel_id):
|
def handle_dead_resource_channel(self, channel_id):
|
||||||
del self.channels[channel_id]
|
|
||||||
if channel_id in self.interact_channels:
|
if channel_id in self.interact_channels:
|
||||||
self.interact_channels.remove(channel_id)
|
self.interact_channels.remove(channel_id)
|
||||||
self.send_packet(tlv_pack_request('core_channel_close', [
|
self.send_packet(tlv_pack_request('core_channel_close', [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user