Skip to content

Commit 8cb93db

Browse files
committed
Fix file as target
1 parent aa8b1fd commit 8cb93db

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

nxc/modules/daclread.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import binascii
22
import codecs
33
import json
4-
import re
54
import datetime
65
from enum import Enum
76
from impacket.ldap import ldaptypes
87
from impacket.uuid import bin_to_string
98
from nxc.helpers.msada_guids import SCHEMA_OBJECTS, EXTENDED_RIGHTS
9+
from nxc.parsers.ldap_results import parse_result_attributes
1010
from ldap3.protocol.formatters.formatters import format_sid
1111
from ldap3.utils.conv import escape_filter_chars
1212
from ldap3.protocol.microsoft import security_descriptor_control
1313
import sys
1414
import traceback
15+
from os.path import isfile
1516

1617
OBJECT_TYPES_GUID = {}
1718
OBJECT_TYPES_GUID.update(SCHEMA_OBJECTS)
@@ -228,12 +229,12 @@ def options(self, context, module_options):
228229

229230
if module_options and "TARGET" in module_options:
230231
context.log.debug("There is a target specified!")
231-
if re.search(r"^(.+)\/([^\/]+)$", module_options["TARGET"]) is not None:
232+
if isfile(module_options["TARGET"]):
232233
try:
233234
self.target_file = open(module_options["TARGET"]) # noqa: SIM115
234235
self.target_sAMAccountName = None
235236
except Exception:
236-
context.log.fail("The file doesn't exist or cannot be openned.")
237+
context.log.fail("The file doesn't exist or cannot be opened.")
237238
else:
238239
context.log.debug(f"Setting target_sAMAccountName to {module_options['TARGET']}")
239240
self.target_sAMAccountName = module_options["TARGET"]

0 commit comments

Comments
 (0)