Make loggedon-users unique to reduce spam and fix alignment

main
Alexander Neff 2024-03-22 12:43:17 +01:00
parent fb8c4bcdcd
commit c123e37d4e
1 changed files with 4 additions and 4 deletions

View File

@ -1044,17 +1044,17 @@ class smb(connection):
lmhash=self.lmhash, lmhash=self.lmhash,
nthash=self.nthash, 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") self.logger.success("Enumerated logged_on users")
if self.args.loggedon_users_filter: if self.args.loggedon_users_filter:
for user in logged_on: for user in logged_on:
if re.match(self.args.loggedon_users_filter, user.wkui1_username): if re.match(self.args.loggedon_users_filter, user[0].split("\\")[1]):
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]}'}")
else: else:
for user in logged_on: 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: except Exception as e:
self.logger.fail(f"Error enumerating logged on users: {e}") self.logger.fail(f"Error enumerating logged on users: {e}")
return logged_on
def pass_pol(self): def pass_pol(self):
return PassPolDump(self).dump() return PassPolDump(self).dump()