Skip to content

Commit 07c6bf6

Browse files
authored
Merge pull request Pennyw0rth#941 from crosscutsaw/dump-computers_fix
Update dump-computers.py
2 parents 003043a + f8d2ffa commit 07c6bf6

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

nxc/modules/dump-computers.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class NXCModule:
66
name = "dump-computers"
7-
description = "Dumps all computers in the domain"
7+
description = "Dumps FQDN and OS of all computers in the domain"
88
supported_protocols = ["ldap"]
99
category = CATEGORY.ENUMERATION
1010

@@ -43,8 +43,11 @@ def on_login(self, context, connection):
4343
context.log.debug(f"Total number of records returned: {len(resp_parsed)}")
4444

4545
for item in resp_parsed:
46-
dns_host_name = item["dNSHostName"]
46+
dns_host_name = item.get("dNSHostName")
4747
operating_system = item.get("operatingSystem", "Unknown OS")
48+
if not dns_host_name:
49+
context.log.debug(f"Skipping computer without dNSHostName: {item.get('cn', '<unknown>')}")
50+
continue
4851

4952
if self.netbios_only:
5053
netbios_name = dns_host_name.split(".")[0]

0 commit comments

Comments
 (0)