From ccfedf7db4685917d6f5d9f2ac865cdd1d244f4b Mon Sep 17 00:00:00 2001 From: Tib3rius <48113936+Tib3rius@users.noreply.github.com> Date: Sun, 29 Aug 2021 15:46:03 -0400 Subject: [PATCH] Updated Config / Global Files Moved global patterns to the global file. Placed create-port-dirs = true in config file to see if people notice and like it. ;) --- autorecon.py | 27 +++++++++++++-------------- config.toml | 13 +------------ 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/autorecon.py b/autorecon.py index 8956717..5edbdac 100644 --- a/autorecon.py +++ b/autorecon.py @@ -1449,6 +1449,19 @@ async def main(): global_plugin_args = parser.add_argument_group("global plugin arguments", description="These are optional arguments that can be used by all plugins.") global_plugin_args.add_argument('--global.' + slugify(gkey), **options) + elif key == 'pattern' and isinstance(val, list): # Process global patterns. + for pattern in val: + if 'pattern' in pattern: + try: + compiled = re.compile(pattern['pattern']) + if 'description' in pattern: + autorecon.patterns.append(Pattern(compiled, description=pattern['description'])) + else: + autorecon.patterns.append(Pattern(compiled)) + except re.error: + fail('Error: The pattern "' + pattern['pattern'] + '" in the config file is invalid regex.') + else: + fail('Error: A [[pattern]] in the global file doesn\'t have a required pattern variable.') except toml.decoder.TomlDecodeError: fail('Error: Couldn\'t parse ' + g.name + ' file. Check syntax.') @@ -1466,20 +1479,6 @@ async def main(): else: if autorecon.argparse.get_default('global.' + slugify(gkey).replace('-', '_')): autorecon.argparse.set_defaults(**{'global.' + slugify(gkey).replace('-', '_'): gval}) - - elif key == 'pattern' and isinstance(val, list): # Process global patterns. - for pattern in val: - if 'pattern' in pattern: - try: - compiled = re.compile(pattern['pattern']) - if 'description' in pattern: - autorecon.patterns.append(Pattern(compiled, description=pattern['description'])) - else: - autorecon.patterns.append(Pattern(compiled)) - except re.error: - fail('Error: The pattern "' + pattern['pattern'] + '" in the config file is invalid regex.') - else: - fail('Error: A [[pattern]] in the config file doesn\'t have a required pattern variable.') elif isinstance(val, dict): # Process potential plugin arguments. for pkey, pval in config_toml[key].items(): if autorecon.argparse.get_default(slugify(key).replace('-', '_') + '.' + slugify(pkey).replace('-', '_')): diff --git a/config.toml b/config.toml index a2b1a3b..0df214e 100644 --- a/config.toml +++ b/config.toml @@ -1,20 +1,9 @@ # Configure regular AutoRecon options at the top of this file. +create-port-dirs = true # verbose = 1 # max-scans = 30 -# Configure global pattern matching here. -[[pattern]] -description = 'Nmap script found a potential vulnerability. ({match})' -pattern = 'State: (?:(?:LIKELY\_?)?VULNERABLE)' - -[[pattern]] -pattern = '(?i)unauthorized' - -[[pattern]] -description = 'CVE Identified: {match}' -pattern = '(CVE-\d{4}-\d{4,7})' - # Configure global options here. # [global] # username-wordlist = '/usr/share/seclists/Usernames/cirt-default-usernames.txt'