Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix touch errors in multi-recon by ensuring directories exist before file operations #894

Merged
merged 7 commits into from
Aug 19, 2024
44 changes: 31 additions & 13 deletions reconftw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3341,19 +3341,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