From 4912c9723fe0a728813096e3c60a93ca32bd2c8d Mon Sep 17 00:00:00 2001 From: "Remi GASCOU (Podalirius)" <79218792+p0dalirius@users.noreply.github.com> Date: Sun, 2 Jun 2024 21:03:33 +0200 Subject: [PATCH] Improved logic to keep the case of the remote share name in prompt --- smbclientng/core/SMBSession.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/smbclientng/core/SMBSession.py b/smbclientng/core/SMBSession.py index 25a772f..e79190b 100644 --- a/smbclientng/core/SMBSession.py +++ b/smbclientng/core/SMBSession.py @@ -921,7 +921,14 @@ def set_share(self, shareName): """ if shareName is not None: - self.smb_share = shareName + self.list_shares() + if shareName.lower() in self.available_shares.keys(): + # Doing this in order to keep the case of the share adevertised by the remote machine + self.smb_share = self.available_shares[shareName.lower()] + else: + print("[!] Could not set share '%s', it does not exist remotely." % shareName) + + def set_cwd(self, path=None): """