Skip to content

Commit

Permalink
Merge pull request #69 from ammar26627/folder_name_feature
Browse files Browse the repository at this point in the history
Added an optional cli arg for export dir name
  • Loading branch information
thewhiteh4t authored Aug 3, 2024
2 parents 3893ac4 + 10d1235 commit 6cfd9ad
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'{fpath}{folder_name}.{output}'
respath = f'{fpath}{folder_name}'
if not os.path.exists(respath):
os.makedirs(respath)
out_settings = {
Expand Down

0 comments on commit 6cfd9ad

Please sign in to comment.