Skip to content

Commit a5dbfdb

Browse files
add option to exclude shares and exclude SYSVOL by default
1 parent 318ac2e commit a5dbfdb

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

nxc/modules/efsr_spray.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@ class NXCModule:
2929
supported_protocols = ["smb"]
3030
opsec_safe = True # Does the module touch disk?
3131
multiple_hosts = True # Does the module support multiple hosts?
32+
excluded_shares = ["SYSVOL"]
3233

3334
def options(self, context: Context, module_options: dict[str, str]):
3435
"""
35-
FILE_NAME Name of the file which will be tried to create and afterwards delete
36-
SHARE_NAME If set, ONLY this share will be used
36+
FILE_NAME Name of the file which will be tried to create and afterwards delete
37+
SHARE_NAME If set, ONLY this share will be used
38+
EXCLUDED_SHARES List of share names which will not be used, seperated by comma
3739
"""
3840
self.file_name = module_options.get("FILE_NAME", ntpath.normpath("\\" + gen_random_string() + ".txt"))
3941
self.share_name = module_options.get("SHARE_NAME")
42+
if module_options.get("EXCLUDED_SHARES"):
43+
self.excluded_shares += module_options.get("EXCLUDED_SHARES","").split(",")
4044

4145
def on_login(self, context: Context, connection):
4246
conn: SMBConnection = connection.conn # Because typing is broken due to smb being a folder and a file >:(
@@ -68,6 +72,9 @@ def on_login(self, context: Context, connection):
6872
if self.share_name is not None and self.share_name != share_name:
6973
continue
7074

75+
if share_name in self.excluded_shares:
76+
continue
77+
7178
try:
7279
context.log.debug(f"Connecting to share {share_name}...")
7380
tid = conn.connectTree(share_name)

0 commit comments

Comments
 (0)