From 6bc86e94376fc82b7a6592f95d75eb4ec0085bab Mon Sep 17 00:00:00 2001 From: SkelSec Date: Tue, 19 Aug 2025 05:47:28 -0700 Subject: [PATCH] connection status fcheck fix. increasing unicrypto version req --- Makefile | 4 ++-- aardwolf/connection.py | 8 +++++++- aardwolf/network/x224.py | 5 ++++- setup.py | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 2aab7f0..0a2c21d 100644 --- a/Makefile +++ b/Makefile @@ -12,8 +12,8 @@ publish: clean package package: clean python3 setup.py sdist - sudo docker pull quay.io/pypa/manylinux2014_x86_64 - sudo docker run --rm -v `pwd`:/io quay.io/pypa/manylinux2014_x86_64 /io/builder/manylinux/build.sh +# sudo docker pull quay.io/pypa/manylinux2014_x86_64 +# sudo docker run --rm -v `pwd`:/io quay.io/pypa/manylinux2014_x86_64 /io/builder/manylinux/build.sh rebuild: clean python3 setup.py install diff --git a/aardwolf/connection.py b/aardwolf/connection.py index 6eb899f..0b05553 100644 --- a/aardwolf/connection.py +++ b/aardwolf/connection.py @@ -570,7 +570,9 @@ class RDPConnection: conf_create_req = self.__t125_ber_codec.encode('ConnectMCSPDU',('connect-initial', initialconnect)) await self._x224net.write(bytes(conf_create_req)) - response_raw = await self._x224net.read() + response_raw = await self._x224net.read() + if response_raw is None: + raise Exception('Connection closed!') server_res_raw = response_raw.data server_res_t125 = self.__t125_ber_codec.decode('ConnectMCSPDU', server_res_raw) if server_res_t125[0] != 'connect-response': @@ -627,6 +629,8 @@ class RDPConnection: request = self._t125_per_codec.encode('DomainMCSPDU', ('attachUserRequest', {})) await self._x224net.write(request) response = await self._x224net.read() + if response is None: + raise Exception('Connection closed!') response_parsed = self._t125_per_codec.decode('DomainMCSPDU', response.data) if response_parsed[0] != 'attachUserConfirm': raise Exception('Unexpected response! %s' % response_parsed[0]) @@ -644,6 +648,8 @@ class RDPConnection: joindata = self._t125_per_codec.encode('DomainMCSPDU', ('channelJoinRequest', {'initiator': self._initiator, 'channelId': self.__joined_channels[name].channel_id})) await self._x224net.write(bytes(joindata)) response = await self._x224net.read() + if response is None: + raise Exception('Connection closed!') x = self._t125_per_codec.decode('DomainMCSPDU', response.data) if x[0] != 'channelJoinConfirm': diff --git a/aardwolf/network/x224.py b/aardwolf/network/x224.py index a5aaf74..277c0ff 100644 --- a/aardwolf/network/x224.py +++ b/aardwolf/network/x224.py @@ -46,7 +46,10 @@ class X224Network: return reply, e async def read(self): - is_fastpath, tpktdata = await self.connection.read_one() + res = await self.connection.read_one() + if res is None: + return None + is_fastpath, tpktdata = res if is_fastpath is True: raise Exception('Fastpath packet should never be here!') return X224Packet.from_bytes(tpktdata) diff --git a/setup.py b/setup.py index 24dfb05..f8f0eae 100644 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ setup( install_requires=[ - 'unicrypto>=0.0.10', + 'unicrypto>=0.0.11', 'asyauth>=0.0.16', 'asysocks>=0.2.9', 'tqdm',