Skip to content

reconFTW is a tool designed to perform automated recon on a target domain by running the best set of tools to perform scanning and finding out vulnerabilities

still fixing output 3

six2dez5de96349c6f8
diff --git a/lib/parallel.sh b/lib/parallel.sh
index e6a57de..ce0ff98 100644
--- a/lib/parallel.sh
+++ b/lib/parallel.sh
@@ -123,6 +123,8 @@ _parallel_batch_summary() {
# Skip in quiet mode
[[ "${OUTPUT_VERBOSITY:-1}" -eq 0 ]] && return 0
+ # Skip batch envelope in summary mode at normal verbosity
+ [[ "${PARALLEL_LOG_MODE:-summary}" == "summary" ]] && [[ "${OUTPUT_VERBOSITY:-1}" -lt 2 ]] && return 0
if declare -F ui_batch_end >/dev/null 2>&1; then
local ok_count=$((total - failed))
@@ -200,7 +202,10 @@ parallel_funcs() {
if ((${#batch_pids[@]} == 0)); then
if declare -F ui_batch_start >/dev/null 2>&1; then
- ui_batch_start "$batch_label" "$max_jobs"
+ # Skip batch envelope in summary mode at normal verbosity - individual status lines suffice
+ if [[ "${PARALLEL_LOG_MODE:-summary}" != "summary" ]] || [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
+ ui_batch_start "$batch_label" "$max_jobs"
+ fi
fi
fi
diff --git a/lib/ui.sh b/lib/ui.sh
index 803d9ac..2575b98 100644
--- a/lib/ui.sh
+++ b/lib/ui.sh
@@ -29,7 +29,9 @@ ui_init() {
fi
if [[ "$_UI_NO_COLOR" == true ]]; then
+ # shellcheck disable=SC2034 # Color vars used by modules that source this file
bred="" bgreen="" bblue="" byellow="" yellow="" reset=""
+ # shellcheck disable=SC2034
red="" blue="" green="" cyan=""
fi
@@ -163,11 +165,12 @@ ui_summary() {
_print_rule
printf " Subdomains: %s\n" "$subs"
printf " Web hosts: %s\n" "$webs"
- printf " Vulnerabilities: %bπŸ”΄ %d%b β”‚ %b🟠 %d%b β”‚ %b🟑 %d%b β”‚ %bπŸ”΅ %d%b\n" \
+ printf " Vulnerabilities: %bπŸ”΄ %d%b β”‚ %b🟠 %d%b β”‚ %b🟑 %d%b β”‚ %bπŸ”΅ %d%b β”‚ %bℹ️ %d%b\n" \
"${bred:-}" "$crit" "${reset:-}" \
"${yellow:-}" "$high" "${reset:-}" \
"${yellow:-}" "$med" "${reset:-}" \
- "${bblue:-}" "$low" "${reset:-}"
+ "${bblue:-}" "$low" "${reset:-}" \
+ "${cyan:-}" "$info" "${reset:-}"
printf " Duration: %s\n" "$duration"
printf " Output: %s\n" "$outdir"
_print_rule
diff --git a/modules/axiom.sh b/modules/axiom.sh
index 9b10f57..ddae7ec 100644
--- a/modules/axiom.sh
+++ b/modules/axiom.sh
@@ -19,13 +19,15 @@ function resolvers_update() {
if [[ $AXIOM != true ]]; then
if [[ ! -s $resolvers ]] || [[ $(find "$resolvers" -mtime +1 -print) ]]; then
notification "Resolvers seem older than 1 day\n Generating custom resolvers..." warn
- rm -f -- "$resolvers" 2>>"$LOGFILE"
- dnsvalidator -tL https://public-dns.info/nameservers.txt -threads $DNSVALIDATOR_THREADS -o $resolvers 2>>"$LOGFILE" >/dev/null
- dnsvalidator -tL https://raw.githubusercontent.com/blechschmidt/massdns/master/lists/resolvers.txt -threads $DNSVALIDATOR_THREADS -o tmp_resolvers 2>>"$LOGFILE" >/dev/null
- [ -s "tmp_resolvers" ] && cat tmp_resolvers | anew -q $resolvers
+ {
+ rm -f -- "$resolvers"
+ dnsvalidator -tL https://public-dns.info/nameservers.txt -threads "$DNSVALIDATOR_THREADS" -o "$resolvers" >/dev/null
+ dnsvalidator -tL https://raw.githubusercontent.com/blechschmidt/massdns/master/lists/resolvers.txt -threads "$DNSVALIDATOR_THREADS" -o tmp_resolvers >/dev/null
+ } 2>>"$LOGFILE"
+ [ -s "tmp_resolvers" ] && cat tmp_resolvers | anew -q "$resolvers"
[ -s "tmp_resolvers" ] && rm -f tmp_resolvers 2>>"$LOGFILE" >/dev/null
- [ ! -s "$resolvers" ] && wget -q -O - ${resolvers_url} >$resolvers
- [ ! -s "$resolvers_trusted" ] && wget -q -O - ${resolvers_trusted_url} >$resolvers_trusted
+ [ ! -s "$resolvers" ] && wget -q -O - "${resolvers_url}" >"$resolvers"
+ [ ! -s "$resolvers_trusted" ] && wget -q -O - "${resolvers_trusted_url}" >"$resolvers_trusted"
notification "Updated\n" good
fi
else
@@ -93,12 +95,12 @@ function ipcidr_target() {
function axiom_launch() {
# let's fire up a FLEET!
if [[ $AXIOM_FLEET_LAUNCH == true ]] && [[ -n $AXIOM_FLEET_NAME ]] && [[ -n $AXIOM_FLEET_COUNT ]]; then
- start_func ${FUNCNAME[0]} "Launching our Axiom fleet"
+ start_func "${FUNCNAME[0]}" "Launching our Axiom fleet"
# Check to see if we have a fleet already, if so, SKIP THIS!
- NUMOFNODES=$(timeout 30 axiom-ls | grep -c "$AXIOM_FLEET_NAME" || true)
+ NUMOFNODES=$(timeout 30 axiom-ls 2>>"$LOGFILE" | grep -c "$AXIOM_FLEET_NAME" || true)
if [[ $NUMOFNODES -ge $AXIOM_FLEET_COUNT ]]; then
- axiom-select "$AXIOM_FLEET_NAME*"
+ axiom-select "$AXIOM_FLEET_NAME*" 2>>"$LOGFILE" >/dev/null
end_func "Axiom fleet $AXIOM_FLEET_NAME already has $NUMOFNODES instances" info
else
if [[ $NUMOFNODES -eq 0 ]]; then
@@ -113,12 +115,12 @@ function axiom_launch() {
# Show the exact command with proper quoting
axiom-fleet2 "${AXIOM_FLEET_NAME}" "${AXIOM_FLEET_ARGS[@]}" >/dev/null 2>&1
- axiom-select "$AXIOM_FLEET_NAME*"
+ axiom-select "$AXIOM_FLEET_NAME*" 2>>"$LOGFILE" >/dev/null
if [[ -n $AXIOM_POST_START ]]; then
bash -lc "$AXIOM_POST_START" 2>>"$LOGFILE" >/dev/null
fi
- NUMOFNODES=$(timeout 30 axiom-ls | grep -c "$AXIOM_FLEET_NAME" || true)
+ NUMOFNODES=$(timeout 30 axiom-ls 2>>"$LOGFILE" | grep -c "$AXIOM_FLEET_NAME" || true)
end_func "Axiom fleet $AXIOM_FLEET_NAME launched $NUMOFNODES instances" info
fi
fi
@@ -131,15 +133,15 @@ function axiom_shutdown() {
notification "Automatic Axiom fleet shutdown is not enabled in this mode" info
return
fi
- axiom-rm -f "$AXIOM_FLEET_NAME*" || true
- axiom-ls | grep "$AXIOM_FLEET_NAME" || true
- notification "Axiom fleet $AXIOM_FLEET_NAME shutdown" info
+ axiom-rm -f "$AXIOM_FLEET_NAME*" 2>>"$LOGFILE" >/dev/null || true
+ axiom-ls 2>>"$LOGFILE" | grep "$AXIOM_FLEET_NAME" >>"$LOGFILE" || true
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && notification "Axiom fleet $AXIOM_FLEET_NAME shutdown" info
fi
}
function axiom_selected() {
- if [[ ! $(axiom-ls | tail -n +2 | sed '$ d' | wc -l) -gt 0 ]]; then
+ if [[ ! $(axiom-ls 2>>"${LOGFILE:-/dev/null}" | tail -n +2 | sed '$ d' | wc -l) -gt 0 ]]; then
notification "No axiom instances running ${reset}\n\n" error
exit
fi
diff --git a/modules/modes.sh b/modules/modes.sh
index 708ba75..3f6be45 100644
--- a/modules/modes.sh
+++ b/modules/modes.sh
@@ -38,7 +38,7 @@ function start() {
"$(date +'%Y-%m-%d %H:%M:%S')" "$OSINT" "$SUBDOMAINS_GENERAL" "$VULNS_GENERAL" "$DEEP"
} >>"${LOGFILE:-/dev/null}"
if [[ $upgrade_before_running == true ]]; then
- ${SCRIPTPATH}/install.sh --tools
+ "${SCRIPTPATH}/install.sh" --tools
fi
if [[ "${MONITOR_MODE:-false}" == "true" ]] && [[ "${MONITOR_CYCLE:-1}" -gt 1 ]]; then
notification "Monitor cycle ${MONITOR_CYCLE}: skipping repeated tools check" info
@@ -224,28 +224,28 @@ function end() {
_print_error "Faraday server is not running. Skipping Faraday integration"
else
if [[ -s ".tmp/tko_json.txt" ]]; then
- faraday-cli tool report -w $FARADAY_WORKSPACE --plugin-id nuclei .tmp/tko_json.txt 2>>"$LOGFILE" >/dev/null
+ faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei .tmp/tko_json.txt 2>>"$LOGFILE" >/dev/null
fi
if [[ -s "hosts/portscan_active.xml" ]]; then
- faraday-cli tool report -w $FARADAY_WORKSPACE --plugin-id nmap hosts/portscan_active.xml 2>>"$LOGFILE" >/dev/null
+ faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nmap hosts/portscan_active.xml 2>>"$LOGFILE" >/dev/null
fi
if [[ -s ".tmp/fuzzparams_json.txt" ]]; then
- faraday-cli tool report -w $FARADAY_WORKSPACE --plugin-id nuclei .tmp/fuzzparams_json.txt 2>>"$LOGFILE" >/dev/null
+ faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei .tmp/fuzzparams_json.txt 2>>"$LOGFILE" >/dev/null
fi
if [[ -s "nuclei_output/info_json.txt" ]]; then
- faraday-cli tool report -w $FARADAY_WORKSPACE --plugin-id nuclei nuclei_output/info_json.txt 2>>"$LOGFILE" >/dev/null
+ faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/info_json.txt 2>>"$LOGFILE" >/dev/null
fi
if [[ -s "nuclei_output/low_json.txt" ]]; then
- faraday-cli tool report -w $FARADAY_WORKSPACE --plugin-id nuclei nuclei_output/low_json.txt 2>>"$LOGFILE" >/dev/null
+ faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/low_json.txt 2>>"$LOGFILE" >/dev/null
fi
if [[ -s "nuclei_output/medium_json.txt" ]]; then
- faraday-cli tool report -w $FARADAY_WORKSPACE --plugin-id nuclei nuclei_output/medium_json.txt 2>>"$LOGFILE" >/dev/null
+ faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/medium_json.txt 2>>"$LOGFILE" >/dev/null
fi
if [[ -s "nuclei_output/high_json.txt" ]]; then
- faraday-cli tool report -w $FARADAY_WORKSPACE --plugin-id nuclei nuclei_output/high_json.txt 2>>"$LOGFILE" >/dev/null
+ faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/high_json.txt 2>>"$LOGFILE" >/dev/null
fi
if [[ -s "nuclei_output/critical_json.txt" ]]; then
- faraday-cli tool report -w $FARADAY_WORKSPACE --plugin-id nuclei nuclei_output/critical_json.txt 2>>"$LOGFILE" >/dev/null
+ faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/critical_json.txt 2>>"$LOGFILE" >/dev/null
fi
notification "Information sent to Faraday" "good"
fi
@@ -265,6 +265,7 @@ function end() {
# Screenshot diffs (hashing)
if [[ -d screenshots ]]; then
if [[ -f screenshots/hashes.txt ]]; then mv screenshots/hashes.txt screenshots/hashes_prev.txt 2>>"$LOGFILE" || true; fi
+ # shellcheck disable=SC2016 # $1 is intentionally for sh -c, not bash
find screenshots -type f -name '*.png' -print0 | xargs -0 -I{} sh -c 'sha256sum "$1" 2>/dev/null || shasum -a 256 "$1"' -- {} | sed 's| ./||' >screenshots/hashes.txt 2>>"$LOGFILE" || true
if [[ -f screenshots/hashes_prev.txt ]]; then
comm -3 <(cut -d' ' -f1,2 screenshots/hashes_prev.txt | sort) <(cut -d' ' -f1,2 screenshots/hashes.txt | sort) | awk '{print $2}' | sed '/^$/d' >screenshots/diff_changed.txt 2>>"$LOGFILE" || true
@@ -281,7 +282,7 @@ function end() {
incremental_report
global_end=$(date +%s)
- getElapsedTime $global_start $global_end
+ getElapsedTime "$global_start" "$global_end"
if declare -F ui_summary >/dev/null 2>&1; then
if [[ "${RECON_PARTIAL_RUN:-false}" == "true" ]]; then
_print_status WARN "Run completed with non-fatal warnings" "osint_parallel=${RECON_OSINT_PARALLEL_FAILURES:-0}"
@@ -328,17 +329,17 @@ function build_hotlist() {
# Nuclei high/critical
for f in nuclei_output/high_json.txt nuclei_output/critical_json.txt; do
[[ -s $f ]] || continue
- jq -r '.["matched-at"] // .host' "$f" 2>/dev/null | while read -r h; do
+ while read -r h; do
[[ -z $h ]] && continue
score["$h"]=$((${score["$h"]:-0} + 10))
- done
+ done < <(jq -r '.["matched-at"] // .host' "$f" 2>/dev/null)
done
# Takeovers
[[ -s webs/takeover.txt ]] && while read -r h; do score["$h"]=$((${score["$h"]:-0} + 8)); done <webs/takeover.txt
# Secrets
for s in js/js_secrets.txt js/js_secrets_jsmap.txt js/js_secrets_jsmap_jsluice.txt; do
[[ -s $s ]] || continue
- awk '{print $1}' "$s" | while read -r h; do score["$h"]=$((${score["$h"]:-0} + 6)); done
+ while read -r h; do score["$h"]=$((${score["$h"]:-0} + 6)); done < <(awk '{print $1}' "$s")
done
# Real IPs via favicon
if [[ -s hosts/favicontest.txt ]]; then
@@ -802,13 +803,12 @@ function multi_recon() {
currently=$(date +"%H:%M:%S")
loopend=$(date +%s)
getElapsedTime "$loopstart" "$loopend"
- _print_rule
- printf "${bgreen} Target: %s finished 1st loop in %s (%s)${reset}\n" "$domain" "$runtime" "$currently"
if [[ -n $flist ]]; then
POSINLIST=$(grep -nrE "^${domain}$" "$flist" | cut -f1 -d':')
- printf " Progress: %s of %s\n" "$POSINLIST" "$LISTTOTAL"
+ _print_status OK "${domain} (OSINT ${POSINLIST}/${LISTTOTAL})" "$runtime"
+ else
+ _print_status OK "${domain} (OSINT)" "$runtime"
fi
- _print_rule
done
cd "$workdir" || {
echo "Failed to cd directory '$workdir' in ${FUNCNAME[0]} @ line ${LINENO}"
@@ -841,13 +841,12 @@ function multi_recon() {
currently=$(date +"%H:%M:%S")
loopend=$(date +%s)
getElapsedTime "$loopstart" "$loopend"
- _print_rule
- printf "${bgreen} Target: %s finished 2nd loop in %s (%s)${reset}\n" "$domain" "$runtime" "$currently"
if [[ -n $flist ]]; then
POSINLIST=$(grep -nrE "^${domain}$" "$flist" | cut -f1 -d':')
- printf " Progress: %s of %s\n" "$POSINLIST" "$LISTTOTAL"
+ _print_status OK "${domain} (recon ${POSINLIST}/${LISTTOTAL})" "$runtime"
+ else
+ _print_status OK "${domain} (recon)" "$runtime"
fi
- _print_rule
done
cd "$workdir" || {
echo "Failed to cd directory '$workdir' in ${FUNCNAME[0]} @ line ${LINENO}"
@@ -865,13 +864,10 @@ function multi_recon() {
find . -type f -name 'portscan_active.gnmap' -exec cat {} + | tee hosts/portscan_active.gnmap 2>>"$LOGFILE" >/dev/null
find . -type f -name 'portscan_passive.txt' -exec cat {} + | tee hosts/portscan_passive.txt 2>&1 >>"$LOGFILE" >/dev/null
- notification "- ${NUMOFLINES_pwndb_total} total creds leaked" good
- notification "- ${NUMOFLINES_subs_total} total subdomains" good
- notification "- ${NUMOFLINES_subtko_total} total probably subdomain takeovers" good
- notification "- ${NUMOFLINES_webs_total} total websites" good
- notification "- ${NUMOFLINES_webs_total_uncommon} total websites on uncommon ports" good
- notification "- ${NUMOFLINES_ips_total} total ips" good
- notification "- ${NUMOFLINES_cloudsprov_total} total IPs belongs to cloud" good
+ printf " Creds: %s β”‚ Subs: %s β”‚ Takeovers: %s β”‚ Webs: %s (+%s uncommon) β”‚ IPs: %s β”‚ Cloud: %s\n" \
+ "$NUMOFLINES_pwndb_total" "$NUMOFLINES_subs_total" "$NUMOFLINES_subtko_total" \
+ "$NUMOFLINES_webs_total" "$NUMOFLINES_webs_total_uncommon" \
+ "$NUMOFLINES_ips_total" "$NUMOFLINES_cloudsprov_total"
s3buckets
waf_checks
nuclei_check
@@ -892,13 +888,12 @@ function multi_recon() {
currently=$(date +"%H:%M:%S")
loopend=$(date +%s)
getElapsedTime "$loopstart" "$loopend"
- _print_rule
- printf "${bgreen} Target: %s finished 3rd loop in %s (%s)${reset}\n" "$domain" "$runtime" "$currently"
if [[ -n $flist ]]; then
POSINLIST=$(grep -nrE "^${domain}$" "$flist" | cut -f1 -d':')
- printf " Progress: %s of %s\n" "$POSINLIST" "$LISTTOTAL"
+ _print_status OK "${domain} (vulns ${POSINLIST}/${LISTTOTAL})" "$runtime"
+ else
+ _print_status OK "${domain} (vulns)" "$runtime"
fi
- _print_rule
done
if [[ $AXIOM == true ]]; then
@@ -923,13 +918,12 @@ function multi_recon() {
currently=$(date +"%H:%M:%S")
loopend=$(date +%s)
getElapsedTime "$loopstart" "$loopend"
- _print_rule
- printf "${bgreen} Target: %s finished final loop in %s (%s)${reset}\n" "$domain" "$runtime" "$currently"
if [[ -n $flist ]]; then
POSINLIST=$(grep -nrE "^${domain}$" "$flist" | cut -f1 -d':')
- printf " Progress: %s of %s\n" "$POSINLIST" "$LISTTOTAL"
+ _print_status OK "${domain} (final ${POSINLIST}/${LISTTOTAL})" "$runtime"
+ else
+ _print_status OK "${domain} (final)" "$runtime"
fi
- _print_rule
done
cd "$workdir" || {
echo "Failed to cd directory '$workdir' in ${FUNCNAME[0]} @ line ${LINENO}"
@@ -1239,16 +1233,16 @@ function report_only_mode() {
function help() {
pt_header "Usage"
- printf "\n Usage: $0 [-d domain.tld] [-m name] [-l list.txt] [-x oos.txt] [-i in.txt] "
+ printf "\n Usage: %s [-d domain.tld] [-m name] [-l list.txt] [-x oos.txt] [-i in.txt] " "$0"
printf "\n [-r] [-s] [-p] [-a] [-w] [-n] [-z] [-c] [-y] [-h] [-f] [--ai] [--deep] [--monitor] [--monitor-interval m] [--monitor-cycles n] [--report-only] [--refresh-cache] [--export fmt] [-o OUTPUT]\n\n"
- printf " ${bblue}TARGET OPTIONS${reset}\n"
+ printf " %sTARGET OPTIONS%s\n" "${bblue}" "${reset}"
printf " -d domain.tld Target domain\n"
printf " -m company Target company name\n"
printf " -l list.txt Targets list (One on each line)\n"
printf " -x oos.txt Excludes subdomains list (Out Of Scope)\n"
printf " -i in.txt Includes subdomains list\n"
printf " \n"
- printf " ${bblue}MODE OPTIONS${reset}\n"
+ printf " %sMODE OPTIONS%s\n" "${bblue}" "${reset}"
printf " -r, --recon Recon - Performs full recon process (without attacks)\n"
printf " -s, --subdomains Subdomains - Performs Subdomain Enumeration, Web probing and check for sub-tko\n"
printf " -p, --passive Passive - Performs only passive steps\n"
@@ -1260,7 +1254,7 @@ function help() {
printf " -y, --ai AI - Analyzes ReconFTW results using a local LLM\n"
printf " -h Help - Show help section\n"
printf " \n"
- printf " ${bblue}GENERAL OPTIONS${reset}\n"
+ printf " %sGENERAL OPTIONS%s\n" "${bblue}" "${reset}"
printf " --deep Deep scan (Enable some slow options for deeper scan)\n"
printf " -f config_file Alternate reconftw.cfg file\n"
printf " -o output/path Define output folder\n"
@@ -1284,25 +1278,25 @@ function help() {
printf " --refresh-cache Force refresh of cached resolvers/wordlists\n"
printf " --export fmt Export artifacts: json|html|csv|all\n"
printf " \n"
- printf " ${bblue}USAGE EXAMPLES${reset}\n"
- printf " ${byellow}Perform full recon (without attacks):${reset}\n"
+ printf " %sUSAGE EXAMPLES%s\n" "${bblue}" "${reset}"
+ printf " %sPerform full recon (without attacks):%s\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -d example.com -r\n"
printf " \n"
- printf " ${byellow}Perform subdomain enumeration on multiple targets:${reset}\n"
+ printf " %sPerform subdomain enumeration on multiple targets:%s\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -l targets.txt -s\n"
printf " \n"
- printf " ${byellow}Perform Web based scanning on a subdomains list:${reset}\n"
+ printf " %sPerform Web based scanning on a subdomains list:%s\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -d example.com -l targets.txt -w\n"
printf " \n"
- printf " ${byellow}Multidomain recon:${reset}\n"
+ printf " %sMultidomain recon:%s\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -m company -l domainlist.txt -r\n"
printf " \n"
- printf " ${byellow}Perform full recon (with active attacks) along Out-Of-Scope subdomains list:${reset}\n"
+ printf " %sPerform full recon (with active attacks) along Out-Of-Scope subdomains list:%s\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -d example.com -x out.txt -a\n"
printf " \n"
- printf " ${byellow}Analyze ReconFTW results with AI:${reset}\n"
+ printf " %sAnalyze ReconFTW results with AI:%s\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -d example.com -r --ai\n"
printf " \n"
- printf " ${byellow}Run custom function:${reset}\n"
+ printf " %sRun custom function:%s\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -d example.com -c nuclei_check \n"
}
diff --git a/modules/web.sh b/modules/web.sh
index 9df7d6d..6595344 100644
--- a/modules/web.sh
+++ b/modules/web.sh
@@ -279,7 +279,7 @@ function screenshot() {
# Run nuclei or axiom-scan based on AXIOM flag
if [[ $AXIOM != true ]]; then
if [[ -s "webs/webs_all.txt" ]]; then
- nuclei -headless -id screenshot -V dir='screenshots' <webs/webs_all.txt 2>>"$LOGFILE"
+ nuclei -headless -id screenshot -V dir='screenshots' <webs/webs_all.txt 2>>"$LOGFILE" >/dev/null
fi
else
if [[ -s "webs/webs_all.txt" ]]; then
@@ -328,9 +328,9 @@ function virtualhosts() {
else
if [[ $VIRTUALHOSTS == false ]]; then
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
+ printf "\n%s[%s] %s skipped in this mode or defined in reconftw.cfg %s\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "${reset}"
else
- printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} has already been processed. To force execution, delete:\n $called_fn_dir/.${FUNCNAME[0]} ${reset}\n\n"
+ printf "%s[%s] %s has already been processed. To force execution, delete:\n %s/.%s %s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "$called_fn_dir" "${FUNCNAME[0]}" "${reset}"
fi
fi
@@ -387,12 +387,12 @@ function favicon() {
else
if [[ $FAVICON == false ]]; then
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped due to configuration settings.${reset}\n"
+ printf "\n%s[%s] %s skipped due to configuration settings.%s\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "${reset}"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Domain is an IP, do nothing
return
else
- printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} has already been processed. To force execution, delete:\n $called_fn_dir/.${FUNCNAME[0]}${reset}\n\n"
+ printf "%s[%s] %s has already been processed. To force execution, delete:\n %s/.%s%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "$called_fn_dir" "${FUNCNAME[0]}" "${reset}"
fi
fi
@@ -511,10 +511,10 @@ function portscan() {
if [[ $AXIOM != true ]]; then
if [[ -s ".tmp/ips_nocdn.txt" ]]; then
- run_command $SUDO nmap "${portscan_opts[@]}" -iL .tmp/ips_nocdn.txt -oA hosts/portscan_active 2>>"$LOGFILE" >/dev/null
+ run_command "$SUDO" nmap "${portscan_opts[@]}" -iL .tmp/ips_nocdn.txt -oA hosts/portscan_active 2>>"$LOGFILE" >/dev/null
fi
if [[ $IPV6_SCAN == true && -s "hosts/ips_v6.txt" ]]; then
- run_command $SUDO nmap -6 "${portscan_opts[@]}" -iL hosts/ips_v6.txt -oA hosts/portscan_active_v6 2>>"$LOGFILE" >/dev/null
+ run_command "$SUDO" nmap -6 "${portscan_opts[@]}" -iL hosts/ips_v6.txt -oA hosts/portscan_active_v6 2>>"$LOGFILE" >/dev/null
fi
else
if [[ -s ".tmp/ips_nocdn.txt" ]]; then
@@ -538,7 +538,7 @@ function portscan() {
printf "%b[!] Faraday server is not running. Skipping Faraday integration.%b\n" "$bred" "$reset"
else
if [[ -s "hosts/portscan_active.xml" ]]; then
- faraday-cli tool report -w $FARADAY_WORKSPACE --plugin-id nmap hosts/portscan_active.xml 2>>"$LOGFILE" >/dev/null
+ faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nmap hosts/portscan_active.xml 2>>"$LOGFILE" >/dev/null
fi
fi
fi
@@ -597,12 +597,12 @@ function cdnprovider() {
else
if [[ $CDN_IP == false ]]; then
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped due to configuration settings.${reset}\n"
+ printf "\n%s[%s] %s skipped due to configuration settings.%s\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "${reset}"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Domain is an IP, do nothing
return
else
- printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} has already been processed. To force execution, delete:\n $called_fn_dir/.${FUNCNAME[0]}${reset}\n\n"
+ printf "%s[%s] %s has already been processed. To force execution, delete:\n %s/.%s%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "$called_fn_dir" "${FUNCNAME[0]}" "${reset}"
fi
fi
@@ -711,8 +711,8 @@ _nuclei_prepare_waf_lists() {
_nuclei_parse_results() {
local crit="$1"
if [[ -s "nuclei_output/${crit}_json.txt" ]]; then
- jq -r '["[" + .["template-id"] + (if .["matcher-name"] != null then ":" + .["matcher-name"] else "" end) + "] [" + .["type"] + "] [" + .info.severity + "] " + (.["matched-at"] // .host) + (if .["extracted-results"] != null then " " + (.["extracted-results"] | @json) else "" end)] | .[]' nuclei_output/${crit}_json.txt >nuclei_output/${crit}.txt
- append_assets_from_file finding value nuclei_output/${crit}.txt
+ jq -r '["[" + .["template-id"] + (if .["matcher-name"] != null then ":" + .["matcher-name"] else "" end) + "] [" + .["type"] + "] [" + .info.severity + "] " + (.["matched-at"] // .host) + (if .["extracted-results"] != null then " " + (.["extracted-results"] | @json) else "" end)] | .[]' "nuclei_output/${crit}_json.txt" >"nuclei_output/${crit}.txt"
+ append_assets_from_file finding value "nuclei_output/${crit}.txt"
if [[ -s "nuclei_output/${crit}.txt" ]]; then
cat "nuclei_output/${crit}.txt"
fi
@@ -725,17 +725,17 @@ _nuclei_scan_local() {
IFS=',' read -ra severity_array <<<"$NUCLEI_SEVERITY"
for crit in "${severity_array[@]}"; do
- printf "${yellow}\n[$(date +'%Y-%m-%d %H:%M:%S')] Running: Nuclei Severity: $crit ${reset}\n\n"
+ printf "%s\n[%s] Running: Nuclei Severity: %s %s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "$crit" "${reset}"
# Non-WAF at default rate
- if [[ -s $NOWAF_LIST ]]; then
- run_command nuclei -l "$NOWAF_LIST" -severity "$crit" -nh -rl "$NUCLEI_RATELIMIT" -silent -retries 2 ${NUCLEI_EXTRA_ARGS} -t ${NUCLEI_TEMPLATES_PATH} -j -o "nuclei_output/${crit}_json.txt" 2>>"$LOGFILE" >/dev/null
+ if [[ -s "$NOWAF_LIST" ]]; then
+ run_command nuclei -l "$NOWAF_LIST" -severity "$crit" -nh -rl "$NUCLEI_RATELIMIT" -silent -retries 2 "${NUCLEI_EXTRA_ARGS}" -t "${NUCLEI_TEMPLATES_PATH}" -j -o "nuclei_output/${crit}_json.txt" 2>>"$LOGFILE" >/dev/null
fi
# WAF hosts at slower rate
- if [[ -s $WAF_LIST ]]; then
+ if [[ -s "$WAF_LIST" ]]; then
local slow_rl
slow_rl=$((NUCLEI_RATELIMIT / 3 + 1))
- run_command nuclei -l "$WAF_LIST" -severity "$crit" -nh -rl "$slow_rl" -silent -retries 2 ${NUCLEI_EXTRA_ARGS} -t ${NUCLEI_TEMPLATES_PATH} -j -o "nuclei_output/${crit}_waf_json.txt" 2>>"$LOGFILE" >/dev/null
- [[ -s nuclei_output/${crit}_waf_json.txt ]] && cat nuclei_output/${crit}_waf_json.txt >>nuclei_output/${crit}_json.txt
+ run_command nuclei -l "$WAF_LIST" -severity "$crit" -nh -rl "$slow_rl" -silent -retries 2 "${NUCLEI_EXTRA_ARGS}" -t "${NUCLEI_TEMPLATES_PATH}" -j -o "nuclei_output/${crit}_waf_json.txt" 2>>"$LOGFILE" >/dev/null
+ [[ -s "nuclei_output/${crit}_waf_json.txt" ]] && cat "nuclei_output/${crit}_waf_json.txt" >>"nuclei_output/${crit}_json.txt"
fi
_nuclei_parse_results "$crit"
done
@@ -748,7 +748,7 @@ _nuclei_scan_axiom() {
IFS=',' read -ra severity_array <<<"$NUCLEI_SEVERITY"
for crit in "${severity_array[@]}"; do
- printf "${yellow}\n[$(date +'%Y-%m-%d %H:%M:%S')] Running: Axiom Nuclei Severity: $crit. Check results in nuclei_output folder.${reset}\n\n"
+ printf "%s\n[%s] Running: Axiom Nuclei Severity: %s. Check results in nuclei_output folder.%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "$crit" "${reset}"
run_command axiom-scan .tmp/webs_subs.txt -m nuclei \
--nuclei-templates "$NUCLEI_TEMPLATES_PATH" \
-severity "$crit" -nh -rl "$NUCLEI_RATELIMIT" \
@@ -864,9 +864,9 @@ function graphql_scan() {
end_func "Results are saved in nuclei_output/graphql* and vulns/graphql" "${FUNCNAME[0]}"
else
if [[ $GRAPHQL_CHECK == false ]]; then
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped due to configuration settings.${reset}\n"
+ printf "\n%s[%s] %s skipped due to configuration settings.%s\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "${reset}"
else
- printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} has already been processed. To force execution, delete:\n $called_fn_dir/.${FUNCNAME[0]}${reset}\n\n"
+ printf "%s[%s] %s has already been processed. To force execution, delete:\n %s/.%s%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "$called_fn_dir" "${FUNCNAME[0]}" "${reset}"
fi
fi
}
@@ -888,9 +888,9 @@ function param_discovery() {
end_func "Results are saved in webs/params_discovered.txt" "${FUNCNAME[0]}"
else
if [[ $PARAM_DISCOVERY == false ]]; then
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped due to configuration settings.${reset}\n"
+ printf "\n%s[%s] %s skipped due to configuration settings.%s\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "${reset}"
else
- printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} has already been processed. To force execution, delete:\n $called_fn_dir/.${FUNCNAME[0]}${reset}\n\n"
+ printf "%s[%s] %s has already been processed. To force execution, delete:\n %s/.%s%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "$called_fn_dir" "${FUNCNAME[0]}" "${reset}"
fi
fi
}
@@ -919,9 +919,9 @@ function grpc_reflection() {
end_func "Results are saved in hosts/grpc_reflection.txt" "${FUNCNAME[0]}"
else
if [[ $GRPC_SCAN == false ]]; then
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped due to configuration settings.${reset}\n"
+ printf "\n%s[%s] %s skipped due to configuration settings.%s\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "${reset}"
else
- printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} has already been processed. To force execution, delete:\n $called_fn_dir/.${FUNCNAME[0]}${reset}\n\n"
+ printf "%s[%s] %s has already been processed. To force execution, delete:\n %s/.%s%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "$called_fn_dir" "${FUNCNAME[0]}" "${reset}"
fi
fi
}
@@ -946,7 +946,7 @@ _fuzz_run_local() {
_fuzz_classify_targets
if [[ -s .tmp/webs_normal.txt ]]; then
- interlace -tL .tmp/webs_normal.txt -threads ${INTERLACE_THREADS} -c "ffuf ${FFUF_FLAGS} -t ${FFUF_THREADS} -rate ${FFUF_RATELIMIT} -H \"${HEADER}\" -w ${fuzz_wordlist} -maxtime ${FFUF_MAXTIME} -u _target_/FUZZ -o _output_/_cleantarget_.json" -o "$dir/.tmp/fuzzing" 2>>"$LOGFILE" >/dev/null
+ interlace -tL .tmp/webs_normal.txt -threads "${INTERLACE_THREADS}" -c "ffuf ${FFUF_FLAGS} -t ${FFUF_THREADS} -rate ${FFUF_RATELIMIT} -H \"${HEADER}\" -w ${fuzz_wordlist} -maxtime ${FFUF_MAXTIME} -u _target_/FUZZ -o _output_/_cleantarget_.json" -o "$dir/.tmp/fuzzing" 2>>"$LOGFILE" >/dev/null
fi
if [[ -s .tmp/webs_slow.txt ]]; then
@@ -954,14 +954,14 @@ _fuzz_run_local() {
[[ $slow_threads -lt 5 ]] && slow_threads=5
local slow_rate=$FFUF_RATELIMIT
[[ ${FFUF_RATELIMIT:-0} -eq 0 ]] && slow_rate=50 || slow_rate=$((FFUF_RATELIMIT / 3 + 1))
- interlace -tL .tmp/webs_slow.txt -threads ${INTERLACE_THREADS} -c "ffuf ${FFUF_FLAGS} -t ${slow_threads} -rate ${slow_rate} -H \"${HEADER}\" -w ${fuzz_wordlist} -maxtime ${FFUF_MAXTIME} -u _target_/FUZZ -o _output_/_cleantarget_.json" -o "$dir/.tmp/fuzzing" 2>>"$LOGFILE" >/dev/null
+ interlace -tL .tmp/webs_slow.txt -threads "${INTERLACE_THREADS}" -c "ffuf ${FFUF_FLAGS} -t ${slow_threads} -rate ${slow_rate} -H \"${HEADER}\" -w ${fuzz_wordlist} -maxtime ${FFUF_MAXTIME} -u _target_/FUZZ -o _output_/_cleantarget_.json" -o "$dir/.tmp/fuzzing" 2>>"$LOGFILE" >/dev/null
fi
}
# Run ffuf via axiom-scan and parse per-subdomain results
_fuzz_run_axiom() {
cached_download_typed "${fuzzing_remote_list}" ".tmp/fuzzing_remote_list.txt" "onelistforallmicro.txt" "wordlists"
- axiom-scan webs/webs_all.txt -m ffuf -wL .tmp/fuzzing_remote_list.txt -H "${HEADER}" $FFUF_FLAGS -s -maxtime $FFUF_MAXTIME -oJ "$dir/.tmp/ffuf-content.json" $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
+ axiom-scan webs/webs_all.txt -m ffuf -wL .tmp/fuzzing_remote_list.txt -H "${HEADER}" "$FFUF_FLAGS" -s -maxtime "$FFUF_MAXTIME" -oJ "$dir/.tmp/ffuf-content.json" "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
while read -r sub; do
local sub_out
@@ -1062,12 +1062,12 @@ function iishortname() {
else
# Handle cases where IIS_SHORTNAME is false or the function has already been processed
if [[ $IIS_SHORTNAME == false ]]; then
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped due to configuration settings.${reset}\n"
+ printf "\n%s[%s] %s skipped due to configuration settings.%s\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "${reset}"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Domain is an IP address; skip the function
return
else
- printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} has already been processed. To force execution, delete:\n $called_fn_dir/.${FUNCNAME[0]}${reset}\n\n"
+ printf "%s[%s] %s has already been processed. To force execution, delete:\n %s/.%s%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "$called_fn_dir" "${FUNCNAME[0]}" "${reset}"
fi
fi
@@ -1191,7 +1191,7 @@ function urlchecks() {
if [[ -s "webs/webs_all.txt" ]]; then
if [[ $URL_CHECK_PASSIVE == true ]]; then
- urlfinder -d $domain -all -o .tmp/url_extract_tmp.txt 2>>"$LOGFILE" >/dev/null
+ urlfinder -d "$domain" -all -o .tmp/url_extract_tmp.txt 2>>"$LOGFILE" >/dev/null
if command -v waymore &>/dev/null; then
if ! "$TIMEOUT_CMD" "${WAYMORE_TIMEOUT:-30m}" waymore -i "$domain" -mode U -oU .tmp/waymore_urls.txt 2>>"$LOGFILE" >/dev/null; then
log_note "urlchecks: waymore failed or timed out; continuing with other passive sources" "${FUNCNAME[0]}" "${LINENO}"
@@ -1237,9 +1237,9 @@ function urlchecks() {
LINES=$(wc -l <.tmp/katana_targets_normal.txt)
if [[ $LINES -gt ${CHUNK_LIMIT:-2000} ]]; then
if [[ $DEEP == true ]]; then
- process_in_chunks .tmp/katana_targets_normal.txt ${CHUNK_LIMIT:-2000} "katana -silent -list _chunk_ -jc -kf all -c $KATANA_THREADS -d 3 -fs rdn >> .tmp/katana.txt 2>>\"$LOGFILE\" >/dev/null"
+ process_in_chunks .tmp/katana_targets_normal.txt "${CHUNK_LIMIT:-2000}" "katana -silent -list _chunk_ -jc -kf all -c $KATANA_THREADS -d 3 -fs rdn >> .tmp/katana.txt 2>>\"$LOGFILE\" >/dev/null"
else
- process_in_chunks .tmp/katana_targets_normal.txt ${CHUNK_LIMIT:-2000} "katana -silent -list _chunk_ -jc -kf all -c $KATANA_THREADS -d 2 -fs rdn >> .tmp/katana.txt 2>>\"$LOGFILE\""
+ process_in_chunks .tmp/katana_targets_normal.txt "${CHUNK_LIMIT:-2000}" "katana -silent -list _chunk_ -jc -kf all -c $KATANA_THREADS -d 2 -fs rdn >> .tmp/katana.txt 2>>\"$LOGFILE\""
fi
else
if [[ $DEEP == true ]]; then
@@ -1257,9 +1257,9 @@ function urlchecks() {
LINES=$(wc -l <.tmp/katana_targets_slow.txt)
if [[ $LINES -gt ${CHUNK_LIMIT:-2000} ]]; then
if [[ $DEEP == true ]]; then
- process_in_chunks .tmp/katana_targets_slow.txt ${CHUNK_LIMIT:-2000} "katana -silent -list _chunk_ -jc -kf all -c $slow_c -d 3 -fs rdn >> .tmp/katana.txt 2>>\"$LOGFILE\""
+ process_in_chunks .tmp/katana_targets_slow.txt "${CHUNK_LIMIT:-2000}" "katana -silent -list _chunk_ -jc -kf all -c $slow_c -d 3 -fs rdn >> .tmp/katana.txt 2>>\"$LOGFILE\""
else
- process_in_chunks .tmp/katana_targets_slow.txt ${CHUNK_LIMIT:-2000} "katana -silent -list _chunk_ -jc -kf all -c $slow_c -d 2 -fs rdn >> .tmp/katana.txt 2>>\"$LOGFILE\""
+ process_in_chunks .tmp/katana_targets_slow.txt "${CHUNK_LIMIT:-2000}" "katana -silent -list _chunk_ -jc -kf all -c $slow_c -d 2 -fs rdn >> .tmp/katana.txt 2>>\"$LOGFILE\""
fi
else
if [[ $DEEP == true ]]; then
@@ -1375,7 +1375,7 @@ function url_gf() {
# Iterate over GF patterns and process each
for pattern in "${!gf_patterns[@]}"; do
output_file="${gf_patterns[$pattern]}"
- printf "${yellow}\n[$(date +'%Y-%m-%d %H:%M:%S')] Running: GF Pattern '$pattern'${reset}\n\n"
+ printf "%s\n[%s] Running: GF Pattern '%s'%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "$pattern" "${reset}"
if [[ $pattern == "potential" ]]; then
# Special handling for 'potential' pattern
gf "$pattern" "webs/url_extract.txt" | cut -d ':' -f3-5 | anew -q "$output_file"
@@ -1390,7 +1390,7 @@ function url_gf() {
# Process endpoints extraction
if [[ -s ".tmp/url_extract_tmp.txt" ]]; then
- printf "${yellow}\n[$(date +'%Y-%m-%d %H:%M:%S')] Extracting endpoints...${reset}\n\n"
+ printf "%s\n[%s] Extracting endpoints...%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${reset}"
grep -aEiv "\.(eot|jpg|jpeg|gif|css|tif|tiff|png|ttf|otf|woff|woff2|ico|pdf|svg|txt|js)$" ".tmp/url_extract_tmp.txt" \
| unfurl -u format '%s://%d%p' 2>>"$LOGFILE" | anew -q "gf/endpoints.txt"
fi
@@ -1404,12 +1404,12 @@ function url_gf() {
else
# Handle cases where URL_GF is false or the function has already been processed
if [[ $URL_GF == false ]]; then
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped due to configuration settings.${reset}\n"
+ printf "\n%s[%s] %s skipped due to configuration settings.%s\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "${reset}"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Domain is an IP address; skip the function
return
else
- printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} has already been processed. To force execution, delete:\n $called_fn_dir/.${FUNCNAME[0]}${reset}\n\n"
+ printf "%s[%s] %s has already been processed. To force execution, delete:\n %s/.%s%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "$called_fn_dir" "${FUNCNAME[0]}" "${reset}"
fi
fi
@@ -1468,12 +1468,12 @@ function url_ext() {
else
# Handle cases where URL_EXT is false or function already processed
if [[ $URL_EXT == false ]]; then
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
+ printf "\n%s[%s] %s skipped in this mode or defined in reconftw.cfg %s\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "${reset}"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Domain is an IP address; skip the function
return
else
- printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} has already been processed. To force execution, delete:\n $called_fn_dir/.${FUNCNAME[0]}${reset}\n\n"
+ printf "%s[%s] %s has already been processed. To force execution, delete:\n %s/.%s%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "$called_fn_dir" "${FUNCNAME[0]}" "${reset}"
fi
fi
@@ -1671,7 +1671,7 @@ function websocket_checks() {
fi
end_func "Results are saved in vulns/websocket_misconfig.txt" "${FUNCNAME[0]}"
else
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped or already processed.${reset}\n"
+ printf "\n%s[%s] %s skipped or already processed.%s\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "${reset}"
fi
}
@@ -1698,7 +1698,7 @@ function wordlist_gen() {
| sed 's/[][]//g' | sed 's/[#]//g' | sed 's/[}{]//g' \
| anew -q webs/dict_values.txt
- printf "${yellow}\n[$(date +'%Y-%m-%d %H:%M:%S')] Extracting words...${reset}\n"
+ printf "%s\n[%s] Extracting words...%s\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${reset}"
tr "[:punct:]" "\n" <".tmp/url_extract_tmp.txt" | anew -q "webs/dict_words.txt"
fi
@@ -1707,12 +1707,12 @@ function wordlist_gen() {
else
# Handle cases where WORDLIST is false or function already processed
if [[ $WORDLIST == false ]]; then
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped in this mode or defined in reconftw.cfg ${reset}\n"
+ printf "\n%s[%s] %s skipped in this mode or defined in reconftw.cfg %s\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "${reset}"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Domain is an IP address; skip the function
return
else
- printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} has already been processed. To force execution, delete:\n $called_fn_dir/.${FUNCNAME[0]}${reset}\n\n"
+ printf "%s[%s] %s has already been processed. To force execution, delete:\n %s/.%s%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "$called_fn_dir" "${FUNCNAME[0]}" "${reset}"
fi
fi
@@ -1740,7 +1740,7 @@ function wordlist_gen_roboxtractor() {
# Proceed only if webs_all.txt exists and is non-empty
if [[ -s "webs/webs_all.txt" ]]; then
# Extract URLs using roboxtractor and append unique entries to robots_wordlist.txt
- printf "${yellow}\n[$(date +'%Y-%m-%d %H:%M:%S')] Running: Roboxtractor for Robots Wordlist${reset}\n\n"
+ printf "%s\n[%s] Running: Roboxtractor for Robots Wordlist%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${reset}"
roboxtractor -m 1 -wb <"webs/webs_all.txt" 2>>"$LOGFILE" | anew -q "webs/robots_wordlist.txt"
else
end_func "No webs/webs_all.txt file found, Robots Wordlist generation skipped." "${FUNCNAME[0]}"
@@ -1758,12 +1758,12 @@ function wordlist_gen_roboxtractor() {
else
# Handle cases where ROBOTSWORDLIST is false or function already processed
if [[ $ROBOTSWORDLIST == false ]]; then
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped due to configuration settings.${reset}\n"
+ printf "\n%s[%s] %s skipped due to configuration settings.%s\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "${reset}"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Domain is an IP address; skip the function
return
else
- printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} has already been processed. To force execution, delete:\n $called_fn_dir/.${FUNCNAME[0]}${reset}\n\n"
+ printf "%s[%s] %s has already been processed. To force execution, delete:\n %s/.%s%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "$called_fn_dir" "${FUNCNAME[0]}" "${reset}"
fi
fi
@@ -1796,12 +1796,12 @@ function password_dict() {
else
# Handle cases where PASSWORD_DICT is false or function already processed
if [[ $PASSWORD_DICT == false ]]; then
- printf "\n${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} skipped due to configuration settings.${reset}\n"
+ printf "\n%s[%s] %s skipped due to configuration settings.%s\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "${reset}"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Domain is an IP address; skip the function
return
else
- printf "${yellow}[$(date +'%Y-%m-%d %H:%M:%S')] ${FUNCNAME[0]} has already been processed. To force execution, delete:\n $called_fn_dir/.${FUNCNAME[0]}${reset}\n\n"
+ printf "%s[%s] %s has already been processed. To force execution, delete:\n %s/.%s%s\n\n" "${yellow}" "$(date +'%Y-%m-%d %H:%M:%S')" "${FUNCNAME[0]}" "$called_fn_dir" "${FUNCNAME[0]}" "${reset}"
fi
fi
diff --git a/tests/unit/test_parallel.bats b/tests/unit/test_parallel.bats
index 3961fe3..6abf3a5 100644
--- a/tests/unit/test_parallel.bats
+++ b/tests/unit/test_parallel.bats
@@ -233,15 +233,35 @@ teardown() {
[[ "$output" == *"end"* ]]
}
-@test "batch summary line is printed after each batch" {
+@test "batch summary line is suppressed in summary mode at normal verbosity" {
PARALLEL_LOG_MODE="summary"
+ OUTPUT_VERBOSITY=1
+ fast_func() { echo "done"; }
+
+ run parallel_funcs 2 fast_func
+ [ "$status" -eq 0 ]
+ [[ "$output" != *"batch:"* ]]
+ [[ "$output" != *"jobs"* ]]
+}
+
+@test "batch summary line is shown in summary mode at verbose" {
+ PARALLEL_LOG_MODE="summary"
+ OUTPUT_VERBOSITY=2
+ fast_func() { echo "done"; }
+
+ run parallel_funcs 2 fast_func
+ [ "$status" -eq 0 ]
+ [[ "$output" == *"batch:"* ]] || [[ "$output" == *"ok:"* ]]
+}
+
+@test "batch summary line is shown in tail mode" {
+ PARALLEL_LOG_MODE="tail"
+ OUTPUT_VERBOSITY=1
fast_func() { echo "done"; }
run parallel_funcs 2 fast_func
[ "$status" -eq 0 ]
- [[ "$output" == *"batch:"* ]]
- [[ "$output" == *"1 jobs"* ]]
- [[ "$output" == *"0 failed"* ]]
+ [[ "$output" == *"batch:"* ]] || [[ "$output" == *"ok:"* ]]
}
@test "quiet mode suppresses OK output in summary" {