Skip to content

Commit f1d39a6

Browse files
committed
DNS resolver change to with connection object
1 parent a0fb0f4 commit f1d39a6

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

nxc/modules/find-computer.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from nxc.logger import nxc_logger
33
from impacket.ldap.ldap import LDAPSearchError
44
from impacket.ldap.ldapasn1 import SearchResultEntry
5-
from dns import resolver
65
import sys
76

87

@@ -69,13 +68,10 @@ def on_login(self, context, connection):
6968
context.log.success("Found the following computers: ")
7069
for answer in answers:
7170
try:
72-
resolv = resolver.Resolver()
73-
resolv.nameservers = [connection.host]
74-
result = resolv.resolve(answer[0], "A")
75-
ip = result[0].to_text()
76-
context.log.highlight(f"{answer[0]} ({answer[1]}) ({ip})")
71+
resolv = connection.resolver(answer[0])
72+
context.log.highlight(f"{answer[0]} ({answer[1]}) ({resolv['host']})")
7773
context.log.debug("IP found via DNS query")
78-
except socket.gaierror:
74+
except (socket.gaierror, TypeError):
7975
context.log.debug("Missing IP")
8076
context.log.highlight(f"{answer[0]} ({answer[1]}) (No IP Found)")
8177
else:

0 commit comments

Comments
 (0)