mirror of
https://github.com/rapid7/metasploit-payloads
synced 2024-11-26 17:41:08 +01:00
Adjust how trasnport sleep is handled
This commit is contained in:
parent
8631283791
commit
cb8c2fd009
@ -722,6 +722,7 @@ class TcpTransport(Transport):
|
|||||||
class PythonMeterpreter(object):
|
class PythonMeterpreter(object):
|
||||||
def __init__(self, transport):
|
def __init__(self, transport):
|
||||||
self.transport = transport
|
self.transport = transport
|
||||||
|
self._transport_sleep = None
|
||||||
self.running = False
|
self.running = False
|
||||||
self.last_registered_extension = None
|
self.last_registered_extension = None
|
||||||
self.extension_functions = {}
|
self.extension_functions = {}
|
||||||
@ -826,6 +827,12 @@ class PythonMeterpreter(object):
|
|||||||
response = self.create_response(request)
|
response = self.create_response(request)
|
||||||
if response:
|
if response:
|
||||||
self.send_packet(response)
|
self.send_packet(response)
|
||||||
|
if self._transport_sleep:
|
||||||
|
self.transport.deactivate()
|
||||||
|
time.sleep(self._transport_sleep)
|
||||||
|
self._transport_sleep = None
|
||||||
|
if not self.transport.activate():
|
||||||
|
self.transport_change()
|
||||||
continue
|
continue
|
||||||
# iterate over the keys because self.channels could be modified if one is closed
|
# iterate over the keys because self.channels could be modified if one is closed
|
||||||
channel_ids = list(self.channels.keys())
|
channel_ids = list(self.channels.keys())
|
||||||
@ -1053,11 +1060,8 @@ class PythonMeterpreter(object):
|
|||||||
seconds = packet_get_tlv(request, TLV_TYPE_TRANS_COMM_TIMEOUT)['value']
|
seconds = packet_get_tlv(request, TLV_TYPE_TRANS_COMM_TIMEOUT)['value']
|
||||||
self.send_packet(tlv_pack_response(ERROR_SUCCESS, response))
|
self.send_packet(tlv_pack_response(ERROR_SUCCESS, response))
|
||||||
if seconds:
|
if seconds:
|
||||||
self.transport.deactivate()
|
self._transport_sleep = seconds
|
||||||
time.sleep(seconds)
|
return ERROR_SUCCESS, response
|
||||||
if not self.transport.activate():
|
|
||||||
self.transport_change()
|
|
||||||
return None
|
|
||||||
|
|
||||||
def _core_channel_open(self, request, response):
|
def _core_channel_open(self, request, response):
|
||||||
channel_type = packet_get_tlv(request, TLV_TYPE_CHANNEL_TYPE)
|
channel_type = packet_get_tlv(request, TLV_TYPE_CHANNEL_TYPE)
|
||||||
|
Loading…
Reference in New Issue
Block a user