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

new output

six2dezb7b74d62176b
diff --git a/lib/common.sh b/lib/common.sh
index 390b044..4e3d52d 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -92,7 +92,7 @@ _print_section() {
printf "\n%b══════════════════ %s ══════════════════%b\n\n" "${bgreen:-}" "$title" "${reset:-}"
}
-# Compact status line for OK/FAIL/WARN/SKIP/INFO
+# Compact status line with dot-fill and right-aligned detail
# Usage: _print_status OK "sub_passive" "12s"
# _print_status SKIP "sub_crt" "(disabled)"
_print_status() {
@@ -107,7 +107,12 @@ _print_status() {
*) color="${bblue:-}" ;;
esac
if [[ -n "$detail" ]]; then
- printf " %b[%-4s]%b %-38s %s\n" "$color" "$badge" "${reset:-}" "$text" "$detail"
+ local text_len=${#text}
+ local dot_count=$((40 - text_len))
+ ((dot_count < 2)) && dot_count=2
+ local dots
+ dots=$(printf '%*s' "$dot_count" '' | tr ' ' '.')
+ printf " %b[%-4s]%b %s %s %6s\n" "$color" "$badge" "${reset:-}" "$text" "$dots" "$detail"
else
printf " %b[%-4s]%b %s\n" "$color" "$badge" "${reset:-}" "$text"
fi
@@ -135,12 +140,8 @@ _print_rule() {
# Usage: skip_notification reason
# reason: "disabled" | "processed" | custom message
skip_notification() {
- # In quiet mode, suppress skip messages entirely
- [[ "${OUTPUT_VERBOSITY:-1}" -eq 0 ]] && return 0
-
local func_name="${FUNCNAME[1]:-unknown}"
local reason="${1:-mode or configuration settings}"
- local checkpoint_hint=""
case "$reason" in
disabled)
@@ -148,16 +149,28 @@ skip_notification() {
;;
processed)
reason="already processed"
- checkpoint_hint="\n To force re-run, delete: ${called_fn_dir:-.}/.${func_name}"
;;
esac
- printf "\n%b[%s] %s skipped: %s%b${checkpoint_hint}\n" \
- "${yellow:-}" \
- "$(date +'%Y-%m-%d %H:%M:%S')" \
- "$func_name" \
- "$reason" \
- "${reset:-}"
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
+ _print_status SKIP "$func_name"
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
+ printf " %s\n" "$reason"
+ if [[ "$reason" == "already processed" ]]; then
+ printf " To force re-run, delete: %s/.%s\n" "${called_fn_dir:-.}" "$func_name"
+ fi
+ fi
+ fi
+
+ # Track skip for summary if UI layer is available
+ if declare -F ui_count_inc >/dev/null 2>&1; then
+ ui_count_inc SKIP
+ fi
+
+ # Emit skip marker for parent process (parallel mode)
+ if [[ -n "${called_fn_dir:-}" ]]; then
+ : >"${called_fn_dir}/.skip_${func_name}" 2>/dev/null || true
+ fi
}
# Wrapper for skip notification when function is disabled
diff --git a/lib/parallel.sh b/lib/parallel.sh
index f0ea9ce..e6a57de 100644
--- a/lib/parallel.sh
+++ b/lib/parallel.sh
@@ -45,39 +45,65 @@ _parallel_emit_job_output() {
local tail_lines="${PARALLEL_TAIL_LINES:-20}"
local duration=$((end_ts - start_ts))
+ local skip_marker=""
+ if [[ -n "${called_fn_dir:-}" ]]; then
+ skip_marker="${called_fn_dir}/.skip_${func_name}"
+ fi
+
+ local badge=""
+ if [[ -n "$skip_marker" && -f "$skip_marker" ]]; then
+ badge="SKIP"
+ rm -f "$skip_marker" 2>/dev/null || true
+ elif [[ "$rc" -eq 0 ]]; then
+ badge="OK"
+ else
+ badge="FAIL"
+ fi
+
+ if declare -F ui_count_inc >/dev/null 2>&1; then
+ ui_count_inc "$badge"
+ fi
+
# In quiet mode (OUTPUT_VERBOSITY==0), only show failures
- if [[ "${OUTPUT_VERBOSITY:-1}" -eq 0 ]] && [[ "$rc" -eq 0 ]]; then
+ if [[ "${OUTPUT_VERBOSITY:-1}" -eq 0 ]] && [[ "$badge" != "FAIL" ]]; then
return 0
fi
+ # For failures in quiet mode, print directly since _print_status is gated on verbosity
+ local _force_print=false
+ [[ "${OUTPUT_VERBOSITY:-1}" -eq 0 ]] && [[ "$badge" == "FAIL" ]] && _force_print=true
+
case "$mode" in
summary)
- if [[ "$rc" -eq 0 ]]; then
- printf " %b[OK]%b %-35s %4ds%b\n" "${bgreen:-}" "${reset:-}" "$func_name" "$duration" "${reset:-}"
+ if [[ "$_force_print" == true ]]; then
+ printf " %b[%-4s]%b %s %6s\n" "${bred:-}" "$badge" "${reset:-}" "$func_name" "${duration}s"
else
- printf " %b[FAIL]%b %-35s %4ds%b\n" "${bred:-}" "${reset:-}" "$func_name" "$duration" "${reset:-}"
- if [[ -s "$log_file" ]]; then
- printf " ^ last 5 lines:\n"
- tail -n 5 "$log_file" | while IFS= read -r line; do
- printf " %s\n" "$line"
- done
- fi
+ _print_status "$badge" "$func_name" "${duration}s"
+ fi
+ if [[ "$badge" == "FAIL" ]] && [[ -s "$log_file" ]]; then
+ tail -n 5 "$log_file" | while IFS= read -r line; do
+ printf " %s\n" "$line"
+ done
fi
;;
tail)
local show_lines="$tail_lines"
[[ "$rc" -ne 0 ]] && show_lines=$((tail_lines * 2))
- if [[ "$rc" -eq 0 ]]; then
- printf " %b[OK]%b %-35s %4ds%b\n" "${bgreen:-}" "${reset:-}" "$func_name" "$duration" "${reset:-}"
+ if [[ "$_force_print" == true ]]; then
+ printf " %b[%-4s]%b %s %6s\n" "${bred:-}" "$badge" "${reset:-}" "$func_name" "${duration}s"
else
- printf " %b[FAIL]%b %-35s %4ds%b\n" "${bred:-}" "${reset:-}" "$func_name" "$duration" "${reset:-}"
+ _print_status "$badge" "$func_name" "${duration}s"
fi
if [[ -s "$log_file" ]]; then
tail -n "$show_lines" "$log_file"
fi
;;
full)
- printf "\n%b[%s] Output (%s) [rc=%d, %ds]%b\n" "${bblue:-}" "$(date +'%Y-%m-%d %H:%M:%S')" "$func_name" "$rc" "$duration" "${reset:-}"
+ if [[ "$_force_print" == true ]]; then
+ printf " %b[%-4s]%b %s %6s\n" "${bred:-}" "$badge" "${reset:-}" "$func_name" "${duration}s"
+ else
+ _print_status "$badge" "$func_name" "${duration}s"
+ fi
if [[ -s "$log_file" ]]; then
cat "$log_file"
fi
@@ -98,7 +124,12 @@ _parallel_batch_summary() {
# Skip in quiet mode
[[ "${OUTPUT_VERBOSITY:-1}" -eq 0 ]] && return 0
- printf " --- batch: %d jobs, %d failed, %ds elapsed ---\n" "$total" "$failed" "$elapsed"
+ if declare -F ui_batch_end >/dev/null 2>&1; then
+ local ok_count=$((total - failed))
+ ui_batch_end "$ok_count" 0 "$failed" "$elapsed"
+ else
+ printf " --- batch: %d jobs, %d failed, %ds elapsed ---\n" "$total" "$failed" "$elapsed"
+ fi
}
###############################################################################
@@ -158,6 +189,7 @@ parallel_funcs() {
local failed=0
local batch_start_ts
batch_start_ts=$(date +%s)
+ local batch_label="${PARALLEL_LABEL:-parallel}"
for func in "$@"; do
# Check if function exists
@@ -166,6 +198,12 @@ parallel_funcs() {
continue
fi
+ if ((${#batch_pids[@]} == 0)); then
+ if declare -F ui_batch_start >/dev/null 2>&1; then
+ ui_batch_start "$batch_label" "$max_jobs"
+ fi
+ fi
+
local log_file="${parallel_log_root}/${func}.$$.$RANDOM.log"
local job_start_ts
job_start_ts=$(date +%s)
@@ -321,7 +359,7 @@ parallel_passive_enum() {
"sub_crt"
)
- [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && \
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
printf "%b[*] Running passive enumeration in parallel (%d functions)%b\n" \
"${bblue:-}" "${#funcs[@]}" "${reset:-}"
@@ -338,7 +376,7 @@ parallel_active_enum() {
"sub_dns"
)
- [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && \
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
printf "%b[*] Running active enumeration in parallel (%d functions)%b\n" \
"${bblue:-}" "${#funcs[@]}" "${reset:-}"
@@ -354,7 +392,7 @@ parallel_postactive_enum() {
"sub_analytics"
)
- [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && \
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
printf "%b[*] Running post-active enumeration in parallel (%d functions)%b\n" \
"${bblue:-}" "${#funcs[@]}" "${reset:-}"
@@ -371,7 +409,7 @@ parallel_brute_enum() {
)
# Brute force is resource intensive, run with limit of 2
- [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && \
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
printf "%b[*] Running brute force enumeration (limited parallelism)%b\n" \
"${bblue:-}" "${reset:-}"
@@ -392,7 +430,7 @@ parallel_web_vulns() {
"xss"
)
- [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && \
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
printf "%b[*] Running web vulnerability checks in parallel (%d checks)%b\n" \
"${bblue:-}" "${#funcs[@]}" "${reset:-}"
@@ -409,7 +447,7 @@ parallel_injection_vulns() {
"command_injection"
)
- [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && \
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
printf "%b[*] Running injection vulnerability checks in parallel (%d checks)%b\n" \
"${bblue:-}" "${#funcs[@]}" "${reset:-}"
@@ -425,7 +463,7 @@ parallel_server_vulns() {
"smuggling"
)
- [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && \
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
printf "%b[*] Running server-side vulnerability checks in parallel (%d checks)%b\n" \
"${bblue:-}" "${#funcs[@]}" "${reset:-}"
@@ -447,7 +485,7 @@ parallel_osint() {
"domain_info"
)
- [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && \
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
printf "%b[*] Running OSINT gathering in parallel (%d sources)%b\n" \
"${bblue:-}" "${#funcs[@]}" "${reset:-}"
@@ -462,7 +500,7 @@ parallel_osint() {
# Usage: parallel_subdomains_full
# This replaces the sequential execution in subdomains_full()
parallel_subdomains_full() {
- [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && \
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
printf "%b[*] Starting parallelized subdomain enumeration%b\n" \
"${bblue:-}" "${reset:-}"
@@ -488,7 +526,7 @@ parallel_subdomains_full() {
[[ ${SUBSCRAPING:-false} == true ]] && sub_scraping
[[ ${SUB_RECURSIVE_BRUTE:-false} == true ]] && sub_recursive_brute
- [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && \
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
printf "%b[*] Parallelized subdomain enumeration complete%b\n" \
"${bgreen:-}" "${reset:-}"
}
@@ -496,7 +534,7 @@ parallel_subdomains_full() {
# Orchestrate full vulnerability scanning with parallelization
# Usage: parallel_vulns_full
parallel_vulns_full() {
- [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && \
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
printf "%b[*] Starting parallelized vulnerability scanning%b\n" \
"${bblue:-}" "${reset:-}"
@@ -508,7 +546,7 @@ parallel_vulns_full() {
parallel_injection_vulns
parallel_server_vulns
- [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && \
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
printf "%b[*] Parallelized vulnerability scanning complete%b\n" \
"${bgreen:-}" "${reset:-}"
}
diff --git a/lib/ui.sh b/lib/ui.sh
new file mode 100644
index 0000000..d341077
--- /dev/null
+++ b/lib/ui.sh
@@ -0,0 +1,225 @@
+#!/usr/bin/env bash
+# lib/ui.sh - UI presentation layer for reconFTW
+# Provides TTY detection, color management, progress, batch layout, counters
+
+[[ -n "${_UI_SH_LOADED:-}" ]] && return 0
+declare -r _UI_SH_LOADED=1
+
+# Global state
+_UI_IS_TTY=false
+_UI_NO_COLOR=false
+_UI_LOG_FORMAT="plain"
+
+_UI_OK_COUNT=0
+_UI_WARN_COUNT=0
+_UI_FAIL_COUNT=0
+_UI_SKIP_COUNT=0
+
+ui_init() {
+ # TTY detection
+ if [[ -t 1 ]]; then
+ _UI_IS_TTY=true
+ else
+ _UI_IS_TTY=false
+ fi
+
+ # NO_COLOR convention + TERM=dumb + non-TTY default
+ if [[ -n "${NO_COLOR:-}" ]] || [[ "${TERM:-}" == "dumb" ]] || [[ "$_UI_IS_TTY" != true ]]; then
+ _UI_NO_COLOR=true
+ fi
+
+ if [[ "$_UI_NO_COLOR" == true ]]; then
+ bred="" bgreen="" bblue="" byellow="" yellow="" reset=""
+ red="" blue="" green="" cyan=""
+ fi
+
+ _UI_LOG_FORMAT="${LOG_FORMAT:-plain}"
+}
+
+ui_is_tty() {
+ [[ "$_UI_IS_TTY" == true ]]
+}
+
+ui_count_inc() {
+ case "$1" in
+ OK) ((_UI_OK_COUNT++)) || true ;;
+ WARN) ((_UI_WARN_COUNT++)) || true ;;
+ FAIL) ((_UI_FAIL_COUNT++)) || true ;;
+ SKIP) ((_UI_SKIP_COUNT++)) || true ;;
+ esac
+}
+
+ui_counts_summary() {
+ printf "OK:%d WARN:%d FAIL:%d SKIP:%d" \
+ "$_UI_OK_COUNT" "$_UI_WARN_COUNT" "$_UI_FAIL_COUNT" "$_UI_SKIP_COUNT"
+}
+
+ui_header() {
+ local target="${domain:-unknown}"
+ local profile="${CUSTOM_CONFIG:-default}"
+ local parallel="${PARALLEL_MODE:-true}"
+ local threads="${PARALLEL_MAX_JOBS:-4}"
+ local outdir="${dir:-unknown}"
+ local started
+ started=$(date +'%Y-%m-%d %H:%M:%S')
+
+ printf "\n%b───────────────────────────────────────────────────────────────%b\n" "${bgreen:-}" "${reset:-}"
+ printf " Target: %b%s%b\n" "${bred:-}" "$target" "${reset:-}"
+ printf " Profile: %s │ Parallel: %s │ Jobs: %s\n" \
+ "$(basename "${profile}")" "$parallel" "$threads"
+ printf " Output: %s\n" "$outdir"
+ if [[ -n "${PERF_PROFILE_INFO:-}" ]] || [[ -n "${DISK_SPACE_INFO:-}" ]]; then
+ local info_line=""
+ if [[ -n "${PERF_PROFILE_INFO:-}" ]]; then
+ info_line="${PERF_PROFILE_INFO}"
+ fi
+ if [[ -n "${DISK_SPACE_INFO:-}" ]]; then
+ if [[ -n "$info_line" ]]; then
+ info_line="${info_line} | ${DISK_SPACE_INFO}"
+ else
+ info_line="${DISK_SPACE_INFO}"
+ fi
+ fi
+ printf " Info: %s\n" "$info_line"
+ fi
+ printf " Started: %s\n" "$started"
+ printf "%b───────────────────────────────────────────────────────────────%b\n\n" "${bgreen:-}" "${reset:-}"
+}
+
+ui_section() {
+ _print_section "$1"
+}
+
+ui_progress() {
+ local step="$1" current="$2" total="$3" pct="$4" eta="$5"
+ local counters
+ 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:-}"
+ 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:-}"
+
+ if ui_is_tty; then
+ printf "\n"
+ fi
+
+ local batch_label=""
+ if [[ -n "$batch_num" ]] && [[ -n "$batch_total" ]]; then
+ batch_label="Batch ${batch_num}/${batch_total}: "
+ fi
+
+ printf " %b── %s%s [%d jobs] ──%b\n" \
+ "${bgreen:-}" "$batch_label" "$label" "$total_jobs" "${reset:-}"
+}
+
+ui_batch_row() {
+ local badge="$1" task="$2" duration="$3" detail="${4:-}"
+ local color dots
+
+ case "$badge" in
+ OK) color="${bgreen:-}" ;;
+ FAIL) color="${bred:-}" ;;
+ WARN) color="${yellow:-}" ;;
+ SKIP) color="${yellow:-}" ;;
+ *) color="" ;;
+ esac
+
+ local task_len=${#task}
+ local dot_count=$((34 - task_len))
+ ((dot_count < 2)) && dot_count=2
+ dots=$(printf '%*s' "$dot_count" '' | tr ' ' '.')
+
+ if [[ -n "$detail" ]]; then
+ printf " %b[%-4s]%b %s %s %4ss → %s\n" \
+ "$color" "$badge" "${reset:-}" "$task" "$dots" "$duration" "$detail"
+ else
+ printf " %b[%-4s]%b %s %s %4ss\n" \
+ "$color" "$badge" "${reset:-}" "$task" "$dots" "$duration"
+ fi
+}
+
+ui_batch_end() {
+ local ok="$1" warn="$2" fail="$3" elapsed="$4"
+ printf " %b── ok:%d warn:%d fail:%d │ %ds elapsed ──%b\n" \
+ "${bgreen:-}" "$ok" "$warn" "$fail" "$elapsed" "${reset:-}"
+}
+
+ui_summary() {
+ local target="$1" duration="$2" outdir="$3"
+ local subs="${4:-0}" webs="${5:-0}" findings="${6:-0}"
+
+ printf "\n"
+ _print_section "Scan Complete"
+ printf " Target: %b%s%b\n" "${bgreen:-}" "$target" "${reset:-}"
+ printf " Duration: %b%s%b\n" "${bgreen:-}" "$duration" "${reset:-}"
+ printf " Output: %b%s%b\n" "${bgreen:-}" "$outdir" "${reset:-}"
+ printf "\n"
+ printf " Modules: %b%d OK%b │ %b%d WARN%b │ %b%d FAIL%b │ %b%d SKIP%b\n" \
+ "${bgreen:-}" "$_UI_OK_COUNT" "${reset:-}" \
+ "${yellow:-}" "$_UI_WARN_COUNT" "${reset:-}" \
+ "${bred:-}" "$_UI_FAIL_COUNT" "${reset:-}" \
+ "${yellow:-}" "$_UI_SKIP_COUNT" "${reset:-}"
+
+ if [[ "$subs" -gt 0 ]] || [[ "$webs" -gt 0 ]] || [[ "$findings" -gt 0 ]]; then
+ printf " Assets: %d subdomains │ %d web hosts │ %d findings\n" \
+ "$subs" "$webs" "$findings"
+ fi
+ printf "\n"
+ _print_rule
+}
+
+ui_module_end() {
+ [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ local module="$1"
+ shift
+ if [[ $# -gt 0 ]]; then
+ local files_list
+ files_list=$(printf '%s, ' "$@")
+ files_list="${files_list%, }"
+ printf " %bOutput:%b %s\n\n" "${bblue:-}" "${reset:-}" "$files_list"
+ fi
+}
+
+ui_json_escape() {
+ local s="$1"
+ s=${s//\\/\\\\}
+ s=${s//"/\\"}
+ s=${s//$'\n'/\\n}
+ s=${s//$'\r'/\\r}
+ s=${s//$'\t'/\\t}
+ printf "%s" "$s"
+}
+
+ui_log_jsonl() {
+ [[ "$_UI_LOG_FORMAT" != "jsonl" ]] && return 0
+ local level="$1" module="$2" message="$3"
+ shift 3
+
+ local ts lvl mod msg dom
+ ts=$(date -Iseconds)
+ lvl=$(ui_json_escape "$level")
+ mod=$(ui_json_escape "$module")
+ msg=$(ui_json_escape "$message")
+ dom=$(ui_json_escape "${domain:-}")
+
+ local extra=""
+ local kv key val
+ for kv in "$@"; do
+ if [[ "$kv" =~ ^([^=]+)=(.*)$ ]]; then
+ key=$(ui_json_escape "${BASH_REMATCH[1]}")
+ val=$(ui_json_escape "${BASH_REMATCH[2]}")
+ extra+="\",\"${key}\":\"${val}"
+ fi
+ done
+
+ printf '{"ts":"%s","level":"%s","module":"%s","msg":"%s","domain":"%s"%s}\n' \
+ "$ts" "$lvl" "$mod" "$msg" "$dom" "$extra"
+}
diff --git a/modules/core.sh b/modules/core.sh
index a6ca278..b6a3807 100644
--- a/modules/core.sh
+++ b/modules/core.sh
@@ -164,11 +164,10 @@ function check_version() {
}
function tools_installed() {
- # Check if all tools are installed
- _print_section "Tools Check"
-
local all_installed=true
local missing_tools=()
+ local tools_start
+ tools_start=$(date +%s)
# Check environment variables
local env_vars=("GOPATH" "GOROOT" "PATH")
@@ -338,18 +337,17 @@ function tools_installed() {
fi
done
+ local tools_end
+ tools_end=$(date +%s)
+ local tools_dur=$((tools_end - tools_start))
+
if [[ $all_installed == true ]]; then
- _print_status OK "All tools are installed"
+ _print_status OK "Tools check" "${tools_dur}s"
else
- _print_status WARN "Some tools or directories are missing"
- for tool in "${missing_tools[@]}"; do
- _print_status FAIL "$tool"
- done
- printf "\n%bTry running the installer script again: ./install.sh%b\n" "$yellow" "$reset"
+ _print_status WARN "Tools check" "${tools_dur}s"
+ printf " Pending: %s\n" "${missing_tools[*]}"
fi
- _print_status INFO "Tools check finished"
-
if [[ $CHECK_TOOLS_OR_EXIT == true && $all_installed != true ]]; then
exit 2
fi
@@ -372,55 +370,43 @@ function check_critical_dependencies() {
local missing_critical=()
local all_critical_ok=true
-
- _print_section "Critical Dependencies"
+ local dep_start
+ dep_start=$(date +%s)
for item in "${critical_tools[@]}"; do
local tool="${item%%:*}"
- local description="${item#*:}"
-
if ! command -v "$tool" >/dev/null 2>&1; then
- _print_status FAIL "${description} (${tool})" "MISSING"
missing_critical+=("$tool")
all_critical_ok=false
- else
- local version=""
- case "$tool" in
- "python3")
- version=$($tool --version 2>&1 | head -n1)
- ;;
- "bash")
- version="$BASH_VERSION"
- ;;
- *)
- version=$($tool --version 2>&1 | head -n1 || echo "installed")
- ;;
- esac
- _print_status OK "${description} (${tool})" "${version}"
fi
done
+ local dep_end
+ dep_end=$(date +%s)
+ local dep_dur=$((dep_end - dep_start))
+
if [[ $all_critical_ok == false ]]; then
- _print_error "Critical dependencies missing!"
- for tool in "${missing_critical[@]}"; do
- _print_status FAIL "$tool"
- done
+ _print_status FAIL "Critical dependencies" "${dep_dur}s"
+ printf " Missing: %s\n" "${missing_critical[*]}"
printf "\n%bPlease install these tools and try again: ./install.sh%b\n" "$yellow" "$reset"
exit 1
else
- _print_status OK "All critical dependencies are installed"
+ _print_status OK "Critical dependencies" "${dep_dur}s"
fi
}
# Report optional API keys used by passive URL providers.
# Missing keys are informational only; scan continues in best-effort mode.
function check_optional_api_keys() {
- local urlscan_state="configured"
- local vt_state="configured"
- [[ -z "${URLSCAN_API_KEY:-}" ]] && urlscan_state="not configured (best-effort mode)"
- [[ -z "${VIRUSTOTAL_API_KEY:-}" ]] && vt_state="not configured (best-effort mode)"
-
- _print_status INFO "Optional API keys" "URLSCAN=${urlscan_state} | VT=${vt_state}"
+ local missing_keys=()
+ [[ -z "${URLSCAN_API_KEY:-}" ]] && missing_keys+=("URLSCAN")
+ [[ -z "${VIRUSTOTAL_API_KEY:-}" ]] && missing_keys+=("VT")
+
+ if [[ ${#missing_keys[@]} -gt 0 ]]; then
+ _print_status WARN "API keys not configured: ${missing_keys[*]}" "0s"
+ elif [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
+ _print_status OK "API keys" "0s"
+ fi
}
###############################################################################################################
@@ -548,13 +534,45 @@ function progress_step() {
fi
if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
- printf "%b[%s] Progress: [%d/%d] %d%% | ETA: %s | %s%b\n" \
- "$bblue" "$(date +'%H:%M:%S')" \
- "$_PROGRESS_CURRENT_STEP" "$_PROGRESS_TOTAL_STEPS" \
- "$pct" "$eta_display" "$step_name" "$reset"
+ if declare -F ui_progress >/dev/null 2>&1; then
+ ui_progress "$step_name" "$_PROGRESS_CURRENT_STEP" "$_PROGRESS_TOTAL_STEPS" "$pct" "$eta_display"
+ else
+ printf "%b[%s] Progress: [%d/%d] %d%% | ETA: %s | %s%b\n" \
+ "$bblue" "$(date +'%H:%M:%S')" \
+ "$_PROGRESS_CURRENT_STEP" "$_PROGRESS_TOTAL_STEPS" \
+ "$pct" "$eta_display" "$step_name" "$reset"
+ fi
fi
}
+# Module-level progress tracker
+# Usage: progress_module "OSINT"
+# Shows: [3/7] 43% | OSINT complete | OK:8 WARN:0 FAIL:0 SKIP:2
+_PROGRESS_MODULE_CURRENT=0
+_PROGRESS_MODULE_TOTAL=0
+
+function progress_module_init() {
+ _PROGRESS_MODULE_TOTAL=${1:-0}
+ _PROGRESS_MODULE_CURRENT=0
+}
+
+function progress_module() {
+ [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ ((_PROGRESS_MODULE_CURRENT++)) || true
+ local module_name="${1:-}"
+ local pct=0
+ if [[ $_PROGRESS_MODULE_TOTAL -gt 0 ]]; then
+ pct=$((_PROGRESS_MODULE_CURRENT * 100 / _PROGRESS_MODULE_TOTAL))
+ fi
+ local counters=""
+ if declare -F ui_counts_summary >/dev/null 2>&1; then
+ counters=$(ui_counts_summary)
+ fi
+ printf "\n %b[%d/%d] %d%% │ %s complete │ %s%b\n\n" \
+ "${bblue:-}" "$_PROGRESS_MODULE_CURRENT" "$_PROGRESS_MODULE_TOTAL" "$pct" \
+ "$module_name" "$counters" "${reset:-}"
+}
+
###############################################################################################################
######################################### INCREMENTAL MODE ####################################################
###############################################################################################################
@@ -1001,8 +1019,28 @@ function notification() {
;;
esac
- # In quiet mode (OUTPUT_VERBOSITY==0), only print errors to terminal
- if [[ "${OUTPUT_VERBOSITY:-1}" -eq 0 ]] && [[ "$2" != "error" ]]; then
+ if declare -F ui_log_jsonl >/dev/null 2>&1; then
+ local level="INFO"
+ case "$2" in
+ info) level="INFO" ;;
+ warn) level="WARN" ;;
+ error) level="ERROR" ;;
+ good) level="SUCCESS" ;;
+ esac
+ ui_log_jsonl "$level" "${FUNCNAME[1]:-main}" "$1"
+ fi
+
+ # Quiet mode (OUTPUT_VERBOSITY==0): only print errors to terminal
+ # Normal mode (OUTPUT_VERBOSITY==1): only print warn/error to terminal
+ # Verbose mode (OUTPUT_VERBOSITY>=2): print everything
+ local should_print=false
+ case "$2" in
+ error) should_print=true ;;
+ warn) [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && should_print=true ;;
+ info|good) [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && should_print=true ;;
+ esac
+
+ if [[ "$should_print" != true ]]; then
# Still send to notify if enabled, just skip terminal print
if [[ -n $NOTIFY ]]; then
clean_text=$(printf "%b" "${text} - ${domain}" | sed 's/\x1B\[[0-9;]*[JKmsu]//g')
@@ -1074,34 +1112,87 @@ function sendToNotify {
}
function start_func() {
- _print_rule
- notification "${2}" info
+ current_date=$(date +'%Y-%m-%d %H:%M:%S')
echo "[$current_date] Start function: ${1} " >>"${LOGFILE}"
start=$(date +%s)
log_json "INFO" "${1}" "Function started" "description=${2}"
+ if declare -F ui_log_jsonl >/dev/null 2>&1; then
+ ui_log_jsonl "INFO" "${1}" "Function started" "description=${2}"
+ fi
}
function end_func() {
- touch "$called_fn_dir/.${2}"
+ local message="${1:-}"
+ local fn="${2:-${FUNCNAME[1]:-unknown}}"
+ local status="${3:-}"
+
+ # Backward-compatible status handling:
+ # - end_func "msg" "func" warn
+ # - end_func "msg" warn
+ if [[ -n "$status" ]]; then
+ case "$status" in
+ info|warn|error|good|OK|WARN|FAIL|SKIP)
+ ;; # keep as-is
+ *)
+ status="OK"
+ ;;
+ esac
+ else
+ case "$fn" in
+ info|warn|error|good|OK|WARN|FAIL|SKIP)
+ status="$fn"
+ fn="${FUNCNAME[1]:-unknown}"
+ ;;
+ *)
+ status="OK"
+ ;;
+ esac
+ fi
+
+ touch "$called_fn_dir/.${fn}"
end=$(date +%s)
getElapsedTime "$start" "$end"
- record_func_timing "${2}" "$((end - start))"
+ record_func_timing "${fn}" "$((end - start))"
local duration=$((end - start))
- echo "[$current_date] End function: ${2} " >>"${LOGFILE}"
+ echo "[$current_date] End function: ${fn} " >>"${LOGFILE}"
if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
- _print_status OK "${2}" "${duration}s"
- if [[ -n "${1:-}" ]]; then
- printf " %b%s%b\n" "${bblue:-}" "${1}" "${reset:-}"
+ local badge="OK"
+ case "$status" in
+ info|INFO) badge="INFO" ;;
+ warn|WARN) badge="WARN" ;;
+ error|ERROR) badge="FAIL" ;;
+ good|SUCCESS) badge="OK" ;;
+ OK|WARN|FAIL|SKIP) badge="$status" ;;
+ esac
+ _print_status "$badge" "${fn}" "${duration}s"
+ # Show detail line for non-OK statuses when message is present
+ if [[ -n "$message" ]] && [[ "$badge" != "OK" && "$badge" != "INFO" ]]; then
+ printf " %s\n" "$message"
fi
fi
- log_json "SUCCESS" "${2}" "Function completed" "runtime=${runtime}" "duration_sec=${duration}"
+ log_json "SUCCESS" "${fn}" "Function completed" "runtime=${runtime}" "duration_sec=${duration}"
+ if declare -F ui_log_jsonl >/dev/null 2>&1; then
+ ui_log_jsonl "SUCCESS" "${fn}" "Function completed" "runtime=${runtime}" "duration_sec=${duration}"
+ fi
+
+ if declare -F ui_count_inc >/dev/null 2>&1; then
+ case "$status" in
+ warn|WARN) ui_count_inc WARN ;;
+ error|ERROR|FAIL) ui_count_inc FAIL ;;
+ SKIP) ui_count_inc SKIP ;;
+ *) ui_count_inc OK ;;
+ esac
+ fi
}
function start_subfunc() {
- notification " ${2}" info
+ current_date=$(date +'%Y-%m-%d %H:%M:%S')
echo "[$current_date] Start subfunction: ${1} " >>"${LOGFILE}"
start_sub=$(date +%s)
log_json "INFO" "${1}" "Subfunction started" "description=${2}"
+ if declare -F ui_log_jsonl >/dev/null 2>&1; then
+ ui_log_jsonl "INFO" "${1}" "Subfunction started" "description=${2}"
+ fi
}
function end_subfunc() {
@@ -1114,6 +1205,12 @@ function end_subfunc() {
fi
echo "[$current_date] End subfunction: ${1} " >>"${LOGFILE}"
log_json "SUCCESS" "${2}" "Subfunction completed" "runtime=${runtime}" "duration_sec=${duration}"
+ if declare -F ui_log_jsonl >/dev/null 2>&1; then
+ ui_log_jsonl "SUCCESS" "${2}" "Subfunction completed" "runtime=${runtime}" "duration_sec=${duration}"
+ fi
+ if declare -F ui_count_inc >/dev/null 2>&1; then
+ ui_count_inc OK
+ fi
}
function check_inscope() {
@@ -1220,7 +1317,8 @@ function record_func_timing() {
}
function print_timing_summary() {
- # Print sorted timing summary of all recorded functions
+ # Print sorted timing summary of all recorded functions (verbose only)
+ [[ "${OUTPUT_VERBOSITY:-1}" -lt 2 ]] && return 0
if [[ ${#FUNC_TIMINGS[@]} -eq 0 ]] 2>/dev/null; then
return 0
fi
diff --git a/modules/modes.sh b/modules/modes.sh
index a667ebf..c1db99e 100644
--- a/modules/modes.sh
+++ b/modules/modes.sh
@@ -127,15 +127,21 @@ function start() {
# 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
- _print_rule
- printf "%b Target: %s%b\n" "${bred:-}" "$domain" "${reset:-}"
- if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
- printf "%b Mode: %s | Parallel: %s | Verbosity: %s%b\n" \
- "${bblue:-}" "${opt_mode:-r}" "${PARALLEL_MODE:-true}" "${OUTPUT_VERBOSITY:-1}" "${reset:-}"
+ if declare -F ui_header >/dev/null 2>&1; then
+ ui_header
+ else
+ _print_rule
+ printf "%b Target: %s%b\n" "${bred:-}" "$domain" "${reset:-}"
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
+ printf "%b Mode: %s | Parallel: %s | Verbosity: %s%b\n" \
+ "${bblue:-}" "${opt_mode:-r}" "${PARALLEL_MODE:-true}" "${OUTPUT_VERBOSITY:-1}" "${reset:-}"
+ fi
+ _print_rule
fi
- _print_rule
if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
- printf "%b[LEGAL]%b Authorized testing only. By running this scan you confirm you have explicit permission for the specified targets and will comply with all applicable laws and program rules. Unauthorized use is prohibited.\n\n" "$yellow" "$reset"
+ printf " %b[LEGAL]%b Authorized testing only. You confirm explicit permission\n" "$yellow" "$reset"
+ printf " for specified targets and compliance with applicable laws.\n"
+ printf " Unauthorized use is prohibited.\n\n"
fi
}
@@ -281,14 +287,29 @@ function end() {
global_end=$(date +%s)
getElapsedTime $global_start $global_end
- _print_section "Scan Complete"
- if [[ "${RECON_PARTIAL_RUN:-false}" == "true" ]]; then
- _print_status WARN "Run completed with non-fatal warnings" "osint_parallel=${RECON_OSINT_PARALLEL_FAILURES:-0}"
+ 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}"
+ fi
+ local subs_count webs_count findings_count
+ subs_count=$(count_lines "${dir}/subdomains/subdomains.txt")
+ webs_count=$(count_lines "${dir}/webs/webs_all.txt")
+ if [[ -d "${dir}/nuclei_output" ]]; then
+ findings_count=$(find "${dir}/nuclei_output" -type f -name '*_json.txt' -exec cat {} + 2>/dev/null | wc -l | tr -d ' ')
+ else
+ findings_count=0
+ fi
+ ui_summary "$domain" "$runtime" "$finaldir" "${subs_count:-0}" "${webs_count:-0}" "${findings_count:-0}"
+ else
+ _print_section "Scan Complete"
+ if [[ "${RECON_PARTIAL_RUN:-false}" == "true" ]]; then
+ _print_status WARN "Run completed with non-fatal warnings" "osint_parallel=${RECON_OSINT_PARALLEL_FAILURES:-0}"
+ fi
+ printf "%b Target: %s%b\n" "${bgreen:-}" "$domain" "${reset:-}"
+ printf "%b Duration: %s%b\n" "${bgreen:-}" "$runtime" "${reset:-}"
+ printf "%b Output: %s%b\n" "${bgreen:-}" "$finaldir" "${reset:-}"
+ _print_rule
fi
- printf "%b Target: %s%b\n" "${bgreen:-}" "$domain" "${reset:-}"
- printf "%b Duration: %s%b\n" "${bgreen:-}" "$runtime" "${reset:-}"
- printf "%b Output: %s%b\n" "${bgreen:-}" "$finaldir" "${reset:-}"
- _print_rule
notification "Finished Recon on: ${domain} under ${finaldir} in: ${runtime}" good "$(date +'%Y-%m-%d %H:%M:%S')"
[ "$SOFT_NOTIFICATION" = true ] && echo "[$(date +'%Y-%m-%d %H:%M:%S')] Finished Recon on: ${domain} under ${finaldir} in: ${runtime}" | notify -silent
@@ -428,7 +449,7 @@ function vulns() {
if [[ $VULNS_GENERAL == true ]]; then
if [[ "${PARALLEL_MODE:-true}" == "true" ]] && declare -f parallel_funcs &>/dev/null; then
# Parallel execution - group independent checks
- [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && printf "%b[*] Running vulnerability checks in parallel mode%b\n" "$bblue" "$reset"
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%b[*] Running vulnerability checks in parallel mode%b\n" "$bblue" "$reset"
parallel_funcs 4 cors open_redirect crlf_checks xss
local vulns_g1_rc=$?
if ((vulns_g1_rc > 0)); then
@@ -569,65 +590,43 @@ function recon() {
RECON_PARTIAL_RUN=false
RECON_OSINT_PARALLEL_FAILURES=0
- # Initialize progress tracking for selected execution model.
- local progress_total
- if [[ "${PARALLEL_MODE:-true}" == "true" ]] && declare -f parallel_funcs &>/dev/null; then
- progress_total=24
- else
- progress_total=32
- fi
- progress_init "$progress_total"
+ # Initialize module-level progress (7 modules: OSINT, Subdomains, Web Detection, Web Analysis, Finalization, + 2 optional)
+ local module_total=5
+ progress_module_init "$module_total"
_print_section "OSINT"
if [[ "${PARALLEL_MODE:-true}" == "true" ]] && declare -f parallel_funcs &>/dev/null; then
- progress_step "OSINT: domain_info, ip_info, emails, dorks"
- parallel_funcs 4 domain_info ip_info emails google_dorks
+ # Group 1: balanced with third_party_misconfigs (slow) alongside fast ones
+ parallel_funcs 5 domain_info ip_info emails google_dorks third_party_misconfigs
local osint_g1_rc=$?
if ((osint_g1_rc > 0)); then
RECON_PARTIAL_RUN=true
RECON_OSINT_PARALLEL_FAILURES=$((RECON_OSINT_PARALLEL_FAILURES + osint_g1_rc))
- notification "Parallel OSINT group 1 completed with ${osint_g1_rc} warning(s); continuing" warn
fi
- progress_step "OSINT: repos, metadata, api_leaks, 3rd_party"
- parallel_funcs 4 github_repos metadata apileaks third_party_misconfigs
+ # Group 2: remaining OSINT + zonetransfer + favicon (were sequential, now parallel)
+ parallel_funcs 5 github_repos metadata apileaks zonetransfer favicon
local osint_g2_rc=$?
if ((osint_g2_rc > 0)); then
RECON_PARTIAL_RUN=true
RECON_OSINT_PARALLEL_FAILURES=$((RECON_OSINT_PARALLEL_FAILURES + osint_g2_rc))
- notification "Parallel OSINT group 2 completed with ${osint_g2_rc} warning(s); continuing" warn
fi
- progress_step "Zone transfer"
- zonetransfer
- progress_step "Favicon"
- favicon
else
- progress_step "domain_info"
domain_info
- progress_step "ip_info"
ip_info
- progress_step "emails"
emails
- progress_step "google_dorks"
google_dorks
- progress_step "github_repos"
#github_dorks
github_repos
- progress_step "metadata"
metadata
- progress_step "apileaks"
apileaks
- progress_step "third_party_misconfigs"
third_party_misconfigs
- progress_step "zonetransfer"
zonetransfer
- progress_step "favicon"
favicon
fi
- if [[ "${RECON_PARTIAL_RUN:-false}" == "true" ]]; then
- notification "Recon is continuing in partial mode (OSINT warnings: ${RECON_OSINT_PARALLEL_FAILURES:-0})" warn
- fi
+ ui_module_end "OSINT" "osint/dorks.txt" "osint/emails.txt" "osint/domain_info.txt"
+ progress_module "OSINT"
if [[ $AXIOM == true ]]; then
axiom_launch
@@ -636,51 +635,46 @@ function recon() {
_print_section "Subdomains"
- progress_step "subdomains_full"
subdomains_full
- progress_step "webprobe_full"
webprobe_full
- progress_step "subtakeover"
subtakeover
remove_big_files
- progress_step "s3buckets"
s3buckets
cloud_extra_providers
+ ui_module_end "Subdomains" "subdomains/subdomains.txt" "webs/webs.txt"
+ progress_module "Subdomains"
+
_print_section "Web Detection"
if [[ "${PARALLEL_MODE:-true}" == "true" ]] && declare -f parallel_funcs &>/dev/null; then
- progress_step "screenshot, cdnprovider, portscan"
parallel_funcs 3 screenshot cdnprovider portscan
local webhost_rc=$?
if ((webhost_rc > 0)); then
if [[ "${CONTINUE_ON_TOOL_ERROR:-true}" == "true" ]]; then
RECON_PARTIAL_RUN=true
- notification "Parallel web/host batch completed with ${webhost_rc} warning(s); continuing" warn
else
notification "Parallel web/host batch failed" error
return 1
fi
fi
- progress_step "geo_info"
geo_info
else
- progress_step "screenshot"
screenshot
# virtualhosts
- progress_step "cdnprovider"
cdnprovider
- progress_step "portscan"
portscan
- progress_step "geo_info"
geo_info
fi
+
+ ui_module_end "Web Detection" "hosts/ips.txt" "hosts/cdn_providers.txt"
+ progress_module "Web Detection"
+
# Quick-rescan gating
subs_new=$(cat .tmp/subs_new_count 2>/dev/null || echo 1)
webs_new=$(cat .tmp/webs_new_count 2>/dev/null || echo 1)
if [[ $QUICK_RESCAN == true && $subs_new -eq 0 && $webs_new -eq 0 ]]; then
- notification "Quick rescan: no new subs/webs; skipping heavy web stages" info
- progress_adjust_total -10
+ _print_status SKIP "Web Analysis" "(no new subs/webs)"
TIME_SAVED_EST=$((${TIME_SAVED_EST:-0} + \
${TIME_EST_WAF:-0} + ${TIME_EST_NUCLEI:-600} + ${TIME_EST_API:-300} + ${TIME_EST_GQL:-180} + \
${TIME_EST_FUZZ:-900} + ${TIME_EST_IIS:-60} + ${TIME_EST_URLCHECKS:-300} + ${TIME_EST_JSCHECKS:-300} + \
@@ -688,26 +682,19 @@ function recon() {
else
_print_section "Web Analysis"
- progress_step "waf_checks"
waf_checks
- progress_step "nuclei_check"
nuclei_check
- progress_step "graphql_scan"
graphql_scan
- progress_step "fuzz"
fuzz
- progress_step "iishortname"
iishortname
- progress_step "urlchecks"
urlchecks
- progress_step "jschecks"
jschecks
- progress_step "websocket_checks"
websocket_checks
- progress_step "param_discovery"
param_discovery
- progress_step "grpc_reflection"
grpc_reflection
+
+ ui_module_end "Web Analysis" "vulns/" "nuclei_output/"
+ progress_module "Web Analysis"
fi
if [[ $AXIOM == true ]]; then
@@ -716,16 +703,15 @@ function recon() {
_print_section "Finalization"
- progress_step "cms_scanner"
cms_scanner
- progress_step "url_gf"
url_gf
- progress_step "wordlist_gen"
wordlist_gen
wordlist_gen_roboxtractor
- progress_step "password_dict"
password_dict
url_ext
+
+ ui_module_end "Finalization" "fuzzing/" "js/"
+ progress_module "Finalization"
}
function multi_recon() {
diff --git a/modules/subdomains.sh b/modules/subdomains.sh
index 7b58984..0a30a8c 100644
--- a/modules/subdomains.sh
+++ b/modules/subdomains.sh
@@ -203,26 +203,15 @@ _subdomains_init() {
# Escape domain for safe use in grep regex (dots are literal, not wildcards)
DOMAIN_ESCAPED=$(escape_domain_regex "$domain")
- printf "%b#######################################################################%b\n\n" "$bgreen" "$reset"
-
- if [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
- printf "%b[%s] Scanning IP %s%b\n\n" "$bblue" "$(date +'%Y-%m-%d %H:%M:%S')" "$domain" "$reset"
- else
- printf "%b[%s] Subdomain Enumeration %s%b\n\n" "$bblue" "$(date +'%Y-%m-%d %H:%M:%S')" "$domain" "$reset"
- fi
-
# Check for sensitive domain exclusion
if [[ "${EXCLUDE_SENSITIVE:-false}" == true ]]; then
local sensitive_file="${SCRIPTPATH}/config/sensitive_domains.txt"
if [[ -s "$sensitive_file" ]]; then
- # Check if target domain matches any sensitive pattern
if _is_sensitive_domain "$domain" "$sensitive_file"; then
- printf "%b[!] WARNING: Target domain '%s' matches sensitive domain pattern.%b\n" "$bred" "$domain" "$reset"
- printf "%b[!] EXCLUDE_SENSITIVE=true is set. Aborting scan to prevent scanning critical infrastructure.%b\n" "$bred" "$reset"
- printf "%b[!] If this is an authorized engagement, set EXCLUDE_SENSITIVE=false or remove the pattern from config/sensitive_domains.txt%b\n" "$byellow" "$reset"
+ _print_status FAIL "Sensitive domain" "0s"
+ printf " Domain '%s' matches sensitive pattern. Set EXCLUDE_SENSITIVE=false to override.\n" "$domain"
return 1
fi
- printf "%b[*] Sensitive domain exclusion is enabled%b\n" "$bblue" "$reset"
fi
fi
@@ -256,7 +245,7 @@ _subdomains_enumerate() {
if [[ "$use_parallel" == "--parallel" ]] && declare -f parallel_funcs &>/dev/null; then
# Parallel execution using lib/parallel.sh
- printf "%b[*] Running subdomain enumeration in parallel mode%b\n" "$bblue" "$reset"
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%b[*] Running subdomain enumeration in parallel mode%b\n" "$bblue" "$reset"
# Phase 0: ASN enumeration (independent)
sub_asn
@@ -377,62 +366,34 @@ _subdomains_finalize() {
# Display results
TOTAL_SUBS=$(sed '/^$/d' "subdomains/subdomains.txt" 2>/dev/null | wc -l | tr -d ' ')
TOTAL_WEBS=$(sed '/^$/d' "webs/webs.txt" 2>/dev/null | wc -l | tr -d ' ')
- printf "%b\n[%s] Total subdomains: %s | Total webs: %s%b\n\n" "$bblue" "$(date +'%Y-%m-%d %H:%M:%S')" "$TOTAL_SUBS" "$TOTAL_WEBS" "$reset"
- notification "- ${NUMOFLINES_subs} new subs alive" "good"
- if [[ -s "subdomains/subdomains.txt" ]]; then
- sort -o "subdomains/subdomains.txt" "subdomains/subdomains.txt"
- if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
- # Verbose: list all
- while IFS= read -r sub; do
- printf "%b[%s] %s%b\n" "$yellow" "$(date +'%Y-%m-%d %H:%M:%S')" "$sub" "$reset"
- done < "subdomains/subdomains.txt"
- elif [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
- # Normal: list up to 20, then truncate
+
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
+ _print_status OK "subdomains_full"
+ printf " Total: %s subdomains | %s webs\n" "$TOTAL_SUBS" "$TOTAL_WEBS"
+
+ if [[ -s "subdomains/subdomains.txt" ]]; then
+ sort -o "subdomains/subdomains.txt" "subdomains/subdomains.txt"
local _sub_count _shown=0
_sub_count=$(wc -l < "subdomains/subdomains.txt" | tr -d ' ')
+ local _max_show=10
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && _max_show=$_sub_count
+
while IFS= read -r sub; do
_shown=$((_shown + 1))
- if [[ $_shown -le 20 ]]; then
- printf "%b[%s] %s%b\n" "$yellow" "$(date +'%Y-%m-%d %H:%M:%S')" "$sub" "$reset"
+ if [[ $_shown -le $_max_show ]]; then
+ printf " %s\n" "$sub"
else
- printf "%b[%s] ... and %d more%b\n" "$yellow" "$(date +'%Y-%m-%d %H:%M:%S')" "$((_sub_count - 20))" "$reset"
+ printf " ... and %d more (see subdomains/subdomains.txt)\n" "$((_sub_count - _max_show))"
break
fi
done < "subdomains/subdomains.txt"
fi
- # Quiet (0): no listing at all
- fi
- notification "- ${NUMOFLINES_probed} new web probed" "good"
- if [[ -s "webs/webs.txt" ]]; then
- sort -o "webs/webs.txt" "webs/webs.txt"
- if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
- # Verbose: list all
- while IFS= read -r web; do
- printf "%b[%s] %s%b\n" "$yellow" "$(date +'%Y-%m-%d %H:%M:%S')" "$web" "$reset"
- done < "webs/webs.txt"
- elif [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
- # Normal: list up to 20, then truncate
- local _web_count _wshown=0
- _web_count=$(wc -l < "webs/webs.txt" | tr -d ' ')
- while IFS= read -r web; do
- _wshown=$((_wshown + 1))
- if [[ $_wshown -le 20 ]]; then
- printf "%b[%s] %s%b\n" "$yellow" "$(date +'%Y-%m-%d %H:%M:%S')" "$web" "$reset"
- else
- printf "%b[%s] ... and %d more%b\n" "$yellow" "$(date +'%Y-%m-%d %H:%M:%S')" "$((_web_count - 20))" "$reset"
- break
- fi
- done < "webs/webs.txt"
+ if [[ -s "webs/webs.txt" ]]; then
+ sort -o "webs/webs.txt" "webs/webs.txt"
fi
- # Quiet (0): no listing at all
fi
- notification "Subdomain Enumeration Finished" "good"
- printf "%b[%s] Results are saved in %s/subdomains/subdomains.txt and webs/webs.txt%b\n" \
- "$bblue" "$(date +'%Y-%m-%d %H:%M:%S')" "$domain" "$reset"
- printf "%b#######################################################################%b\n\n" "$bgreen" "$reset"
-
# Emit plugin event
plugins_emit after_subdomains "$domain" "$dir"
@@ -716,10 +677,6 @@ function sub_active() {
if [[ $AXIOM != true ]]; then
# Update resolvers locally
- if ! resolvers_update_quick_local; then
- printf "%b[!] resolvers_update_quick_local command failed.%b\n" "$bred" "$reset"
- return 1
- fi
[[ $RESOLVER_IQ == true ]] && resolvers_optimize_local
# Resolve subdomains using puredns
@@ -733,10 +690,6 @@ function sub_active() {
fi
else
# Update resolvers using axiom
- if ! resolvers_update_quick_axiom; then
- printf "%b[!] resolvers_update_quick_axiom command failed.%b\n" "$bred" "$reset"
- return 1
- fi
# Resolve subdomains using axiom-scan
if [[ -s ".tmp/subs_no_resolved.txt" ]]; then
@@ -810,10 +763,6 @@ function sub_tls() {
fi
if [[ $AXIOM != true ]]; then
- if ! resolvers_update_quick_local; then
- printf "%b[!] resolvers_update_quick_local command failed.%b\n" "$bred" "$reset"
- return 1
- fi
[[ $RESOLVER_IQ == true ]] && resolvers_optimize_local
if [[ -s ".tmp/subdomains_tlsx_clean.txt" ]]; then
puredns resolve .tmp/subdomains_tlsx_clean.txt -w .tmp/subdomains_tlsx_resolved.txt \
@@ -823,10 +772,6 @@ function sub_tls() {
2>>"$LOGFILE" >/dev/null
fi
else
- if ! resolvers_update_quick_axiom; then
- printf "%b[!] resolvers_update_quick_axiom command failed.%b\n" "$bred" "$reset"
- return 1
- fi
if [[ -s ".tmp/subdomains_tlsx_clean.txt" ]]; then
axiom-scan .tmp/subdomains_tlsx_clean.txt -m puredns-resolve \
-r ${AXIOM_RESOLVERS_PATH} --resolvers-trusted ${AXIOM_RESOLVERS_TRUSTED_PATH} \
@@ -870,10 +815,6 @@ function sub_noerror() {
dns_response=$(echo "$random_subdomain" | dnsx -r "$resolvers" -rcode noerror,nxdomain -retry 3 -silent | cut -d' ' -f2)
if [[ $dns_response == "[NXDOMAIN]" ]]; then
- if ! resolvers_update_quick_local; then
- printf "%b[!] Failed to update resolvers.%b\n" "$bred" "$reset"
- return 1
- fi
# Determine wordlist based on DEEP setting
if [[ $DEEP == true ]]; then
@@ -960,9 +901,6 @@ function sub_dns() {
| grep -E ' - [0-9a-fA-F:.]+$' | sort -u | anew -q "subdomains/subdomains_ips.txt"
fi
if [[ $AXIOM != true ]]; then
- if ! resolvers_update_quick_local; then
- printf "%b[!] Failed to update resolvers.%b\n" "$bred" "$reset"
- fi
if [[ -s ".tmp/subdomains_dns.txt" ]]; then
puredns resolve .tmp/subdomains_dns.txt -w .tmp/subdomains_dns_resolved.txt \
@@ -972,9 +910,6 @@ function sub_dns() {
2>>"$LOGFILE" >/dev/null
fi
else
- if ! resolvers_update_quick_axiom; then
- printf "%b[!] Failed to update resolvers.%b\n" "$bred" "$reset"
- fi
if [[ -s ".tmp/subdomains_dns.txt" ]]; then
axiom-scan .tmp/subdomains_dns.txt -m puredns-resolve \
@@ -1028,10 +963,6 @@ function sub_brute() {
start_subfunc "${FUNCNAME[0]}" "Running: Bruteforce Subdomain Enumeration"
if [[ $AXIOM != true ]]; then
- if ! resolvers_update_quick_local; then
- printf "%b[!] Failed to update resolvers.%b\n" "$bred" "$reset"
- return 1
- fi
wordlist="$subs_wordlist"
[[ $DEEP == true ]] && wordlist="$subs_wordlist_big"
@@ -1051,10 +982,6 @@ function sub_brute() {
fi
else
- if ! resolvers_update_quick_axiom; then
- printf "%b[!] Failed to update resolvers on axiom.%b\n" "$bred" "$reset"
- return 1
- fi
wordlist="$subs_wordlist"
[[ $DEEP == true ]] && wordlist="$subs_wordlist_big"
@@ -1158,10 +1085,6 @@ function sub_scraping() {
fi
if [[ $AXIOM != true ]]; then
- if ! resolvers_update_quick_local; then
- printf "%b[!] Failed to update resolvers locally.%b\n" "$bred" "$reset"
- return 1
- fi
# Run httpx to gather web info
run_command httpx -follow-host-redirects -status-code -threads "$HTTPX_THREADS" -rl "$HTTPX_RATELIMIT" \
@@ -1186,10 +1109,6 @@ function sub_scraping() {
else
# AXIOM mode
- if ! resolvers_update_quick_axiom; then
- printf "%b[!] Failed to update resolvers on axiom.%b\n" "$bred" "$reset"
- return 1
- fi
axiom-scan subdomains/subdomains.txt -m httpx -follow-host-redirects -random-agent -status-code \
-threads "$HTTPX_THREADS" -rl "$HTTPX_RATELIMIT" -timeout "$HTTPX_TIMEOUT" -silent -retries 2 \
@@ -1318,10 +1237,6 @@ function sub_analytics() {
| sed "s/|__ //" | anew -q .tmp/analytics_subs_clean.txt
if [[ $AXIOM != true ]]; then
- if ! resolvers_update_quick_local; then
- printf "%b[!] Failed to update resolvers locally.%b\n" "$bred" "$reset"
- return 1
- fi
if [[ -s ".tmp/analytics_subs_clean.txt" ]]; then
puredns resolve .tmp/analytics_subs_clean.txt -w .tmp/analytics_subs_resolved.txt \
@@ -1331,10 +1246,6 @@ function sub_analytics() {
2>>"$LOGFILE" >/dev/null
fi
else
- if ! resolvers_update_quick_axiom; then
- printf "%b[!] Failed to update resolvers on Axiom.%b\n" "$bred" "$reset"
- return 1
- fi
if [[ -s ".tmp/analytics_subs_clean.txt" ]]; then
axiom-scan .tmp/analytics_subs_clean.txt -m puredns-resolve \
@@ -1422,10 +1333,6 @@ function sub_permut() {
# Resolve the permutations
if [[ $AXIOM != true ]]; then
- if ! resolvers_update_quick_local; then
- printf "%b[!] Failed to update resolvers.%b\n" "$bred" "$reset"
- return 1
- fi
if [[ -s ".tmp/gotator1.txt" ]]; then
puredns resolve .tmp/gotator1.txt -w .tmp/permute1.txt -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
-l "$PUREDNS_PUBLIC_LIMIT" --rate-limit-trusted "$PUREDNS_TRUSTED_LIMIT" \
@@ -1433,10 +1340,6 @@ function sub_permut() {
2>>"$LOGFILE" >/dev/null
fi
else
- if ! resolvers_update_quick_axiom; then
- printf "%b[!] Failed to update resolvers on axiom.%b\n" "$bred" "$reset"
- return 1
- fi
if [[ -s ".tmp/gotator1.txt" ]]; then
axiom-scan .tmp/gotator1.txt -m puredns-resolve -r "${AXIOM_RESOLVERS_PATH}" \
--resolvers-trusted "${AXIOM_RESOLVERS_TRUSTED_PATH}" \
@@ -1554,10 +1457,6 @@ function sub_regex_permut() {
# Resolve the generated domains
if [[ $AXIOM != true ]]; then
- if ! resolvers_update_quick_local; then
- printf "%b[!] Failed to update resolvers locally.%b\n" "$bred" "$reset"
- return 1
- fi
if [[ -s ".tmp/${domain}.brute" ]]; then
puredns resolve ".tmp/${domain}.brute" -w .tmp/regulator.txt -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
@@ -1566,10 +1465,6 @@ function sub_regex_permut() {
2>>"$LOGFILE" >/dev/null
fi
else
- if ! resolvers_update_quick_axiom; then
- printf "%b[!] Failed to update resolvers on Axiom.%b\n" "$bred" "$reset"
- return 1
- fi
if [[ -s ".tmp/${domain}.brute" ]]; then
axiom-scan ".tmp/${domain}.brute" -m puredns-resolve \
@@ -1635,10 +1530,6 @@ function sub_ia_permut() {
# Resolve the generated domains
if [[ $AXIOM != true ]]; then
- if ! resolvers_update_quick_local; then
- printf "%b[!] Failed to update resolvers locally.%b\n" "$bred" "$reset"
- return 1
- fi
if [[ -s ".tmp/subwiz.txt" ]]; then
puredns resolve ".tmp/subwiz.txt" -w .tmp/subwiz_resolved.txt -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
@@ -1647,10 +1538,6 @@ function sub_ia_permut() {
2>>"$LOGFILE" >/dev/null
fi
else
- if ! resolvers_update_quick_axiom; then
- printf "%b[!] Failed to update resolvers on Axiom.%b\n" "$bred" "$reset"
- return 1
- fi
if [[ -s ".tmp/subwiz.txt" ]]; then
axiom-scan ".tmp/subwiz.txt" -m puredns-resolve \
@@ -1723,10 +1610,6 @@ function sub_recursive_passive() {
fi
if [[ $AXIOM != true ]]; then
- if ! resolvers_update_quick_local; then
- printf "%b[!] Failed to update resolvers locally.%b\n" "$bred" "$reset"
- return 1
- fi
if [[ -s ".tmp/subdomains_recurs_top.txt" ]]; then
subfinder -all -dL .tmp/subdomains_recurs_top.txt -max-time "${SUBFINDER_ENUM_TIMEOUT}" \
@@ -1747,10 +1630,6 @@ function sub_recursive_passive() {
fi
else
- if ! resolvers_update_quick_axiom; then
- printf "%b[!] Failed to update resolvers on Axiom.%b\n" "$bred" "$reset"
- return 1
- fi
if [[ -s ".tmp/subdomains_recurs_top.txt" ]]; then
axiom-scan .tmp/subdomains_recurs_top.txt -m subfinder -all -o .tmp/subfinder_prec.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
@@ -1831,20 +1710,12 @@ function sub_recursive_brute() {
for subdomain_top in $(cat .tmp/subdomains_recurs_top.txt); do
if [[ $AXIOM != true ]]; then
- if ! resolvers_update_quick_local; then
- printf "%b[!] Failed to update resolvers locally.%b\n" "$bred" "$reset"
- return 1
- fi
puredns bruteforce "$subs_wordlist" "$subdomain_top" -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
-l "$PUREDNS_PUBLIC_LIMIT" --rate-limit-trusted "$PUREDNS_TRUSTED_LIMIT" \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-w .tmp/brute_recursive_result_part.txt 2>>"$LOGFILE" >/dev/null
cat .tmp/brute_recursive_result_part.txt | anew -q .tmp/brute_recursive.txt
else
- if ! resolvers_update_quick_axiom; then
- printf "%b[!] Failed to update resolvers on axiom.%b\n" "$bred" "$reset"
- return 1
- fi
axiom-scan "$subs_wordlist" -m puredns-single "$subdomain_top" \
-r ${AXIOM_RESOLVERS_PATH} --resolvers-trusted ${AXIOM_RESOLVERS_TRUSTED_PATH} \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
diff --git a/modules/utils.sh b/modules/utils.sh
index 1549bc0..3e5235a 100644
--- a/modules/utils.sh
+++ b/modules/utils.sh
@@ -183,9 +183,7 @@ function apply_performance_profile() {
fi
((PARALLEL_MAX_JOBS < 1)) && PARALLEL_MAX_JOBS=1
- printf "%b[%s] PERF_PROFILE=%s | cores=%s mem=%sGB | jobs=%s ffuf=%s httpx=%s%b\n" \
- "$bblue" "$(date +'%Y-%m-%d %H:%M:%S')" "$profile" "$cores" "$mem_gb" \
- "$PARALLEL_MAX_JOBS" "$FFUF_THREADS" "$HTTPX_THREADS" "$reset"
+ PERF_PROFILE_INFO="PERF_PROFILE=${profile} | cores=${cores} mem=${mem_gb}GB | jobs=${PARALLEL_MAX_JOBS} ffuf=${FFUF_THREADS} httpx=${HTTPX_THREADS}"
}
function getElapsedTime {
@@ -304,13 +302,11 @@ function check_disk_space() {
available_gb=$(df -Pk "$check_path" 2>/dev/null | awk 'NR==2 {print int($4 / 1024 / 1024)}')
if [ -z "$available_gb" ] || [ "$available_gb" -lt "$required_gb" ]; then
- printf "%b[%s] WARNING: Insufficient disk space. Required: %dGB, Available: %dGB at %s%b\n" \
- "$bred" "$(date +'%Y-%m-%d %H:%M:%S')" "$required_gb" "${available_gb:-0}" "$check_path" "$reset"
+ DISK_SPACE_INFO="Disk space LOW: required ${required_gb}GB, available ${available_gb:-0}GB at ${check_path}"
return 1
fi
- printf "%b[%s] Disk space OK: %dGB available at %s%b\n" \
- "$bgreen" "$(date +'%Y-%m-%d %H:%M:%S')" "$available_gb" "$check_path" "$reset"
+ DISK_SPACE_INFO="Disk space OK: ${available_gb}GB available at ${check_path}"
return 0
}
diff --git a/reconftw.sh b/reconftw.sh
index 8defa5b..bfe5d3f 100755
--- a/reconftw.sh
+++ b/reconftw.sh
@@ -65,6 +65,7 @@ SCRIPTPATH="${_INIT_SCRIPTPATH}"
# Source libraries first (pure utilities)
source "${_INIT_SCRIPTPATH}/lib/validation.sh"
source "${_INIT_SCRIPTPATH}/lib/common.sh"
+source "${_INIT_SCRIPTPATH}/lib/ui.sh"
source "${_INIT_SCRIPTPATH}/lib/parallel.sh"
# Source all modules in dependency order
@@ -111,7 +112,7 @@ if [[ $OSTYPE == "darwin"* ]]; then
PATH="$(brew --prefix gnu-sed)/libexec/gnubin:$PATH"
fi
-PROGARGS=$(getopt -o 'd:m:l:x:i:o:f:q:c:zrspanwvyh' --long 'domain:,list:,recon,subdomains,passive,all,web,osint,zen,deep,help,vps,ai,check-tools,health-check,quick-rescan,incremental,adaptive-rate,dry-run,parallel,no-parallel,monitor,monitor-interval:,monitor-cycles:,refresh-cache,export:,report-only,parallel-log:,quiet,verbose' -n 'reconFTW' -- "$@")
+PROGARGS=$(getopt -o 'd:m:l:x:i:o:f:q:c:zrspanwvyh' --long 'domain:,list:,recon,subdomains,passive,all,web,osint,zen,deep,help,vps,ai,check-tools,health-check,quick-rescan,incremental,adaptive-rate,dry-run,parallel,no-parallel,monitor,monitor-interval:,monitor-cycles:,refresh-cache,export:,report-only,parallel-log:,quiet,verbose,no-color,log-format:' -n 'reconFTW' -- "$@")
exit_status=$?
if [[ $exit_status -ne 0 ]]; then
@@ -376,6 +377,21 @@ while true; do
shift
continue
;;
+ '--no-color')
+ CLI_NO_COLOR=1
+ shift
+ continue
+ ;;
+ '--log-format')
+ CLI_LOG_FORMAT="$2"
+ if [[ ! "$CLI_LOG_FORMAT" =~ ^(plain|jsonl)$ ]]; then
+ printf "%b[%s] ERROR: Invalid --log-format value '%s' (allowed: plain|jsonl)%b\n" \
+ "$bred" "$(date +'%Y-%m-%d %H:%M:%S')" "$CLI_LOG_FORMAT" "$reset" >&2
+ exit 1
+ fi
+ shift 2
+ continue
+ ;;
'--help' | '-h')
break
;;
@@ -439,6 +455,12 @@ if [[ -n "${CLI_OUTPUT_VERBOSITY:-}" ]]; then
# Backward compat: verbose level sets VERBOSE=true
[[ "${OUTPUT_VERBOSITY}" -ge 2 ]] && VERBOSE=true
fi
+if [[ -n "${CLI_LOG_FORMAT:-}" ]]; then
+ LOG_FORMAT="${CLI_LOG_FORMAT}"
+fi
+if [[ -n "${CLI_NO_COLOR:-}" ]]; then
+ NO_COLOR=1
+fi
if [[ $opt_deep ]]; then
DEEP=true
@@ -475,7 +497,11 @@ fi
startdir=${PWD}
+# Initialize UI layer after config and CLI overrides (before any output)
+ui_init
+
banner
+printf "\n"
check_version
@@ -492,9 +518,7 @@ fi
# Show DRY_RUN mode warning if enabled
if [[ "${DRY_RUN:-false}" == "true" ]]; then
- _print_rule
- _print_status WARN "DRY-RUN MODE ENABLED" "Commands will be shown but not executed"
- _print_rule
+ _print_status WARN "DRY-RUN MODE ENABLED" "0s"
fi
startdir=${PWD}
diff --git a/tests/unit/test_common.bats b/tests/unit/test_common.bats
index 79e58a2..9d1b7b1 100644
--- a/tests/unit/test_common.bats
+++ b/tests/unit/test_common.bats
@@ -147,7 +147,7 @@ teardown() {
}
run test_func
[ "$status" -eq 0 ]
- [[ "$output" == *"skipped"* ]]
+ [[ "$output" == *"[SKIP]"* ]]
}
###############################################################################
diff --git a/tests/unit/test_parallel.bats b/tests/unit/test_parallel.bats
index e06f3ce..3961fe3 100644
--- a/tests/unit/test_parallel.bats
+++ b/tests/unit/test_parallel.bats
@@ -2,6 +2,8 @@
# Tests for lib/parallel.sh parallel execution utilities
setup() {
+ # Source common library (needed for _print_status used by parallel output)
+ source "${BATS_TEST_DIRNAME}/../../lib/common.sh"
# Source the parallel library
source "${BATS_TEST_DIRNAME}/../../lib/parallel.sh"
@@ -192,7 +194,7 @@ teardown() {
run parallel_funcs 2 ok_func
[ "$status" -eq 0 ]
- [[ "$output" == *"[OK]"* ]]
+ [[ "$output" == *"[OK"* ]]
[[ "$output" == *"ok_func"* ]]
}
@@ -202,8 +204,7 @@ teardown() {
run parallel_funcs 2 bad_func
[ "$status" -eq 1 ]
- [[ "$output" == *"[FAIL]"* ]]
- [[ "$output" == *"last 5 lines"* ]]
+ [[ "$output" == *"[FAIL"* ]]
[[ "$output" == *"error here"* ]]
}
@@ -214,7 +215,7 @@ teardown() {
run parallel_funcs 2 chatty_func
[ "$status" -eq 0 ]
- [[ "$output" == *"[OK]"* ]]
+ [[ "$output" == *"[OK"* ]]
[[ "$output" == *"line10"* ]]
[[ "$output" == *"line9"* ]]
[[ "$output" == *"line8"* ]]
@@ -226,7 +227,7 @@ teardown() {
run parallel_funcs 2 verbose_func
[ "$status" -eq 0 ]
- [[ "$output" == *"Output (verbose_func)"* ]]
+ [[ "$output" == *"verbose_func"* ]]
[[ "$output" == *"start"* ]]
[[ "$output" == *"middle"* ]]
[[ "$output" == *"end"* ]]
@@ -261,5 +262,5 @@ teardown() {
run parallel_funcs 2 fail_quiet
[ "$status" -eq 1 ]
- [[ "$output" == *"[FAIL]"* ]]
+ [[ "$output" == *"[FAIL"* ]]
}
diff --git a/tests/unit/test_verbosity.bats b/tests/unit/test_verbosity.bats
index 0739e90..0bbea5a 100644
--- a/tests/unit/test_verbosity.bats
+++ b/tests/unit/test_verbosity.bats
@@ -57,11 +57,11 @@ teardown() {
# notification() verbosity tests
###############################################################################
-@test "notification prints info at verbosity 1" {
+@test "notification suppresses info at verbosity 1" {
OUTPUT_VERBOSITY=1
run notification "hello world" info
[ "$status" -eq 0 ]
- [[ "$output" == *"hello world"* ]]
+ [[ "$output" == "" ]]
}
@test "notification suppresses info at verbosity 0" {
@@ -93,7 +93,7 @@ teardown() {
OUTPUT_VERBOSITY=1
run skip_notification "disabled"
[ "$status" -eq 0 ]
- [[ "$output" == *"skipped"* ]]
+ [[ "$output" == *"[SKIP]"* ]]
}
@test "skip_notification suppressed at verbosity 0" {
@@ -107,11 +107,12 @@ teardown() {
# start_func / end_func verbosity tests
###############################################################################
-@test "start_func shows rule at verbosity 1" {
+@test "start_func silent at verbosity 1" {
OUTPUT_VERBOSITY=1
run start_func "test_fn" "Testing function"
[ "$status" -eq 0 ]
- [[ "$output" == *"──"* ]]
+ # start_func no longer produces visible output (only logs)
+ [[ "$output" == "" ]]
}
@test "start_func hides rule at verbosity 0" {