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

Fixes

six2dez64a898a70d4b
diff --git a/modules/core.sh b/modules/core.sh
index 3cc8811..1052efa 100644
--- a/modules/core.sh
+++ b/modules/core.sh
@@ -1594,8 +1594,8 @@ function generate_consolidated_report() {
# Top assets from hotlist (if present)
if [[ -s hotlist.txt ]] && command -v jq >/dev/null 2>&1; then
top_assets_json=$(head -n "${HOTLIST_TOP:-50}" hotlist.txt \
- | awk '{score=$1;$1=""; sub(/^ /,"",$0); printf "{\"asset\":\"%s\",\"score\":%s}\n",$0,score}' \
- | jq -s '.')
+ | awk '{score=$1; $1=""; sub(/^ /,"",$0); print score "\t" $0}' \
+ | jq -Rn '[inputs | split("\t") | {asset: .[1], score: (.[0] | tonumber? // 0)}]')
else
top_assets_json="[]"
fi
@@ -1611,10 +1611,10 @@ function generate_consolidated_report() {
| awk -F'] ' '{
ts=$1; gsub(/^\[/,"",ts);
msg=$2;
- if (msg ~ /Start function:/) { print "{\"timestamp\":\"" ts "\",\"level\":\"INFO\",\"function\":\"" msg "\",\"message\":\"started\"}" }
- else if (msg ~ /End function:/) { print "{\"timestamp\":\"" ts "\",\"level\":\"SUCCESS\",\"function\":\"" msg "\",\"message\":\"completed\"}" }
+ if (msg ~ /Start function:/) { print ts "\tINFO\t" msg "\tstarted" }
+ else if (msg ~ /End function:/) { print ts "\tSUCCESS\t" msg "\tcompleted" }
}' \
- | jq -s '.')
+ | jq -Rn '[inputs | split("\t") | {timestamp: .[0], level: .[1], function: .[2], message: .[3]}]')
else
timeline_json="[]"
fi
diff --git a/modules/utils.sh b/modules/utils.sh
index c5b417b..9d13728 100644
--- a/modules/utils.sh
+++ b/modules/utils.sh
@@ -617,6 +617,19 @@ function sanitize_ip() {
return 0
}
+# Sanitize a single entry from a -l list file.
+# Detects IP/CIDR vs domain and applies the appropriate sanitizer.
+# Outputs the sanitized value; returns 1 if the entry is invalid.
+# Usage: domain=$(_sanitize_list_entry "$raw") || continue
+_sanitize_list_entry() {
+ local raw="$1"
+ if [[ "$raw" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(/[0-9]+)?$ ]]; then
+ sanitize_ip "$raw"
+ else
+ sanitize_domain "$raw"
+ fi
+}
+
###############################################################################################################
####################################### SECURITY CHECKS #######################################################
###############################################################################################################
diff --git a/modules/web.sh b/modules/web.sh
index daa2886..b8c8133 100644
--- a/modules/web.sh
+++ b/modules/web.sh
@@ -130,7 +130,7 @@ function webprobe_simple() {
local probe_first_line probe_is_json
probe_first_line="$(awk 'NF {print; exit}' .tmp/web_full_info_probe.txt 2>/dev/null || true)"
probe_is_json=false
- [[ "$probe_first_line" =~ ^[[:space:]]*\\{ ]] && probe_is_json=true
+ [[ "$probe_first_line" =~ ^[[:space:]]*\{ ]] && probe_is_json=true
# Always start fresh for this run (used by urlchecks diff too).
: >.tmp/probed_tmp.txt 2>/dev/null || true
@@ -141,7 +141,7 @@ function webprobe_simple() {
if ! cat .tmp/web_full_info_probe.txt .tmp/web_full_info.txt 2>>"$LOGFILE" \
| jq -cs 'unique_by(.input)[]' 2>>"$LOGFILE" >webs/web_full_info.txt; then
log_note "webprobe_simple: failed to merge httpx JSON; falling back to probe-only" "${FUNCNAME[0]}" "${LINENO}"
- awk 'match($0, /^[[:space:]]*\\{/) {print}' .tmp/web_full_info_probe.txt >.tmp/web_full_info_merge_input.jsonl 2>/dev/null || true
+ awk 'match($0, /^[[:space:]]*\{/) {print}' .tmp/web_full_info_probe.txt >.tmp/web_full_info_merge_input.jsonl 2>/dev/null || true
if [[ -s ".tmp/web_full_info_merge_input.jsonl" ]]; then
jq -cs 'unique_by(.input)[]' .tmp/web_full_info_merge_input.jsonl 2>>"$LOGFILE" >webs/web_full_info.txt || : >webs/web_full_info.txt
else
@@ -2007,7 +2007,7 @@ function wordlist_gen() {
start_func "${FUNCNAME[0]}" "Wordlist Generation"
- [[ -s ".tmp/url_extract_tmp.txt" ]] && cat webs/url_extract.txt | anew -q .tmp/url_extract_tmp.txt || true
+ [[ -s ".tmp/url_extract_tmp.txt" ]] && [[ -s "webs/url_extract.txt" ]] && cat webs/url_extract.txt | anew -q .tmp/url_extract_tmp.txt || true
# Ensure url_extract_tmp.txt exists and is not empty
if [[ -s ".tmp/url_extract_tmp.txt" ]]; then
# Define patterns for keys and values
diff --git a/reconftw.sh b/reconftw.sh
index b8c75aa..2996573 100755
--- a/reconftw.sh
+++ b/reconftw.sh
@@ -162,6 +162,7 @@ while true; do
fi
while IFS= read -r t; do
[[ -z "$t" ]] && continue
+ t=$(_sanitize_list_entry "$t") || continue
ipcidr_target "$t" "$list"
done <"$list"
shift 2
@@ -621,6 +622,7 @@ case $opt_mode in
sed_i 's/\r$//' "$flist"
while IFS= read -r domain <&3; do
[[ -z "$domain" ]] && continue
+ domain=$(_sanitize_list_entry "$domain") || continue
start
recon
end
@@ -642,6 +644,7 @@ case $opt_mode in
sed_i 's/\r$//' "$flist"
while IFS= read -r domain <&3; do
[[ -z "$domain" ]] && continue
+ domain=$(_sanitize_list_entry "$domain") || continue
subs_menu
done 3<"$flist"
else
@@ -656,6 +659,7 @@ case $opt_mode in
sed_i 's/\r$//' "$flist"
while IFS= read -r domain <&3; do
[[ -z "$domain" ]] && continue
+ domain=$(_sanitize_list_entry "$domain") || continue
passive
done 3<"$flist"
else
@@ -671,6 +675,7 @@ case $opt_mode in
sed_i 's/\r$//' "$flist"
while IFS= read -r domain <&3; do
[[ -z "$domain" ]] && continue
+ domain=$(_sanitize_list_entry "$domain") || continue
all
done 3<"$flist"
else
@@ -702,6 +707,7 @@ case $opt_mode in
sed_i 's/\r$//' "$flist"
while IFS= read -r domain <&3; do
[[ -z "$domain" ]] && continue
+ domain=$(_sanitize_list_entry "$domain") || continue
start
osint
end
@@ -720,6 +726,7 @@ case $opt_mode in
sed_i 's/\r$//' "$flist"
while IFS= read -r domain <&3; do
[[ -z "$domain" ]] && continue
+ domain=$(_sanitize_list_entry "$domain") || continue
zen_menu
done 3<"$flist"
else