Skip to content

Commit 253d8ab

Browse files
authored
removed exception handling
Signed-off-by: termanix <50464194+termanix@users.noreply.github.com>
1 parent f1d39a6 commit 253d8ab

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

nxc/modules/find-computer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ def on_login(self, context, connection):
6767
if len(answers) > 0:
6868
context.log.success("Found the following computers: ")
6969
for answer in answers:
70-
try:
71-
resolv = connection.resolver(answer[0])
70+
resolv = connection.resolver(answer[0])
71+
if resolv:
7272
context.log.highlight(f"{answer[0]} ({answer[1]}) ({resolv['host']})")
7373
context.log.debug("IP found via DNS query")
74-
except (socket.gaierror, TypeError):
75-
context.log.debug("Missing IP")
74+
else:
75+
context.log.debug(f"No DNS response for {answer[0]}")
7676
context.log.highlight(f"{answer[0]} ({answer[1]}) (No IP Found)")
7777
else:
7878
context.log.success(f"Unable to find any computers with the text {self.TEXT}")

0 commit comments

Comments
 (0)