Skip to content

Commit ddc66c1

Browse files
committed
Only display accounts that have been found
1 parent f2d2a72 commit ddc66c1

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

nxc/modules/pre2k.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def on_login(self, context, connection):
5656
# Save computers to file
5757
domain_dir = os.path.join(f"{NXC_PATH}/modules/pre2k", connection.domain)
5858
output_file_pre2k = os.path.join(domain_dir, "precreated_computers.txt")
59-
output_file_non_pre2k = os.path.join(domain_dir, "computers.txt")
59+
output_file_non_pre2k = os.path.join(domain_dir, "non_precreated_computers.txt")
6060

6161
# Create directories if they do not exist
6262
os.makedirs(domain_dir, exist_ok=True)
@@ -79,13 +79,10 @@ def on_login(self, context, connection):
7979
counter_pre2k = len([v for v in computers.values() if int(v) == 4128])
8080
counter_non_pre2k = len([v for v in computers.values() if int(v) != 4128])
8181

82-
context.log.success(f"Found {counter_pre2k} pre-created computer accounts. Saved to {output_file_pre2k}")
83-
84-
if counter_non_pre2k == 0:
85-
context.log.fail(f"Found {counter_non_pre2k} computer accounts.")
86-
context.log.display("Consider using the option -o ALL=true to query all computers in the domain")
87-
else:
88-
context.log.success(f"Found {counter_non_pre2k} computer accounts. Saved to {output_file_non_pre2k}")
82+
if counter_pre2k != 0:
83+
context.log.success(f"Found {counter_pre2k} pre-created computer accounts. Saved to {output_file_pre2k}")
84+
if counter_non_pre2k != 0:
85+
context.log.success(f"Found {counter_non_pre2k} normal computer accounts. Saved to {output_file_non_pre2k}")
8986
else:
9087
context.log.info("No pre-created computer accounts found.")
9188

0 commit comments

Comments
 (0)