From f47cbca8ef4386ea6b416af2d1fa93eb456ec0db Mon Sep 17 00:00:00 2001 From: Tib3rius <48113936+Tib3rius@users.noreply.github.com> Date: Tue, 19 Oct 2021 16:36:28 -0400 Subject: [PATCH] Fixes #114 Places manual commands in the correct directory. --- autorecon/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autorecon/main.py b/autorecon/main.py index 00f2fb6..f258a7d 100644 --- a/autorecon/main.py +++ b/autorecon/main.py @@ -517,6 +517,11 @@ async def scan_target(target): protocol = service.protocol port = service.port + if config['create_port_dirs']: + scandir = os.path.join(scandir, protocol + str(port)) + os.makedirs(scandir, exist_ok=True) + os.makedirs(os.path.join(scandir, 'xml'), exist_ok=True) + # Special cases for HTTP. http_scheme = 'https' if 'https' in service.name or service.secure is True else 'http' @@ -641,7 +646,7 @@ async def scan_target(target): plugin_run = True break if not plugin.run_once_boolean or (plugin.run_once_boolean and not plugin_run): - with open(os.path.join(scandir, '_manual_commands.txt'), 'a') as file: + with open(os.path.join(target.scandir, '_manual_commands.txt'), 'a') as file: if not heading: file.write(e('[*] {service.name} on {service.protocol}/{service.port}\n\n')) heading = True