get_option() update
The plugin function get_option() now has an optional default value which is returned in the event that no option was provided (either by the plugin as a default when creating the option, or by the end user).
This commit is contained in:
parent
f724be8191
commit
28521f6e00
|
@ -17,7 +17,7 @@ from autorecon.io import slugify, e, fformat, cprint, debug, info, warn, error,
|
|||
from autorecon.plugins import Pattern, PortScan, ServiceScan, Report, AutoRecon
|
||||
from autorecon.targets import Target, Service
|
||||
|
||||
VERSION = "2.0.23"
|
||||
VERSION = "2.0.24"
|
||||
|
||||
if not os.path.exists(config['config_dir']):
|
||||
shutil.rmtree(config['config_dir'], ignore_errors=True, onerror=None)
|
||||
|
|
|
@ -49,13 +49,21 @@ class Plugin(object):
|
|||
self.autorecon.add_argument(self, name, choices=choices, default=default, help=help)
|
||||
|
||||
@final
|
||||
def get_option(self, name):
|
||||
def get_option(self, name, default=None):
|
||||
# TODO: make sure name is simple.
|
||||
name = self.slug.replace('-', '_') + '.' + slugify(name).replace('-', '_')
|
||||
|
||||
if name in vars(self.autorecon.args):
|
||||
return vars(self.autorecon.args)[name]
|
||||
if vars(self.autorecon.args)[name] is None:
|
||||
if default:
|
||||
return default
|
||||
else:
|
||||
return None
|
||||
else:
|
||||
return vars(self.autorecon.args)[name]
|
||||
else:
|
||||
if default:
|
||||
return default
|
||||
return None
|
||||
|
||||
@final
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "autorecon"
|
||||
version = "2.0.23"
|
||||
version = "2.0.24"
|
||||
description = "A multi-threaded network reconnaissance tool which performs automated enumeration of services."
|
||||
authors = ["Tib3rius"]
|
||||
license = "GNU GPL v3"
|
||||
|
|
Loading…
Reference in New Issue