Skip to content

Commit 239cc80

Browse files
committed
As there have to be computers in a domain (at least the DC) don't check if there are anwsers
1 parent 234b41e commit 239cc80

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

nxc/modules/dump-computers.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,14 @@ def on_login(self, context, connection):
5656
answer = f"{dns_host_name} ({operating_system})"
5757
answers.append(answer)
5858

59-
if answers:
60-
context.log.success("Found the following computers:")
61-
for answer in answers:
62-
context.log.highlight(answer)
59+
context.log.success("Found the following computers:")
60+
for answer in answers:
61+
context.log.highlight(answer)
6362

64-
if self.output_file:
65-
try:
66-
with open(self.output_file, "w") as f:
67-
f.write("\n".join(answers) + "\n")
68-
context.log.success(f"Results saved to {self.output_file}")
69-
except Exception as e:
70-
context.log.error(f"Failed to write to file {self.output_file}: {e}")
71-
else:
72-
context.log.success("No computers found in the domain.")
63+
if self.output_file:
64+
try:
65+
with open(self.output_file, "w") as f:
66+
f.write("\n".join(answers) + "\n")
67+
context.log.success(f"Results saved to {self.output_file}")
68+
except Exception as e:
69+
context.log.error(f"Failed to write to file {self.output_file}: {e}")

0 commit comments

Comments
 (0)