From 76034b481fdac0a83c7432bfab94e71e7488a196 Mon Sep 17 00:00:00 2001 From: Ammar Date: Sat, 27 Jul 2024 20:44:22 +0530 Subject: [PATCH 1/2] Added optional command line argument for export folder name. Added an additional if statement to check if folder name is given then create a folder of that name. --- finalrecon.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/finalrecon.py b/finalrecon.py index b6333e1..c2bfefb 100644 --- a/finalrecon.py +++ b/finalrecon.py @@ -57,6 +57,7 @@ ext_help.add_argument('-e', help='File Extensions [ Example : txt, xml, php ]') ext_help.add_argument('-o', help='Export Format [ Default : txt ]') ext_help.add_argument('-cd', help='Change export directory [ Default : ~/.local/share/finalrecon ]') +ext_help.add_argument('-of', help='Change export folder name [ Default :fr__ ]') ext_help.add_argument('-k', help='Add API key [ Example : shodan@key ]') ext_help.set_defaults( dt=config.dir_enum_th, @@ -69,7 +70,8 @@ d=config.custom_dns, e=config.dir_enum_ext, o=config.export_fmt, - cd=config.usr_data + cd=config.usr_data, + of = None, ) try: @@ -103,6 +105,7 @@ show_banner = args.nb add_key = args.k output_dir = args.cd +folder_name = args.of import socket import datetime @@ -223,9 +226,13 @@ def save_key(key_string): if output != 'None': fpath = output_dir - dt_now = str(datetime.datetime.now().strftime('%d-%m-%Y_%H:%M:%S')) - fname = f'{fpath}fr_{hostname}_{dt_now}.{output}' - respath = f'{fpath}fr_{hostname}_{dt_now}' + if not folder_name: + dt_now = str(datetime.datetime.now().strftime('%d-%m-%Y_%H:%M:%S')) + fname = f'{fpath}fr_{hostname}_{dt_now}.{output}' + respath = f'{fpath}fr_{hostname}_{dt_now}' + else: + fname = f'{folder_name}.{output}' + respath = f'{folder_name}' if not os.path.exists(respath): os.makedirs(respath) out_settings = { From 10d12351f617636d2beb2986b415f5035ec7ba40 Mon Sep 17 00:00:00 2001 From: ammar26627 Date: Sat, 27 Jul 2024 23:34:48 +0530 Subject: [PATCH 2/2] Added path to folder name --- finalrecon.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/finalrecon.py b/finalrecon.py index c2bfefb..f2f21f8 100644 --- a/finalrecon.py +++ b/finalrecon.py @@ -231,8 +231,8 @@ def save_key(key_string): fname = f'{fpath}fr_{hostname}_{dt_now}.{output}' respath = f'{fpath}fr_{hostname}_{dt_now}' else: - fname = f'{folder_name}.{output}' - respath = f'{folder_name}' + fname = f'{fpath}{folder_name}.{output}' + respath = f'{fpath}{folder_name}' if not os.path.exists(respath): os.makedirs(respath) out_settings = {