From c123e37d4e13e98dea70f470365d45bb1078ca55 Mon Sep 17 00:00:00 2001 From: Alexander Neff Date: Fri, 22 Mar 2024 12:43:17 +0100 Subject: [PATCH 1/2] Make loggedon-users unique to reduce spam and fix alignment --- nxc/protocols/smb.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nxc/protocols/smb.py b/nxc/protocols/smb.py index cc3e5faa..3038bdf4 100755 --- a/nxc/protocols/smb.py +++ b/nxc/protocols/smb.py @@ -1044,17 +1044,17 @@ class smb(connection): lmhash=self.lmhash, nthash=self.nthash, ) + logged_on = set([(f"{user.wkui1_logon_domain}\\{user.wkui1_username}", user.wkui1_logon_server) for user in logged_on]) self.logger.success("Enumerated logged_on users") if self.args.loggedon_users_filter: for user in logged_on: - if re.match(self.args.loggedon_users_filter, user.wkui1_username): - self.logger.highlight(f"{user.wkui1_logon_domain}\\{user.wkui1_username:<25} {f'logon_server: {user.wkui1_logon_server}' if user.wkui1_logon_server else ''}") + if re.match(self.args.loggedon_users_filter, user[0].split("\\")[1]): + self.logger.highlight(f"{user[0]:<25} {f'logon_server: {user[1]}'}") else: for user in logged_on: - self.logger.highlight(f"{user.wkui1_logon_domain}\\{user.wkui1_username:<25} {f'logon_server: {user.wkui1_logon_server}' if user.wkui1_logon_server else ''}") + self.logger.highlight(f"{user[0]:<25} {f'logon_server: {user[1]}'}") except Exception as e: self.logger.fail(f"Error enumerating logged on users: {e}") - return logged_on def pass_pol(self): return PassPolDump(self).dump() From 1e517c83131ad127084d16996b106b506bedc583 Mon Sep 17 00:00:00 2001 From: Alexander Neff Date: Fri, 22 Mar 2024 12:47:40 +0100 Subject: [PATCH 2/2] Fix ruff --- 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 3038bdf4..c0413e4d 100755 --- a/nxc/protocols/smb.py +++ b/nxc/protocols/smb.py @@ -1044,7 +1044,7 @@ class smb(connection): lmhash=self.lmhash, nthash=self.nthash, ) - logged_on = set([(f"{user.wkui1_logon_domain}\\{user.wkui1_username}", user.wkui1_logon_server) for user in logged_on]) + logged_on = {(f"{user.wkui1_logon_domain}\\{user.wkui1_username}", user.wkui1_logon_server) for user in logged_on} self.logger.success("Enumerated logged_on users") if self.args.loggedon_users_filter: for user in logged_on: