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

Bug fixes

six2deze4d4ac9452c8
diff --git a/modules/modes.sh b/modules/modes.sh
index 9cd49c3..3e3c6b7 100644
--- a/modules/modes.sh
+++ b/modules/modes.sh
@@ -114,8 +114,8 @@ function start() {
# init time saved estimator
TIME_SAVED_EST=0
- # Non-fatal error trap: log and continue
- trap 'rc=$?; ts=$(date +"%Y-%m-%d %H:%M:%S"); cmd=${BASH_COMMAND}; loc_fn=${FUNCNAME[0]:-main}; loc_ln=${BASH_LINENO[0]:-0}; msg="[$ts] ERR($rc) @ ${loc_fn}:${loc_ln} :: ${cmd}"; if [[ -n "${LOGFILE:-}" ]]; then echo "$msg" >>"$LOGFILE"; else echo "$msg" >&2; fi' ERR
+ # Non-fatal error trap: log and continue (plus short explanation for common cases)
+ trap 'rc=$?; ts=$(date +"%Y-%m-%d %H:%M:%S"); cmd=${BASH_COMMAND}; loc_fn=${FUNCNAME[0]:-main}; loc_ln=${BASH_LINENO[0]:-0}; msg="[$ts] ERR($rc) @ ${loc_fn}:${loc_ln} :: ${cmd}"; if [[ -n "${LOGFILE:-}" ]]; then echo "$msg" >>"$LOGFILE"; else echo "$msg" >&2; fi; explain_err "$rc" "$cmd" "$loc_fn" "$loc_ln"' ERR
printf "\n"
printf "${bred}[$(date +'%Y-%m-%d %H:%M:%S')] Target: ${domain}\n\n"
diff --git a/modules/osint.sh b/modules/osint.sh
index 3e6856e..f700b50 100644
--- a/modules/osint.sh
+++ b/modules/osint.sh
@@ -20,7 +20,9 @@ function google_dorks() {
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $GOOGLE_DORKS == true ]] && [[ $OSINT == true ]]; then
start_func "${FUNCNAME[0]}" "Running: Google Dorks in process"
- "${tools}/dorks_hunter/venv/bin/python3" "${tools}/dorks_hunter/dorks_hunter.py" -d "$domain" -o "osint/dorks.txt"
+ if ! "${tools}/dorks_hunter/venv/bin/python3" "${tools}/dorks_hunter/dorks_hunter.py" -d "$domain" -o "osint/dorks.txt" 2>>"$LOGFILE"; then
+ printf "%b[!] dorks_hunter command failed.%b\n" "$bred" "$reset"
+ fi
end_func "Results are saved in $domain/osint/dorks.txt" "${FUNCNAME[0]}"
else
if [[ $GOOGLE_DORKS == false ]] || [[ $OSINT == false ]]; then
@@ -162,7 +164,13 @@ function metadata() {
return 1
}
- exiftool -r .tmp/metagoofil_${domain}/* 2>>"${LOGFILE}" | tee /dev/null | egrep -i "Author|Creator|Email|Producer|Template" | sort -u | anew -q "osint/metadata_results.txt"
+ # Check if exiftool is installed before running
+ if command -v exiftool &>/dev/null; then
+ exiftool -r .tmp/metagoofil_${domain}/* 2>>"${LOGFILE}" | tee /dev/null | egrep -i "Author|Creator|Email|Producer|Template" | sort -u | anew -q "osint/metadata_results.txt"
+ else
+ printf "%b[!] exiftool is not installed. Skipping metadata extraction.%b\n" "${bred}" "${reset}"
+ printf "exiftool not installed - metadata extraction skipped\n" >>"${LOGFILE}"
+ fi
end_func "Results are saved in ${domain}/osint/metadata_results.txt" "${FUNCNAME[0]}"
else
diff --git a/modules/subdomains.sh b/modules/subdomains.sh
index 9d69ae3..119dc9b 100644
--- a/modules/subdomains.sh
+++ b/modules/subdomains.sh
@@ -1040,8 +1040,17 @@ function sub_scraping() {
fi
fi
- cat .tmp/web_full_info1.txt .tmp/web_full_info2.txt .tmp/web_full_info3.txt 2>>"$LOGFILE" \
- | jq -s 'try .' | jq 'try unique_by(.input)' | jq 'try .[]' 2>>"$LOGFILE" >.tmp/web_full_info.txt
+ local webinfo_files=()
+ [[ -s ".tmp/web_full_info1.txt" ]] && webinfo_files+=(".tmp/web_full_info1.txt")
+ [[ -s ".tmp/web_full_info2.txt" ]] && webinfo_files+=(".tmp/web_full_info2.txt")
+ [[ -s ".tmp/web_full_info3.txt" ]] && webinfo_files+=(".tmp/web_full_info3.txt")
+
+ if [[ ${#webinfo_files[@]} -gt 0 ]]; then
+ cat "${webinfo_files[@]}" 2>>"$LOGFILE" \
+ | jq -s 'try .' | jq 'try unique_by(.input)' | jq 'try .[]' 2>>"$LOGFILE" >.tmp/web_full_info.txt
+ else
+ log_note "sub_scraping: web_full_info files missing/empty; skipping merge" "${FUNCNAME[0]}" "${LINENO}"
+ fi
end_subfunc "${NUMOFLINES} new subs (code scraping)" "${FUNCNAME[0]}"
@@ -1076,8 +1085,10 @@ function sub_analytics() {
start_subfunc "${FUNCNAME[0]}" "Running: Analytics Subdomain Enumeration"
if [[ -s ".tmp/probed_tmp_scrap.txt" ]]; then
- # Run analyticsrelationships and check for errors
- analyticsrelationships -ch <.tmp/probed_tmp_scrap.txt >>.tmp/analytics_subs_tmp.txt 2>>"$LOGFILE"
+ # Run analyticsrelationships and check for errors (tool may panic on empty input)
+ if ! analyticsrelationships -ch <.tmp/probed_tmp_scrap.txt >>.tmp/analytics_subs_tmp.txt 2>>"$LOGFILE"; then
+ printf "%b[!] analyticsrelationships failed (may need update: go install github.com/Josue87/analyticsrelationships@latest)%b\n" "$yellow" "$reset"
+ fi
if [[ -s ".tmp/analytics_subs_tmp.txt" ]]; then
grep "\.$domain$\|^$domain$" .tmp/analytics_subs_tmp.txt \
@@ -1996,7 +2007,7 @@ function s3buckets() {
printf "%b[!] Failed to cd to %s.%b\n" "$bred" "$tools/CloudHunter" "$reset"
return 1
fi
- if ! "${tools}/CloudHunter/venv/bin/python3" ./cloudhunter.py -p ${PERMUTATION_FLAG} -r ./resolvers.txt -t 50 "$domain"; then
+ if ! "${tools}/CloudHunter/venv/bin/python3" ./cloudhunter.py ${PERMUTATION_FLAG} -r ./resolvers.txt -t 50 "$domain"; then
printf "%b[!] CloudHunter command failed for domain %s.%b\n" "$bred" "$domain" "$reset"
fi
) >>"$dir/subdomains/cloudhunter_open_buckets.txt" 2>>"$LOGFILE"
diff --git a/modules/utils.sh b/modules/utils.sh
index cd4eb43..f313d26 100644
--- a/modules/utils.sh
+++ b/modules/utils.sh
@@ -179,6 +179,62 @@ function retry_with_backoff() {
return 1
}
+# Lightweight log helper for non-fatal explanations
+# Usage: log_note "message" [function] [line]
+function log_note() {
+ local msg="$1"
+ local fn="${2:-main}"
+ local ln="${3:-0}"
+ local ts
+ ts="$(date +'%Y-%m-%d %H:%M:%S')"
+ echo "[$ts] NOTE @ ${fn}:${ln} :: ${msg}" >>"${LOGFILE:-/dev/null}"
+}
+
+# Explain common non-fatal ERRs (e.g., anew -q with no new lines)
+# Usage: explain_err <rc> <cmd> <func> <line>
+function explain_err() {
+ local rc="$1"
+ local cmd="$2"
+ local fn="$3"
+ local ln="$4"
+
+ [[ $rc -ne 1 ]] && return 0
+
+ # Detect 'anew -q <target>' and emit a helpful note
+ if [[ $cmd =~ \banew[[:space:]]+-q[[:space:]]+([^[:space:]]+) ]]; then
+ local target="${BASH_REMATCH[1]}"
+
+ # Strip quotes
+ target="${target%\"}"
+ target="${target#\"}"
+ target="${target%\'}"
+ target="${target#\'}"
+
+ # Resolve variable references like $WAF_LIST or ${WAF_LIST}
+ if [[ $target =~ ^\\$\\{?([A-Za-z_][A-Za-z0-9_]*)\\}?$ ]]; then
+ local var="${BASH_REMATCH[1]}"
+ target="${!var}"
+ fi
+
+ if [[ -z "$target" ]]; then
+ log_note "anew returned no new lines (target unresolved)" "$fn" "$ln"
+ elif [[ ! -e "$target" ]]; then
+ log_note "anew target missing: $target (likely upstream produced no data)" "$fn" "$ln"
+ elif [[ ! -s "$target" ]]; then
+ log_note "anew target empty: $target (no new lines to add)" "$fn" "$ln"
+ else
+ log_note "anew returned no new lines for $target" "$fn" "$ln"
+ fi
+ return 0
+ fi
+
+ # Generic note for wc -l failures (often from missing input in pipelines)
+ if [[ $cmd =~ \bwc[[:space:]]+-l\b ]]; then
+ log_note "wc -l failed (likely upstream pipeline had no input or a missing file)" "$fn" "$ln"
+ return 0
+ fi
+}
+
# Check available disk space
# Usage: check_disk_space <required_gb> <path>
# Returns 0 if enough space, 1 otherwise
diff --git a/modules/web.sh b/modules/web.sh
index 12f5aa0..be250c9 100644
--- a/modules/web.sh
+++ b/modules/web.sh
@@ -983,9 +983,11 @@ function iishortname() {
-o "$dir/vulns/iis-shortname-shortscan/" 2>>"$LOGFILE" >/dev/null
# Remove non-vulnerable shortscan results
- find "$dir/vulns/iis-shortname-shortscan/" -type f -iname "*.txt" -print0 \
- | xargs --null grep -Z -L 'Vulnerable: Yes' \
- | xargs --null rm 2>>"$LOGFILE" >/dev/null
+ while IFS= read -r -d '' file; do
+ if ! grep -q 'Vulnerable: Yes' "$file" 2>/dev/null; then
+ rm -f "$file" 2>>"$LOGFILE"
+ fi
+ done < <(find "$dir/vulns/iis-shortname-shortscan/" -type f -iname "*.txt" -print0 2>/dev/null)
# Run sns using interlace
interlace -tL .tmp/iis_sites.txt -threads "$INTERLACE_THREADS" \
@@ -993,9 +995,11 @@ function iishortname() {
-o "$dir/vulns/iis-shortname-sns/" 2>>"$LOGFILE" >/dev/null
# Remove non-vulnerable sns results
- find "$dir/vulns/iis-shortname-sns/" -type f -iname "*.txt" -print0 \
- | xargs --null grep -Z 'Target is not vulnerable' \
- | xargs --null rm 2>>"$LOGFILE" >/dev/null
+ while IFS= read -r -d '' file; do
+ if grep -q 'Target is not vulnerable' "$file" 2>/dev/null; then
+ rm -f "$file" 2>>"$LOGFILE"
+ fi
+ done < <(find "$dir/vulns/iis-shortname-sns/" -type f -iname "*.txt" -print0 2>/dev/null)
fi
end_func "Results are saved in vulns/iis-shortname/" "${FUNCNAME[0]}"
@@ -1118,7 +1122,12 @@ function urlchecks() {
fi
if [[ $AXIOM != true ]]; then
- diff_webs=$(diff <(sort -u .tmp/probed_tmp.txt 2>>"$LOGFILE") <(sort -u webs/webs_all.txt 2>>"$LOGFILE") | wc -l)
+ if [[ -s ".tmp/probed_tmp.txt" && -s "webs/webs_all.txt" ]]; then
+ diff_webs=$(diff <(sort -u .tmp/probed_tmp.txt 2>>"$LOGFILE") <(sort -u webs/webs_all.txt 2>>"$LOGFILE") | wc -l)
+ else
+ log_note "urlchecks: missing .tmp/probed_tmp.txt or webs/webs_all.txt; skipping diff" "${FUNCNAME[0]}" "${LINENO}"
+ diff_webs=1
+ fi
if [[ $diff_webs != "0" ]] || [[ ! -s ".tmp/katana.txt" ]]; then
if [[ $URL_CHECK_ACTIVE == true ]]; then
# Split slow vs normal targets based on httpx status (403/429)
@@ -1174,7 +1183,12 @@ function urlchecks() {
fi
fi
else
- diff_webs=$(diff <(sort -u .tmp/probed_tmp.txt) <(sort -u webs/webs_all.txt) | wc -l)
+ if [[ -s ".tmp/probed_tmp.txt" && -s "webs/webs_all.txt" ]]; then
+ diff_webs=$(diff <(sort -u .tmp/probed_tmp.txt) <(sort -u webs/webs_all.txt) | wc -l)
+ else
+ log_note "urlchecks: missing .tmp/probed_tmp.txt or webs/webs_all.txt; skipping diff" "${FUNCNAME[0]}" "${LINENO}"
+ diff_webs=1
+ fi
if [[ $diff_webs != "0" ]] || [[ ! -s ".tmp/katana.txt" ]]; then
if [[ $URL_CHECK_ACTIVE == true ]]; then
if [[ $DEEP == true ]]; then
@@ -1334,7 +1348,10 @@ function url_ext() {
for t in "${ext[@]}"; do
# Extract unique matching URLs
- matches=$(grep -aEi "\.(${t})($|/|\?)" ".tmp/url_extract_tmp.txt" | sort -u | sed '/^$/d')
+ matches=$(
+ (grep -aEi "\.(${t})($|/|\?)" ".tmp/url_extract_tmp.txt" 2>>"$LOGFILE" || true) \
+ | sort -u | sed '/^$/d'
+ )
NUMOFLINES=$(echo "$matches" | wc -l)