Merge pull request #1287 from azoxlpf/refactor/get-network-replace-ldap3

Remove unused ldap3 import from get-network module
This commit is contained in:
Alex authored and GitHub committed 2026-06-19 09:10:20 +02:00
commit 811bf4eb69
1 file changed
-11
-11
View File
@@ -7,23 +7,12 @@ from datetime import datetime
from struct import unpack
from impacket.structure import Structure
from ldap3 import LEVEL
from os.path import expanduser
from nxc.helpers.misc import CATEGORY
from nxc.paths import NXC_PATH
from nxc.parsers.ldap_results import parse_result_attributes
def get_dns_zones(connection, root, debug=False):
connection.search(root, "(objectClass=dnsZone)", search_scope=LEVEL, attributes=["dc"])
zones = []
for entry in connection.response:
if entry["type"] != "searchResEntry":
continue
zones.append(entry["attributes"]["dc"])
return zones
def ldap2domain(baseDN):
return re.sub(r",DC=", ".", baseDN[baseDN.lower().find("dc="):], flags=re.IGNORECASE)[3:]