Fixed add_list_option()

Previously, add_list_option() used argparse's "append" type. Now it uses nargs='+' to allow multiple options (space separated) that also override defaults rather than appending.
This commit is contained in:
Tib3rius 2021-08-26 17:10:17 -04:00
parent ce08818fe9
commit 6114970e26
2 changed files with 3 additions and 3 deletions

View File

@ -267,7 +267,7 @@ class Plugin(object):
@final
def add_list_option(self, name, default=None, help=None):
self.autorecon.add_argument(self, name, action='append', metavar='VALUE', default=default, help=help)
self.autorecon.add_argument(self, name, nargs='+', metavar='VALUE', default=default, help=help)
@final
def add_choice_option(self, name, choices, default=None, help=None):
@ -1264,7 +1264,7 @@ async def main():
options.pop('metavar', None)
options.pop('default', None)
elif gtype == 'list':
options['action'] = 'append'
options['nargs'] = '+'
elif gtype == 'choice':
if 'choices' not in gvals:
fail('Global choice option ' + gkey + ' has no choices value set.')

View File

@ -88,7 +88,7 @@ class DirBuster(ServiceScan):
def configure(self):
self.add_choice_option('tool', default='feroxbuster', choices=['feroxbuster', 'gobuster', 'dirsearch', 'ffuf', 'dirb'], help='The tool to use for directory busting. Default: %(default)s')
self.add_list_option('wordlist', default=['/usr/share/seclists/Discovery/Web-Content/common.txt'], help='The wordlist to use when directory busting. Specify the option multiple times to use multiple wordlists. Default: %(default)s')
self.add_list_option('wordlist', default=['/usr/share/seclists/Discovery/Web-Content/common.txt'], help='The wordlist(s) to use when directory busting. Separate multiple wordlists with spaces. Default: %(default)s')
self.add_option('threads', default=10, help='The number of threads to use when directory busting. Default: %(default)s')
self.match_service_name('^http')
self.match_service_name('^nacn_http$', negative_match=True)