Skip to content

Commit 1214190

Browse files
feat(smb): show defaults if not None/empty if they are set
1 parent f021cde commit 1214190

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

nxc/protocols/smb/proto_args.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from argparse import _StoreTrueAction, HelpFormatter
1+
from argparse import _StoreTrueAction
22
from nxc.helpers.args import DisplayDefaultsNotNone
33

44

55
def proto_args(parser, parents):
6-
smb_parser = parser.add_parser("smb", help="own stuff using SMB", parents=parents)
6+
smb_parser = parser.add_parser("smb", help="own stuff using SMB", parents=parents, formatter_class=DisplayDefaultsNotNone)
77
smb_parser.add_argument("-H", "--hash", metavar="HASH", dest="hash", nargs="+", default=[], help="NTLM hash(es) or file(s) containing NTLM hashes")
88

99
delegate_arg = smb_parser.add_argument("--delegate", action="store", help="Impersonate user with S4U2Self + S4U2Proxy")
@@ -13,19 +13,19 @@ def proto_args(parser, parents):
1313
dgroup.add_argument("-d", metavar="DOMAIN", dest="domain", type=str, help="domain to authenticate to")
1414
dgroup.add_argument("--local-auth", action="store_true", help="authenticate locally to each target")
1515

16-
smb_parser.add_argument("--port", type=int, choices={445, 139}, default=445, help="SMB port (default: 445)")
17-
smb_parser.add_argument("--share", metavar="SHARE", default="C$", help="specify a share (default: C$)")
16+
smb_parser.add_argument("--port", type=int, choices={445, 139}, default=445, help="SMB port")
17+
smb_parser.add_argument("--share", metavar="SHARE", default="C$", help="specify a share")
1818
smb_parser.add_argument("--smb-server-port", default="445", help="specify a server port for SMB", type=int)
1919
smb_parser.add_argument("--gen-relay-list", metavar="OUTPUT_FILE", help="outputs all hosts that don't require SMB signing to the specified file")
20-
smb_parser.add_argument("--smb-timeout", help="SMB connection timeout, default 2 secondes", type=int, default=2)
20+
smb_parser.add_argument("--smb-timeout", help="SMB connection timeout", type=int, default=2)
2121
smb_parser.add_argument("--laps", dest="laps", metavar="LAPS", type=str, help="LAPS authentification", nargs="?", const="administrator")
2222
self_delegate_arg.make_required = [delegate_arg]
2323

2424
cred_gathering_group = smb_parser.add_argument_group("Credential Gathering", "Options for gathering credentials")
2525
cred_gathering_group.add_argument("--sam", action="store_true", help="dump SAM hashes from target systems")
2626
cred_gathering_group.add_argument("--lsa", action="store_true", help="dump LSA secrets from target systems")
27-
cred_gathering_group.add_argument("--ntds", choices={"vss", "drsuapi"}, nargs="?", const="drsuapi", help="dump the NTDS.dit from target DCs using the specifed method\n(default: drsuapi)")
28-
cred_gathering_group.add_argument("--dpapi", choices={"cookies", "nosystem"}, nargs="*", help='dump DPAPI secrets from target systems, can dump cookies if you add "cookies", will not dump SYSTEM dpapi if you add nosystem\n')
27+
cred_gathering_group.add_argument("--ntds", choices={"vss", "drsuapi"}, nargs="?", const="drsuapi", help="dump the NTDS.dit from target DCs using the specifed method")
28+
cred_gathering_group.add_argument("--dpapi", choices={"cookies", "nosystem"}, nargs="*", help="dump DPAPI secrets from target systems, can dump cookies if you add 'cookies', will not dump SYSTEM dpapi if you add nosystem")
2929
cred_gathering_group.add_argument("--mkfile", action="store", help="DPAPI option. File with masterkeys in form of {GUID}:SHA1")
3030
cred_gathering_group.add_argument("--pvk", action="store", help="DPAPI option. File with domain backupkey")
3131
cred_gathering_group.add_argument("--enabled", action="store_true", help="Only dump enabled targets from DC")
@@ -44,18 +44,18 @@ def proto_args(parser, parents):
4444
mapping_enum_group.add_argument("--computers", nargs="?", const="", metavar="COMPUTER", help="enumerate computer users")
4545
mapping_enum_group.add_argument("--local-groups", nargs="?", const="", metavar="GROUP", help="enumerate local groups, if a group is specified then its members are enumerated")
4646
mapping_enum_group.add_argument("--pass-pol", action="store_true", help="dump password policy")
47-
mapping_enum_group.add_argument("--rid-brute", nargs="?", type=int, const=4000, metavar="MAX_RID", help="enumerate users by bruteforcing RID's (default: 4000)")
47+
mapping_enum_group.add_argument("--rid-brute", nargs="?", type=int, const=4000, metavar="MAX_RID", help="enumerate users by bruteforcing RIDs")
4848

4949
wmi_group = smb_parser.add_argument_group("WMI", "Options for WMI Queries")
5050
wmi_group.add_argument("--wmi", metavar="QUERY", type=str, help="issues the specified WMI query")
51-
wmi_group.add_argument("--wmi-namespace", metavar="NAMESPACE", default="root\\cimv2", help="WMI Namespace (default: root\\cimv2)")
51+
wmi_group.add_argument("--wmi-namespace", metavar="NAMESPACE", default="root\\cimv2", help="WMI Namespace")
5252

5353
spidering_group = smb_parser.add_argument_group("Spidering", "Options for spidering shares")
5454
spidering_group.add_argument("--spider", metavar="SHARE", type=str, help="share to spider")
55-
spidering_group.add_argument("--spider-folder", metavar="FOLDER", default=".", type=str, help="folder to spider (default: root share directory)")
55+
spidering_group.add_argument("--spider-folder", metavar="FOLDER", default=".", type=str, help="folder to spider")
5656
spidering_group.add_argument("--content", action="store_true", help="enable file content searching")
5757
spidering_group.add_argument("--exclude-dirs", type=str, metavar="DIR_LIST", default="", help="directories to exclude from spidering")
58-
spidering_group.add_argument("--depth", type=int, default=None, help="max spider recursion depth (default: infinity & beyond)")
58+
spidering_group.add_argument("--depth", type=int, help="max spider recursion depth")
5959
spidering_group.add_argument("--only-files", action="store_true", help="only spider files")
6060
segroup = spidering_group.add_mutually_exclusive_group()
6161
segroup.add_argument("--pattern", nargs="+", help="pattern(s) to search for in folders, filenames and file content")
@@ -67,10 +67,10 @@ def proto_args(parser, parents):
6767
files_group.add_argument("--append-host", action="store_true", help="append the host to the get-file filename")
6868

6969
cmd_exec_group = smb_parser.add_argument_group("Command Execution", "Options for executing commands")
70-
cmd_exec_group.add_argument("--exec-method", choices={"wmiexec", "mmcexec", "smbexec", "atexec"}, default=None, help="method to execute the command. Ignored if in MSSQL mode (default: wmiexec)")
71-
cmd_exec_group.add_argument("--dcom-timeout", help="DCOM connection timeout, default is 5 secondes", type=int, default=5)
72-
cmd_exec_group.add_argument("--get-output-tries", help="Number of times atexec/smbexec/mmcexec tries to get results, default is 5", type=int, default=5)
73-
cmd_exec_group.add_argument("--codec", default="utf-8", help="Set encoding used (codec) from the target's output (default: utf-8). If errors are detected, run chcp.com at the target & map the result with https://docs.python.org/3/library/codecs.html#standard-encodings and then execute again with --codec and the corresponding codec")
70+
cmd_exec_group.add_argument("--exec-method", choices={"wmiexec", "mmcexec", "smbexec", "atexec"}, default="wmiexec", help="method to execute the command. Ignored if in MSSQL mode")
71+
cmd_exec_group.add_argument("--dcom-timeout", help="DCOM connection timeout", type=int, default=5)
72+
cmd_exec_group.add_argument("--get-output-tries", help="Number of times atexec/smbexec/mmcexec tries to get results", type=int, default=5)
73+
cmd_exec_group.add_argument("--codec", default="utf-8", help="Set encoding used (codec) from the target's output. If errors are detected, run chcp.com at the target & map the result with https://docs.python.org/3/library/codecs.html#standard-encodings and then execute again with --codec and the corresponding codec")
7474
cmd_exec_group.add_argument("--no-output", action="store_true", help="do not retrieve command output")
7575
# command execution method
7676
cemgroup = cmd_exec_group.add_mutually_exclusive_group()

0 commit comments

Comments
 (0)