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

last fixes - maybe

six2dez76298d75cc06
diff --git a/lib/common.sh b/lib/common.sh
index 2647fa9..b400e28 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -109,10 +109,17 @@ format_duration() {
fi
}
+_ui_live_break_if_needed() {
+ if declare -F ui_live_progress_break >/dev/null 2>&1; then
+ ui_live_progress_break
+ fi
+}
+
# Print a normalized task/status line
# Usage: print_task STATE module duration_seconds reason
print_task() {
[[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ _ui_live_break_if_needed
local state="$1" module="$2" duration="${3:-0}" reason="${4:-}"
local color=""
local dim_color="${blue:-}"
@@ -244,6 +251,7 @@ _print_msg() {
return 0
fi
[[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ _ui_live_break_if_needed
printf "%b[%s]%b %s\n" "$color" "$level" "${reset:-}" "$msg"
}
@@ -251,6 +259,9 @@ _print_msg() {
# Usage: _print_module_start "OSINT"
_print_module_start() {
[[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ if declare -F ui_live_progress_end >/dev/null 2>&1; then
+ ui_live_progress_end
+ fi
local title="${1^^}"
local ts
ts=$(date +'%Y-%m-%d %H:%M:%S')
@@ -269,6 +280,9 @@ _print_module_start() {
# Usage: _print_module_end "OSINT"
_print_module_end() {
[[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ if declare -F ui_live_progress_end >/dev/null 2>&1; then
+ ui_live_progress_end
+ fi
local title="${1^^}"
local ts
ts=$(date +'%Y-%m-%d %H:%M:%S')
@@ -334,6 +348,7 @@ _print_status() {
# Usage: _print_error "something failed"
_print_error() {
local msg="$1"
+ _ui_live_break_if_needed
printf "%b[FAIL]%b %s\n" "${bred:-}" "${reset:-}" "$msg" >&2
}
@@ -490,6 +505,7 @@ run_with_heartbeat() {
fi
local start_ts now_ts elapsed last_hb
+ local use_live=false
start_ts=$(date +%s)
last_hb="$start_ts"
@@ -501,19 +517,43 @@ run_with_heartbeat() {
run_command "$@" >>"$hb_log" 2>&1 &
local cmd_pid=$!
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
+ if declare -F ui_is_tty >/dev/null 2>&1 && ui_is_tty && declare -F ui_live_progress_begin >/dev/null 2>&1; then
+ use_live=true
+ ui_live_progress_begin
+ if declare -F ui_live_progress_update >/dev/null 2>&1; then
+ ui_live_progress_update "Running: ${label} | elapsed 0s | ETA: --"
+ fi
+ else
+ printf "Started: %s\n" "$label"
+ fi
+ fi
+
while kill -0 "$cmd_pid" 2>/dev/null; do
sleep 1
now_ts=$(date +%s)
if ((now_ts - last_hb >= interval)); then
elapsed=$((now_ts - start_ts))
- if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
- _print_msg INFO "${label} still running (${elapsed}s elapsed)"
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && [[ "$use_live" == true ]] && declare -F ui_live_progress_update >/dev/null 2>&1; then
+ ui_live_progress_update "Running: ${label} | elapsed $(format_duration "$elapsed") | ETA: --"
fi
last_hb="$now_ts"
fi
done
wait "$cmd_pid"
+ local rc=$?
+ elapsed=$(($(date +%s) - start_ts))
+
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
+ if [[ "$use_live" == true ]] && declare -F ui_live_progress_end >/dev/null 2>&1; then
+ ui_live_progress_end
+ else
+ printf "Completed: %s (%s)\n" "$label" "$(format_duration "$elapsed")"
+ fi
+ fi
+
+ return "$rc"
}
# Shell-string variant for commands that require complex redirections.
diff --git a/lib/parallel.sh b/lib/parallel.sh
index 533b8a7..bb6f210 100644
--- a/lib/parallel.sh
+++ b/lib/parallel.sh
@@ -23,6 +23,12 @@ PARALLEL_TRACE_SLOW_SECONDS="${PARALLEL_TRACE_SLOW_SECONDS:-30}"
declare -a _PARALLEL_PIDS=()
_PARALLEL_LAST_BADGE=""
+_parallel_live_break() {
+ if declare -F ui_live_progress_break >/dev/null 2>&1; then
+ ui_live_progress_break
+ fi
+}
+
_parallel_get_ui_mode() {
case "${PARALLEL_UI_MODE:-clean}" in
clean|balanced|trace) printf "%s" "${PARALLEL_UI_MODE:-clean}" ;;
@@ -93,7 +99,7 @@ _parallel_snapshot() {
local elapsed_batch="${6:-0}"
[[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
- local mode active_max active_fmt done_fmt progress_pct eta="-"
+ local mode active_max active_fmt done_fmt progress_pct eta="--"
mode=$(_parallel_get_ui_mode)
active_max="${PARALLEL_PROGRESS_COMPACT_ACTIVE_MAX:-4}"
active_fmt=$(_parallel_compact_list "$active_list" "$active_max")
@@ -105,32 +111,36 @@ _parallel_snapshot() {
progress_pct=0
fi
- if [[ "${PARALLEL_PROGRESS_SHOW_ETA:-true}" == "true" ]] && ((done_count > 0)) && ((total_count > done_count)); then
+ if [[ "${PARALLEL_PROGRESS_SHOW_ETA:-true}" == "true" ]] && ((done_count >= 2)) && ((total_count > done_count)) && ((elapsed_batch >= 60)); then
local avg remaining eta_seconds
avg=$((elapsed_batch / done_count))
remaining=$((total_count - done_count))
eta_seconds=$((avg * remaining))
eta=$(format_duration "$eta_seconds")
- elif [[ "${PARALLEL_PROGRESS_SHOW_ETA:-true}" == "true" ]] && ((total_count > done_count)); then
- eta="calculating..."
- fi
-
- printf "Progress: %d/%d (%d%%) | elapsed %s" \
- "$done_count" "$total_count" "$progress_pct" "$(format_duration "$elapsed_batch")"
- if [[ "${PARALLEL_PROGRESS_SHOW_ETA:-true}" == "true" ]]; then
- printf " | ETA ~%s" "$eta"
- fi
- printf "\n"
-
- if [[ "${PARALLEL_PROGRESS_SHOW_ACTIVE:-true}" == "true" ]] && [[ "$active_fmt" != "none" || "$mode" == "trace" ]]; then
- printf "Active: %s\n" "$active_fmt"
fi
- if [[ "$mode" == "trace" ]]; then
- printf "Done: %s | Queue: %s pending\n" "$done_fmt" "$queue_count"
- else
+ if declare -F ui_is_tty >/dev/null 2>&1 && ui_is_tty && declare -F ui_live_progress_update >/dev/null 2>&1; then
+ local line
+ line=$(printf "Progress: %d/%d (%d%%) | elapsed %s" \
+ "$done_count" "$total_count" "$progress_pct" "$(format_duration "$elapsed_batch")")
+ if [[ "${PARALLEL_PROGRESS_SHOW_ETA:-true}" == "true" ]]; then
+ line="${line} | ETA: ${eta}"
+ fi
+ if [[ "${PARALLEL_PROGRESS_SHOW_ACTIVE:-true}" == "true" ]] && [[ "$active_fmt" != "none" || "$mode" == "trace" ]]; then
+ line="${line} | Active: ${active_fmt}"
+ fi
+ if [[ "$mode" == "trace" ]]; then
+ line="${line} | Done: ${done_fmt}"
+ fi
if [[ "$mode" != "clean" ]] || ((queue_count > 0)); then
- printf "Queue: %s pending\n" "$queue_count"
+ line="${line} | Queue: ${queue_count}"
+ fi
+ if declare -F ui_live_progress_begin >/dev/null 2>&1; then
+ ui_live_progress_begin
+ fi
+ ui_live_progress_update "$line"
+ if ((total_count > 0)) && ((done_count >= total_count)) && declare -F ui_live_progress_end >/dev/null 2>&1; then
+ ui_live_progress_end
fi
fi
}
@@ -385,6 +395,7 @@ parallel_funcs() {
# Log if verbose (OUTPUT_VERBOSITY >= 2)
if _parallel_should_show_started; then
+ _parallel_live_break
printf "%b[*] Started %s (PID: %d)%b\n" "${cyan:-}" "$func" "${batch_pids[${#batch_pids[@]}-1]}" "${reset:-}"
fi
@@ -467,6 +478,7 @@ parallel_funcs() {
done_list="${done_list}, ${batch_funcs[$idx]} ${dur_fmt}"
fi
if _parallel_should_show_finished "$rc" "$job_dur" "${_PARALLEL_LAST_BADGE:-OK}"; then
+ _parallel_live_break
printf "%b[*] Finished %s (PID: %s, rc=%s)%b\n" "${cyan:-}" "${batch_funcs[$idx]}" "${batch_pids[$idx]}" "$rc" "${reset:-}"
fi
rm -f "${batch_logs[$idx]}" 2>/dev/null || true
@@ -564,6 +576,7 @@ parallel_funcs() {
done_list="${done_list}, ${batch_funcs[$idx]} ${dur_fmt}"
fi
if _parallel_should_show_finished "$rc" "$job_dur" "${_PARALLEL_LAST_BADGE:-OK}"; then
+ _parallel_live_break
printf "%b[*] Finished %s (PID: %s, rc=%s)%b\n" "${cyan:-}" "${batch_funcs[$idx]}" "${batch_pids[$idx]}" "$rc" "${reset:-}"
fi
rm -f "${batch_logs[$idx]}" 2>/dev/null || true
diff --git a/lib/ui.sh b/lib/ui.sh
index 5fc4e52..0cb166f 100644
--- a/lib/ui.sh
+++ b/lib/ui.sh
@@ -21,6 +21,7 @@ _UI_DRYRUN_COUNT=0
_UI_DRYRUN_COMMANDS=()
_UI_DRYRUN_FULL_COMMANDS=()
_UI_DRYRUN_SHARED_FILE=""
+_UI_LIVE_ACTIVE=false
ui_init() {
# TTY detection
@@ -49,6 +50,36 @@ ui_is_tty() {
[[ "$_UI_IS_TTY" == true ]]
}
+ui_live_progress_begin() {
+ [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ ui_is_tty || return 0
+ _UI_LIVE_ACTIVE=true
+}
+
+ui_live_progress_update() {
+ [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ ui_is_tty || return 0
+ local line="$1"
+ _UI_LIVE_ACTIVE=true
+ printf "\r %b%s%b\033[K" "${bblue:-}" "$line" "${reset:-}"
+}
+
+ui_live_progress_break() {
+ [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ ui_is_tty || return 0
+ [[ "$_UI_LIVE_ACTIVE" == true ]] || return 0
+ printf "\r\033[K"
+}
+
+ui_live_progress_end() {
+ [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ ui_is_tty || return 0
+ if [[ "$_UI_LIVE_ACTIVE" == true ]]; then
+ printf "\r\033[K"
+ fi
+ _UI_LIVE_ACTIVE=false
+}
+
ui_count_inc() {
case "$1" in
OK) ((_UI_OK_COUNT++)) || true ;;
@@ -122,16 +153,16 @@ ui_progress() {
counters=$(ui_counts_summary)
if ui_is_tty; then
- printf "\r %b▸ [%d/%d] %d%% │ ETA: %s │ %s │ %s%b\033[K" \
- "${bblue:-}" "$current" "$total" "$pct" "$eta" "$step" "$counters" "${reset:-}"
+ ui_live_progress_begin
+ ui_live_progress_update "▸ [${current}/${total}] ${pct}% | ETA: ${eta} | ${step} | ${counters}"
else
- printf "[%s] [%d/%d] %d%% | ETA: %s | %s | %s\n" \
- "$(date +'%H:%M:%S')" "$current" "$total" "$pct" "$eta" "$step" "$counters"
+ :
fi
}
ui_batch_start() {
local label="$1" total_jobs="$2" batch_num="${3:-}" batch_total="${4:-}"
+ ui_live_progress_break
if ui_is_tty; then
printf "\n"
@@ -159,6 +190,7 @@ ui_batch_end() {
local ok="$1" warn="$2" fail="$3" elapsed="$4"
local skip="${5:-0}" cache="${6:-0}"
local completed="${7:-0}" total="${8:-0}"
+ ui_live_progress_break
printf " %b── ok:%d warn:%d fail:%d skip:%d cache:%d │ %d/%d completed │ %ds elapsed ──%b\n" \
"${bgreen:-}" "$ok" "$warn" "$fail" "$skip" "$cache" "$completed" "$total" "$elapsed" "${reset:-}"
}
@@ -169,6 +201,7 @@ ui_summary() {
local crit="${7:-0}" high="${8:-0}" med="${9:-0}" low="${10:-0}" info="${11:-0}"
local debug_log="${DEBUG_LOG:-}"
+ ui_live_progress_end
printf "\n"
printf "RESULTS %s\n" "$target"
printf "Mode: %s\n" "$mode_label"