Skip to content

Commit

Permalink
Merge pull request #894 from whiskeykilo/fix-touch-errors
Browse files Browse the repository at this point in the history
Fix touch errors in multi-recon by ensuring directories exist before file operations
  • Loading branch information
six2dez authored Aug 19, 2024
2 parents b2b1897 + 2dd728b commit 604bc3c
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions reconftw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3349,19 +3349,37 @@ function multi_recon() {

for domain in $targets; do
dir=$workdir/targets/$domain
called_fn_dir=$dir/.called_fn
mkdir -p $dir
cd "$dir" || {
echo "Failed to cd directory '$dir' in ${FUNCNAME[0]} @ line ${LINENO}"
exit 1
}
mkdir -p {.log,.tmp,webs,hosts,vulns,osint,screenshots,subdomains}

NOW=$(date +"%F")
NOWT=$(date +"%T")
LOGFILE="${dir}/.log/${NOW}_${NOWT}.txt"
touch .log/${NOW}_${NOWT}.txt
echo "[$(date +'%Y-%m-%d %H:%M:%S')] Start ${NOW} ${NOWT}" >"${LOGFILE}"
called_fn_dir=$dir/.called_fn

# Ensure directories exist
mkdir -p "$dir" || {
echo "Failed to create directory '$dir' in ${FUNCNAME[0]} @ line ${LINENO}"
exit 1
}
mkdir -p "$called_fn_dir" || {
echo "Failed to create directory '$called_fn_dir' in ${FUNCNAME[0]} @ line ${LINENO}"
exit 1
}

cd "$dir" || {
echo "Failed to cd to directory '$dir' in ${FUNCNAME[0]} @ line ${LINENO}"
exit 1
}

mkdir -p {.log,.tmp,webs,hosts,vulns,osint,screenshots,subdomains}

NOW=$(date +"%F")
NOWT=$(date +"%T")
LOGFILE="${dir}/.log/${NOW}_${NOWT}.txt"

# Ensure the .log directory exists before touching the file
mkdir -p .log

touch "$LOGFILE" || {
echo "Failed to create log file: $LOGFILE"
exit 1
}
echo "[$(date +'%Y-%m-%d %H:%M:%S')] Start ${NOW} ${NOWT}" >"$LOGFILE"
loopstart=$(date +%s)

domain_info
Expand Down

0 comments on commit 604bc3c

Please sign in to comment.