Skip to content

Commit 6decd7f

Browse files
authored
Merge pull request Pennyw0rth#714 from Pennyw0rth/neff-fix-subnets
Add base_dn option to subnet module
2 parents 71ccfd9 + dc0bde6 commit 6decd7f

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

nxc/modules/subnets.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,17 @@ class NXCModule:
2121
"""
2222

2323
def options(self, context, module_options):
24-
"""Showservers Toggle printing of servers (default: true)"""
24+
"""SHOWSERVERS Toggle printing of servers (default: true)"""
2525
self.showservers = True
26-
self.base_dn = None
2726

2827
if module_options and "SHOWSERVERS" in module_options:
2928
if module_options["SHOWSERVERS"].lower() == "true" or module_options["SHOWSERVERS"] == "1":
3029
self.showservers = True
3130
elif module_options["SHOWSERVERS"].lower() == "false" or module_options["SHOWSERVERS"] == "0":
3231
self.showservers = False
3332
else:
34-
print("Could not parse showservers option.")
35-
if module_options and "BASE_DN" in module_options:
36-
self.base_dn = module_options["BASE_DN"]
33+
context.log.fail("Could not parse showservers option for 'SHOWSERVERS'. Please use 'true' or 'false'.")
34+
exit(1)
3735

3836
name = "subnets"
3937
description = "Retrieves the different Sites and Subnets of an Active Directory"
@@ -42,7 +40,7 @@ def options(self, context, module_options):
4240
multiple_hosts = False
4341

4442
def on_login(self, context, connection):
45-
dn = connection.ldap_connection._baseDN if self.base_dn is None else self.base_dn
43+
dn = connection.args.base_dn if connection.args.base_dn else connection.ldap_connection._baseDN
4644

4745
context.log.display("Getting the Sites and Subnets from domain")
4846

0 commit comments

Comments
 (0)