Skip to content

Commit

Permalink
Added optional command line argument for export folder name. Added an…
Browse files Browse the repository at this point in the history
… additional if statement to check if folder name is given then create a folder of that name.
  • Loading branch information
ammar26627 committed Jul 27, 2024
1 parent 3893ac4 commit 76034b4
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions finalrecon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 :<path>fr_<hostname>_<date> ]')
ext_help.add_argument('-k', help='Add API key [ Example : shodan@key ]')
ext_help.set_defaults(
dt=config.dir_enum_th,
Expand All @@ -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:
Expand Down Expand Up @@ -103,6 +105,7 @@
show_banner = args.nb
add_key = args.k
output_dir = args.cd
folder_name = args.of

import socket
import datetime
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 76034b4

Please sign in to comment.