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. ;)
This commit is contained in:
Tib3rius 2021-08-29 15:46:03 -04:00
parent dbcb89792f
commit 465b2a8b82
2 changed files with 14 additions and 26 deletions

View File

@ -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('-', '_')):

View File

@ -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'