From 7d99d519e543e9930fc685f1fe54da957b626d8b Mon Sep 17 00:00:00 2001 From: Alexander Neff Date: Sun, 18 Feb 2024 01:04:37 +0100 Subject: [PATCH 1/2] Write without delete will now be displayed as write access --- nxc/protocols/smb.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nxc/protocols/smb.py b/nxc/protocols/smb.py index 386468ec..bb0629ea 100755 --- a/nxc/protocols/smb.py +++ b/nxc/protocols/smb.py @@ -741,12 +741,18 @@ class smb(connection): if not self.args.no_write_check: try: self.conn.createDirectory(share_name, temp_dir) - self.conn.deleteDirectory(share_name, temp_dir) write = True share_info["access"].append("WRITE") except SessionError as e: error = get_error_string(e) - self.logger.debug(f"Error checking WRITE access on share: {error}") + self.logger.debug(f"Error checking WRITE access on share {share_name}: {error}") + + if write: + try: + self.conn.deleteDirectory(share_name, temp_dir) + except SessionError as e: + error = get_error_string(e) + self.logger.debug(f"Error DELETING created temp dir {temp_dir} on share {share_name}: {error}") permissions.append(share_info) From c16aa4cd9f0c56b53cc34cb6f1e7800f2913ab4e Mon Sep 17 00:00:00 2001 From: Alex <61382599+NeffIsBack@users.noreply.github.com> Date: Sun, 18 Feb 2024 11:48:28 +0100 Subject: [PATCH 2/2] Add share name in debug info for write check --- nxc/protocols/smb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nxc/protocols/smb.py b/nxc/protocols/smb.py index bb0629ea..b169f2b9 100755 --- a/nxc/protocols/smb.py +++ b/nxc/protocols/smb.py @@ -736,7 +736,7 @@ class smb(connection): share_info["access"].append("READ") except SessionError as e: error = get_error_string(e) - self.logger.debug(f"Error checking READ access on share: {error}") + self.logger.debug(f"Error checking READ access on share {share_name}: {error}") if not self.args.no_write_check: try: