Skip to content

Commit e3f7168

Browse files
committed
IP resolver change to with DNS query
1 parent 8d53bb5 commit e3f7168

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

nxc/modules/find-computer.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
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
56
import sys
67

78

@@ -69,9 +70,12 @@ def on_login(self, context, connection):
6970
context.log.success("Found the following computers: ")
7071
for answer in answers:
7172
try:
72-
ip = socket.gethostbyname(answer[0])
73+
resolv = resolver.Resolver()
74+
resolv.nameservers = [connection.host]
75+
result = resolv.resolve(answer[0], "A")
76+
ip = result[0].to_text()
7377
context.log.highlight(f"{answer[0]} ({answer[1]}) ({ip})")
74-
context.log.debug("IP found")
78+
context.log.debug("IP found via DNS query")
7579
except socket.gaierror:
7680
context.log.debug("Missing IP")
7781
context.log.highlight(f"{answer[0]} ({answer[1]}) (No IP Found)")

0 commit comments

Comments
 (0)