Skip to content

Commit

Permalink
Merge pull request #417 from jsherwood0/make_version_arg_universal
Browse files Browse the repository at this point in the history
Make --version switch universal so help2man will work properly
  • Loading branch information
NeffIsBack authored Sep 18, 2024
2 parents e927f33 + 9153779 commit 2eebb7c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions nxc/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def gen_cli_args():

generic_parser = argparse.ArgumentParser(add_help=False, formatter_class=DisplayDefaultsNotNone)
generic_group = generic_parser.add_argument_group("Generic", "Generic options for nxc across protocols")
generic_group.add_argument("--version", action="store_true", help="Display nxc version")
generic_group.add_argument("-t", "--threads", type=int, dest="threads", default=256, help="set how many concurrent threads to use")
generic_group.add_argument("--timeout", default=None, type=int, help="max timeout in seconds of each thread")
generic_group.add_argument("--jitter", metavar="INTERVAL", type=str, help="sets a random delay between each authentication")
Expand Down Expand Up @@ -69,8 +70,6 @@ def gen_cli_args():
parents=[generic_parser, output_parser, dns_parser]
)

parser.add_argument("--version", action="store_true", help="Display nxc version")

# we do module arg parsing here so we can reference the module_list attribute below
module_parser = argparse.ArgumentParser(add_help=False, formatter_class=DisplayDefaultsNotNone)
mgroup = module_parser.add_argument_group("Modules", "Options for nxc modules")
Expand All @@ -82,7 +81,7 @@ def gen_cli_args():
subparsers = parser.add_subparsers(title="Available Protocols", dest="protocol")

std_parser = argparse.ArgumentParser(add_help=False, parents=[generic_parser, output_parser, dns_parser], formatter_class=DisplayDefaultsNotNone)
std_parser.add_argument("target", nargs="+" if not (module_parser.parse_known_args()[0].list_modules or module_parser.parse_known_args()[0].show_module_options) else "*", type=str, help="the target IP(s), range(s), CIDR(s), hostname(s), FQDN(s), file(s) containing a list of targets, NMap XML or .Nessus file(s)")
std_parser.add_argument("target", nargs="+" if not (module_parser.parse_known_args()[0].list_modules or module_parser.parse_known_args()[0].show_module_options or generic_parser.parse_known_args()[0].version) else "*", type=str, help="the target IP(s), range(s), CIDR(s), hostname(s), FQDN(s), file(s) containing a list of targets, NMap XML or .Nessus file(s)")
credential_group = std_parser.add_argument_group("Authentication", "Options for authenticating")
credential_group.add_argument("-u", "--username", metavar="USERNAME", dest="username", nargs="+", default=[], help="username(s) or file(s) containing usernames")
credential_group.add_argument("-p", "--password", metavar="PASSWORD", dest="password", nargs="+", default=[], help="password(s) or file(s) containing passwords")
Expand Down

0 comments on commit 2eebb7c

Please sign in to comment.