Skip to content

Commit d481f55

Browse files
committed
Simplify logic and remove highlight if no admin was found in directories
1 parent b0d34ad commit d481f55

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

nxc/modules/presence.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -136,25 +136,17 @@ def check_users_directory(self, context, connection, admin_users):
136136
context.log.debug("Successfully listed C$\\Users")
137137

138138
# collect folder names (lowercase) ignoring "." and ".."
139-
folder_names = [f.get_shortname().lower() for f in files if f.get_shortname() not in [".", ".."]]
140-
dirs_found.update(folder_names)
139+
dirs_found.update([f.get_shortname().lower() for f in files if f.get_shortname() not in [".", ".."]])
141140

142141
# for admin users, check for folder presence
143142
for user in admin_users:
144-
user_lower = user.lower()
145-
if user_lower == "administrator":
146-
# only match folders like "administrator.something", not "administrator"
143+
# only match folders like "administrator.something", not "administrator"
144+
if user.lower() == "administrator":
147145
matched = [d for d in dirs_found if d.startswith("administrator.") and d != "administrator"]
148146
matched_dirs.extend(matched)
149147
else:
150-
if user_lower in dirs_found:
148+
if user.lower() in dirs_found:
151149
matched_dirs.append(user)
152-
153-
if matched_dirs:
154-
pass
155-
else:
156-
context.log.highlight("[+] No admin users found in directories")
157-
158150
return matched_dirs
159151

160152
def check_tasklist(self, context, connection, admin_users, netbios_name):

0 commit comments

Comments
 (0)