From 28521f6e003d571ff318614969f82e2e86ea2b7e Mon Sep 17 00:00:00 2001 From: Tib3rius <48113936+Tib3rius@users.noreply.github.com> Date: Sun, 12 Jun 2022 16:22:20 -0400 Subject: [PATCH] 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). --- autorecon/main.py | 2 +- autorecon/plugins.py | 12 ++++++++++-- pyproject.toml | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/autorecon/main.py b/autorecon/main.py index 95eac2e..a3a4d15 100644 --- a/autorecon/main.py +++ b/autorecon/main.py @@ -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) diff --git a/autorecon/plugins.py b/autorecon/plugins.py index e0dd71b..222de4f 100644 --- a/autorecon/plugins.py +++ b/autorecon/plugins.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 0b44e3d..02cb1f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"