From 5411be5e3365d95f563a81bd46fe346904f6cac1 Mon Sep 17 00:00:00 2001 From: Olivier Bilodeau Date: Wed, 11 Aug 2021 14:10:38 -0400 Subject: [PATCH 1/3] NLA-redirection fix for #342: rely on host and port We relied only on the host to determine if a client was being redirected. Using host/port makes NLA redirection work in useful test situations. --- pyrdp/mitm/state.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrdp/mitm/state.py b/pyrdp/mitm/state.py index 1daebd95d..2dcbac872 100644 --- a/pyrdp/mitm/state.py +++ b/pyrdp/mitm/state.py @@ -118,7 +118,7 @@ def canRedirect(self) -> bool: return None not in [self.config.redirectionHost, self.config.redirectionPort] and not self.isRedirected() def isRedirected(self) -> bool: - return self.effectiveTargetHost == self.config.redirectionHost + return self.effectiveTargetHost == self.config.redirectionHost and self.effectiveTargetPort == self.config.redirectionPort def useRedirectionHost(self): self.effectiveTargetHost = self.config.redirectionHost From fdd20ba15119af8245afcd44c55b32101d5e09a4 Mon Sep 17 00:00:00 2001 From: Olivier Bilodeau Date: Wed, 11 Aug 2021 14:15:32 -0400 Subject: [PATCH 2/3] Updated CHANGELOG --- CHANGELOG.adoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 10069758d..ee6f5ba58 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -12,6 +12,10 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[ * Minor CLI improvements +=== Bug fixes + +* Fixed NLA redirection problems if original target and NLA redirection target are the same ({uri-issue}342[#342], {uri-issue}343[#343]) + === Infrastructure * Docker images are now built and pushed via GitHub Actions ({uri-issue}334[#334], {uri-issue}341[#341]) From 29a5341777d30213687f0a38491576ce4fb3a571 Mon Sep 17 00:00:00 2001 From: Olivier Bilodeau Date: Wed, 11 Aug 2021 14:15:46 -0400 Subject: [PATCH 3/3] Removed a type warning --- CHANGELOG.adoc | 1 + pyrdp/mitm/state.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index ee6f5ba58..8eb52726a 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -11,6 +11,7 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[ === Enhancements * Minor CLI improvements +* Improved type hints === Bug fixes diff --git a/pyrdp/mitm/state.py b/pyrdp/mitm/state.py index 2dcbac872..07190d35d 100644 --- a/pyrdp/mitm/state.py +++ b/pyrdp/mitm/state.py @@ -4,7 +4,7 @@ # Licensed under the GPLv3 or later. # -from typing import Dict, Optional +from typing import Dict, List, Optional from Crypto.PublicKey import RSA @@ -34,7 +34,7 @@ def __init__(self, config: MITMConfig, sessionID: str): self.securitySettings = SecuritySettings() """The security settings for the connection""" - self.channelDefinitions: [ClientChannelDefinition] = [] + self.channelDefinitions: List[ClientChannelDefinition] = [] """The channel definitions from the client""" self.channelMap: Dict[int, str] = {}