Skip to content

Commit 3549ce5

Browse files
author
Aurélien CHALOT
committed
Lower permission checks, merge both options into --shares and add deprecation warning
1 parent e6ce6da commit 3549ce5

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

nxc/protocols/smb.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,14 +1197,18 @@ def shares(self):
11971197
error = get_error_string(e)
11981198
self.logger.debug(f"Error adding share: {error}")
11991199

1200+
if self.args.filter_shares:
1201+
self.logger.display("[ REMOVED ] Use the --shares read,write options instead.")
1202+
12001203
self.logger.display("Enumerated shares")
12011204
self.logger.highlight(f"{'Share':<15} {'Permissions':<15} {'Remark'}")
12021205
self.logger.highlight(f"{'-----':<15} {'-----------':<15} {'------'}")
1206+
12031207
for share in permissions:
12041208
name = share["name"]
12051209
remark = share["remark"]
12061210
perms = ",".join(share["access"])
1207-
if self.args.filter_shares and not any(x in perms for x in self.args.filter_shares):
1211+
if self.args.shares and self.args.shares.lower() not in perms.lower():
12081212
continue
12091213
self.logger.highlight(f"{name:<15} {perms:<15} {remark}")
12101214
return permissions

nxc/protocols/smb/proto_args.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def proto_args(parser, parents):
3737
cred_gathering_group.add_argument("--user", dest="userntds", type=str, help="Dump selected user from DC")
3838

3939
mapping_enum_group = smb_parser.add_argument_group("Mapping/Enumeration", "Options for Mapping/Enumerating")
40-
mapping_enum_group.add_argument("--shares", action="store_true", help="Enumerate shares and access")
40+
mapping_enum_group.add_argument("--shares", type=str, nargs="?", const="read,write", help="Enumerate shares and access, filter on specified argument (read ; write ; read,write)")
4141
mapping_enum_group.add_argument("--dir", nargs="?", type=str, const="", help="List the content of a path (default path: '%(const)s')")
4242
mapping_enum_group.add_argument("--interfaces", action="store_true", help="Enumerate network interfaces")
4343
mapping_enum_group.add_argument("--no-write-check", action="store_true", help="Skip write check on shares (avoid leaving traces when missing delete permissions)")

0 commit comments

Comments
 (0)