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 UI, almost ready

six2dezd09440020279
diff --git a/banners.txt b/banners.txt
index d3aca0c..d0623f3 100644
--- a/banners.txt
+++ b/banners.txt
@@ -92,7 +92,4 @@ banner30="""
/ /_/ / __/ / / / / / / |/ / /_ / / | | /| / /
/ _, _/ /___/ /___/ /_/ / /| / __/ / / | |/ |/ /
/_/ |_/_____/\____/\____/_/ |_/_/ /_/ |__/|__/
- ╔══════════════════════════════════════════════╗
- ║ github.com/six2dez/reconftw | @six2dez ║
- ╚══════════════════════════════════════════════╝
"""
diff --git a/lib/common.sh b/lib/common.sh
index f0756ca..8de5f59 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -5,6 +5,8 @@
# Prevent multiple sourcing
[[ -n "$_COMMON_SH_LOADED" ]] && return 0
declare -r _COMMON_SH_LOADED=1
+declare -a INCIDENTS_LEVELS=()
+declare -a INCIDENTS_ITEMS=()
###############################################################################
# Directory Management
@@ -83,14 +85,147 @@ count_lines_stdin() {
# Output Primitives
###############################################################################
+# Format duration in seconds to human-friendly form: 0s, 6s, 1m 23s, 19m 04s
+# Usage: format_duration 83
+format_duration() {
+ local input="${1:-0}"
+ if [[ "$input" =~ [a-zA-Z] ]] && ! [[ "$input" =~ ^[0-9]+$ ]]; then
+ printf "%s" "$input"
+ return 0
+ fi
+ if [[ "$input" =~ ^[0-9]+s$ ]]; then
+ input="${input%s}"
+ fi
+ if ! [[ "$input" =~ ^[0-9]+$ ]]; then
+ input=0
+ fi
+ local total="$input"
+ local mins=$((total / 60))
+ local secs=$((total % 60))
+ if ((mins > 0)); then
+ printf "%dm %02ds" "$mins" "$secs"
+ else
+ printf "%ds" "$secs"
+ fi
+}
+
+# Print a normalized task/status line
+# Usage: print_task STATE module duration_seconds reason
+print_task() {
+ [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ local state="$1" module="$2" duration="${3:-0}" reason="${4:-}"
+ local color=""
+ local dim_color="${blue:-}"
+ local duration_fmt
+ duration_fmt=$(format_duration "$duration")
+
+ case "$state" in
+ OK) color="${bgreen:-}" ;;
+ WARN) color="${yellow:-}" ;;
+ FAIL) color="${bred:-}" ;;
+ SKIP|CACHE) color="${dim_color:-}" ;;
+ INFO) color="${bblue:-}" ;;
+ *) color="${bblue:-}" ;;
+ esac
+
+ local module_pad=26
+ local mod="$module"
+ local pad=$((module_pad - ${#mod}))
+ ((pad < 1)) && pad=1
+ local spaces
+ spaces=$(printf '%*s' "$pad" "")
+
+ printf "%b%-5s%b %s%s %6s" "$color" "$state" "${reset:-}" "$mod" "$spaces" "$duration_fmt"
+ if [[ -n "$reason" ]]; then
+ printf " (%s)" "$reason"
+ fi
+ printf "\n"
+}
+
+record_incident() {
+ local level="$1" module="$2" reason="$3"
+ [[ -z "$module" ]] && return 0
+ [[ -z "$reason" ]] && return 0
+ INCIDENTS_LEVELS+=("$level")
+ INCIDENTS_ITEMS+=("${module} — ${reason}")
+}
+
+print_incidents() {
+ local debug_log="${1:-}"
+ local count=${#INCIDENTS_ITEMS[@]}
+ ((count == 0)) && return 0
+ printf "\nINCIDENTS (actionable)\n"
+ local i
+ for i in "${!INCIDENTS_ITEMS[@]}"; do
+ printf "%d. %s\n" "$((i + 1))" "${INCIDENTS_ITEMS[$i]}"
+ done
+ if [[ -n "$debug_log" ]]; then
+ printf "Debug log: %s\n" "$debug_log"
+ fi
+ printf "\n"
+}
+
+# Print a compact artifacts line
+# Usage: print_artifacts "file1" ["file2"...]
+print_artifacts() {
+ [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ local items="$*"
+ [[ -z "$items" ]] && return 0
+ printf "Artifacts: %s\n" "$items"
+}
+
+# Print a notice line without affecting counters
+# Usage: print_notice LEVEL module message
+print_notice() {
+ local level="$1" module="$2" message="$3"
+ [[ -z "$module" ]] && module="notice"
+ print_task "$level" "$module" "0" "$message"
+}
+
+# Formatted WARN message without color codes
+# Usage: print_warnf "message %s" "arg"
+print_warnf() {
+ local fmt="$1"
+ shift
+ local msg
+ printf -v msg "$fmt" "$@"
+ _print_msg WARN "$msg"
+}
+
+# Formatted FAIL message (stderr, always visible)
+# Usage: print_errorf "message %s" "arg"
+print_errorf() {
+ local fmt="$1"
+ shift
+ local msg
+ printf -v msg "$fmt" "$@"
+ _print_error "$msg"
+}
+
# Generic message with [LEVEL] prefix (INFO/WARN/FAIL/OK)
# Usage: _print_msg WARN "something happened"
_print_msg() {
- [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
local level="$1"
shift
local msg="$*"
local color
+
+ if [[ "$level" == "WARN" ]]; then
+ if [[ "$msg" == *"already processed"* ]]; then
+ _print_status CACHE "${FUNCNAME[1]:-module}" "0s"
+ if [[ -n "${called_fn_dir:-}" ]]; then
+ : >"${called_fn_dir}/.cache_${FUNCNAME[1]:-module}" 2>/dev/null || true
+ fi
+ return 0
+ fi
+ if [[ "$msg" == *"skipped"* ]]; then
+ _print_status SKIP "${FUNCNAME[1]:-module}" "0s"
+ if [[ -n "${called_fn_dir:-}" ]]; then
+ : >"${called_fn_dir}/.skip_${FUNCNAME[1]:-module}" 2>/dev/null || true
+ fi
+ return 0
+ fi
+ fi
case "$level" in
OK|SUCCESS) color="${bgreen:-}" ;;
@@ -99,7 +234,10 @@ _print_msg() {
INFO) color="${bblue:-}" ;;
*) color="${bblue:-}" ;;
esac
-
+ if [[ "$level" == "INFO" ]] && [[ "${OUTPUT_VERBOSITY:-1}" -lt 2 ]]; then
+ return 0
+ fi
+ [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
printf "%b[%s]%b %s\n" "$color" "$level" "${reset:-}" "$msg"
}
@@ -110,8 +248,9 @@ _print_module_start() {
local title="${1^^}"
local ts
ts=$(date +'%Y-%m-%d %H:%M:%S')
- printf "\n%b── %s %s%b\n" "${bgreen:-}" "$title" "──────────────────────────────────────────────────────────────" "${reset:-}"
- _print_msg "INFO" "${title} started at ${ts}"
+ printf "\n%b── %s ───────────────────────────────────────────────────────────────%b\n" \
+ "${bgreen:-}" "$title" "${reset:-}"
+ printf "Started: %s\n" "$ts"
}
# Module end message with timestamp
@@ -121,7 +260,7 @@ _print_module_end() {
local title="${1^^}"
local ts
ts=$(date +'%Y-%m-%d %H:%M:%S')
- _print_msg "INFO" "${title} completed at ${ts}"
+ printf "Completed: %s\n" "$ts"
}
# Section header for major phases (OSINT, Subdomains, Web, Vulns, etc.)
@@ -136,43 +275,37 @@ _print_section() {
_print_status() {
[[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
local badge="$1" text="$2" detail="${3:-}"
- local color
-
- # Special handling for SKIP to be more discrete
- if [[ "$badge" == "SKIP" ]]; then
- local text_len=${#text}
- local dot_count=$((50 - text_len))
- ((dot_count < 2)) && dot_count=2
- local dots
- dots=$(printf '%*s' "$dot_count" '' | tr ' ' '.')
-
- # Grey/dim style for SKIP if supported, otherwise blue
- local skip_color="${bblue:-}"
-
- if [[ -n "$detail" ]]; then
- printf " %s %s %b[SKIP]%b %s\n" "$text" "$dots" "$skip_color" "${reset:-}" "$detail"
+ local duration="0"
+ local reason=""
+
+ if [[ -n "$detail" ]]; then
+ if [[ "$detail" =~ ^[0-9]+$ ]]; then
+ duration="$detail"
+ elif [[ "$detail" =~ ^[0-9]+s$ ]]; then
+ duration="${detail%s}"
+ elif [[ "$detail" =~ ^[0-9]+m ]]; then
+ duration="$detail"
else
- printf " %s %s %b[SKIP]%b\n" "$text" "$dots" "$skip_color" "${reset:-}"
+ reason="${detail}"
fi
- return
fi
- case "$badge" in
- OK) color="${bgreen:-}" ;;
- FAIL) color="${bred:-}" ;;
- WARN) color="${yellow:-}" ;;
- *) color="${bblue:-}" ;;
- esac
-
- if [[ -n "$detail" ]]; then
- 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"
+ if [[ "$badge" == "CACHE" ]] && [[ "${SHOW_CACHE:-false}" != "true" ]]; then
+ if declare -F ui_count_inc >/dev/null 2>&1; then
+ ui_count_inc "$badge"
+ fi
+ return 0
+ fi
+
+ if declare -F ui_count_inc >/dev/null 2>&1; then
+ ui_count_inc "$badge"
+ fi
+ print_task "$badge" "$text" "$duration" "$reason"
+ if [[ "$badge" == "FAIL" ]]; then
+ [[ -z "$reason" ]] && reason="see debug.log"
+ record_incident "FAIL" "$text" "$reason"
+ elif [[ "$badge" == "WARN" ]] && [[ -n "$reason" ]]; then
+ record_incident "WARN" "$text" "$reason"
fi
}
@@ -200,6 +333,7 @@ _print_rule() {
skip_notification() {
local func_name="${FUNCNAME[1]:-unknown}"
local reason="${1:-mode or configuration settings}"
+ local badge="SKIP"
case "$reason" in
disabled)
@@ -207,11 +341,12 @@ skip_notification() {
;;
processed)
reason="already processed"
+ badge="CACHE"
;;
esac
if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
- _print_status SKIP "$func_name"
+ _print_status "$badge" "$func_name" "0s"
if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
printf " %s\n" "$reason"
if [[ "$reason" == "already processed" ]]; then
@@ -220,14 +355,32 @@ skip_notification() {
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
+ if [[ "$badge" == "CACHE" ]]; then
+ : >"${called_fn_dir}/.cache_${func_name}" 2>/dev/null || true
+ else
+ : >"${called_fn_dir}/.skip_${func_name}" 2>/dev/null || true
+ fi
+ fi
+}
+
+# Compatibility: map pt_msg_warn to new status model
+pt_msg_warn() {
+ local msg="$*"
+ if [[ "$msg" == *"already processed"* ]]; then
+ _print_status CACHE "${FUNCNAME[1]:-module}" "0s"
+ if [[ -n "${called_fn_dir:-}" ]]; then
+ : >"${called_fn_dir}/.cache_${FUNCNAME[1]:-module}" 2>/dev/null || true
+ fi
+ elif [[ "$msg" == *"skipped"* ]]; then
+ _print_status SKIP "${FUNCNAME[1]:-module}" "0s"
+ if [[ -n "${called_fn_dir:-}" ]]; then
+ : >"${called_fn_dir}/.skip_${FUNCNAME[1]:-module}" 2>/dev/null || true
+ fi
+ else
+ _print_status WARN "${FUNCNAME[1]:-module}" "0s"
+ _print_msg WARN "$msg"
fi
}
diff --git a/lib/config.sh b/lib/config.sh
index ede9174..b7ee516 100644
--- a/lib/config.sh
+++ b/lib/config.sh
@@ -18,6 +18,23 @@ readonly E_CONFIG_NOT_FOUND=10
readonly E_CONFIG_INVALID=11
readonly E_CONFIG_SYNTAX=12
+# Local output helpers (prefer global UI if available)
+_cfg_warn() {
+ if declare -F print_warnf >/dev/null 2>&1; then
+ print_warnf "$@"
+ else
+ printf "[WARN] $1\n" "${@:2}" >&2
+ fi
+}
+
+_cfg_error() {
+ if declare -F print_errorf >/dev/null 2>&1; then
+ print_errorf "$@"
+ else
+ printf "[ERROR] $1\n" "${@:2}" >&2
+ fi
+}
+
# Configuration sections and their files
# Order matters - loaded in this sequence
declare -a CONFIG_SECTIONS=(
@@ -44,7 +61,7 @@ function load_config_hierarchical() {
# Validate config directory exists
if [[ ! -d "$config_dir" ]]; then
- printf "[ERROR] Configuration directory not found: %s\n" "$config_dir" >&2
+ _cfg_error "Configuration directory not found: %s" "$config_dir"
exit $E_CONFIG_NOT_FOUND
fi
@@ -63,12 +80,12 @@ function load_config_hierarchical() {
# Validate loaded configuration
if ! validate_config; then
- printf "[ERROR] Configuration validation failed\n" >&2
+ _cfg_error "Configuration validation failed"
errors=$((errors + 1))
fi
if [[ $errors -gt 0 ]]; then
- printf "[WARN] %d configuration errors detected\n" "$errors" >&2
+ _cfg_warn "%d configuration errors detected" "$errors"
return 1
fi
@@ -86,19 +103,19 @@ function _load_config_file() {
local perms
perms=$(stat -c "%a" "$conf_file" 2>/dev/null || stat -f "%Lp" "$conf_file" 2>/dev/null)
if [[ -n "$perms" && "$perms" -gt 644 ]]; then
- printf "[WARN] Config file has overly permissive permissions (%s): %s\n" "$perms" "$conf_file" >&2
+ _cfg_warn "Config file has overly permissive permissions (%s): %s" "$perms" "$conf_file"
fi
# Check for dangerous patterns before sourcing
if grep -qE '(eval[[:space:]]|\$\(.*\)|`.*`|rm[[:space:]]+-rf)' "$conf_file" 2>/dev/null; then
- printf "[ERROR] Config file contains potentially dangerous commands: %s\n" "$conf_file" >&2
+ _cfg_error "Config file contains potentially dangerous commands: %s" "$conf_file"
return $E_CONFIG_INVALID
fi
# Source the file with error handling
# shellcheck source=/dev/null
if ! source "$conf_file" 2>/dev/null; then
- printf "[ERROR] Failed to load config file: %s\n" "$conf_file" >&2
+ _cfg_error "Failed to load config file: %s" "$conf_file"
return $E_CONFIG_SYNTAX
fi
@@ -162,7 +179,7 @@ function _validate_config_var() {
# Boolean validation
if [[ "$var" =~ ^(OSINT|SUBDOMAINS_GENERAL|VULNS_GENERAL|DEEP|AXIOM|NOTIFICATION|FARADAY|INCREMENTAL_MODE|ADAPTIVE_RATE_LIMIT|STRUCTURED_LOGGING|ASSET_STORE|QUICK_RESCAN)$ ]]; then
if [[ ! "$value" =~ ^(true|false)$ ]]; then
- printf "[WARN] Invalid boolean value for %s: %s (expected true/false)\n" "$var" "$value" >&2
+ _cfg_warn "Invalid boolean value for %s: %s (expected true/false)" "$var" "$value"
return 1
fi
fi
@@ -170,7 +187,7 @@ function _validate_config_var() {
# Numeric validation
if [[ "$var" =~ _THREADS$|_RATELIMIT$|_TIMEOUT$ ]]; then
if [[ ! "$value" =~ ^[0-9]+$ ]]; then
- printf "[WARN] Invalid numeric value for %s: %s\n" "$var" "$value" >&2
+ _cfg_warn "Invalid numeric value for %s: %s" "$var" "$value"
return 1
fi
fi
@@ -188,7 +205,7 @@ function validate_config() {
# Check conflicting configurations
if [[ "${VULNS_GENERAL:-false}" == true && "${SUBDOMAINS_GENERAL:-false}" == false ]]; then
- printf "[WARN] VULNS_GENERAL=true but SUBDOMAINS_GENERAL=false\n" >&2
+ _cfg_warn "VULNS_GENERAL=true but SUBDOMAINS_GENERAL=false"
warnings=$((warnings + 1))
fi
@@ -207,7 +224,7 @@ function validate_config() {
local var_value
var_value="${!var:-}"
if [[ -n "$var_value" && ! "$var_value" =~ ^[0-9]+$ ]]; then
- printf "[ERROR] %s must be numeric, got: %s\n" "$var" "$var_value" >&2
+ _cfg_error "%s must be numeric, got: %s" "$var" "$var_value"
errors=$((errors + 1))
fi
done
@@ -216,7 +233,7 @@ function validate_config() {
if [[ "${ADAPTIVE_RATE_LIMIT:-false}" == true ]]; then
if [[ -n "${MIN_RATE_LIMIT:-}" && -n "${MAX_RATE_LIMIT:-}" ]]; then
if [[ $MIN_RATE_LIMIT -gt $MAX_RATE_LIMIT ]]; then
- printf "[ERROR] MIN_RATE_LIMIT > MAX_RATE_LIMIT\n" >&2
+ _cfg_error "MIN_RATE_LIMIT > MAX_RATE_LIMIT"
errors=$((errors + 1))
fi
fi
@@ -225,13 +242,13 @@ function validate_config() {
# Validate Axiom configuration
if [[ "${AXIOM:-false}" == true ]]; then
if ! command -v axiom-scan &>/dev/null; then
- printf "[WARN] AXIOM=true but axiom-scan not found\n" >&2
+ _cfg_warn "AXIOM=true but axiom-scan not found"
warnings=$((warnings + 1))
fi
fi
if [[ $errors -gt 0 ]]; then
- printf "[ERROR] Configuration validation failed\n" >&2
+ _cfg_error "Configuration validation failed"
return 1
fi
@@ -260,7 +277,7 @@ function migrate_legacy_config() {
local new_config_dir="${2:-$RECONFTW_CONFIG_DIR}"
if [[ ! -f "$old_config" ]]; then
- printf "[ERROR] Legacy config file not found: %s\n" "$old_config" >&2
+ _cfg_error "Legacy config file not found: %s" "$old_config"
return 1
fi
diff --git a/lib/parallel.sh b/lib/parallel.sh
index ce0ff98..1371af1 100644
--- a/lib/parallel.sh
+++ b/lib/parallel.sh
@@ -29,6 +29,36 @@ _parallel_effective_max_jobs() {
echo "$effective"
}
+_parallel_compact_list() {
+ local max="${2:-6}"
+ local list="$1"
+ if [[ -z "$list" ]]; then
+ printf "none"
+ return 0
+ fi
+ local count
+ count=$(awk -F',' 'NF{print NF}' <<<"$list")
+ if ((count <= max)); then
+ printf "%s" "$list"
+ else
+ local trimmed
+ trimmed=$(echo "$list" | awk -F',' -v m="$max" '{out=""; for(i=1;i<=m;i++){out=out $i (i<m? ",":"")} print out}')
+ printf "%s, +%d more" "$trimmed" "$((count - max))"
+ fi
+}
+
+_parallel_snapshot() {
+ local active_list="$1"
+ local done_list="$2"
+ local queue_count="$3"
+ [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ local active_fmt done_fmt
+ active_fmt=$(_parallel_compact_list "$active_list" 6)
+ done_fmt=$(_parallel_compact_list "$done_list" 6)
+ printf "Active: %s\n" "$active_fmt"
+ printf "Done: %s | Queue: %s pending\n" "$done_fmt" "$queue_count"
+}
+
###############################################################################
# Output Helpers
###############################################################################
@@ -46,12 +76,17 @@ _parallel_emit_job_output() {
local duration=$((end_ts - start_ts))
local skip_marker=""
+ local cache_marker=""
if [[ -n "${called_fn_dir:-}" ]]; then
skip_marker="${called_fn_dir}/.skip_${func_name}"
+ cache_marker="${called_fn_dir}/.cache_${func_name}"
fi
local badge=""
- if [[ -n "$skip_marker" && -f "$skip_marker" ]]; then
+ if [[ -n "$cache_marker" && -f "$cache_marker" ]]; then
+ badge="CACHE"
+ rm -f "$cache_marker" 2>/dev/null || true
+ elif [[ -n "$skip_marker" && -f "$skip_marker" ]]; then
badge="SKIP"
rm -f "$skip_marker" 2>/dev/null || true
elif [[ "$rc" -eq 0 ]]; then
@@ -60,10 +95,6 @@ _parallel_emit_job_output() {
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 ]] && [[ "$badge" != "FAIL" ]]; then
return 0
@@ -76,11 +107,14 @@ _parallel_emit_job_output() {
case "$mode" in
summary)
if [[ "$_force_print" == true ]]; then
- printf " %b[%-4s]%b %s %6s\n" "${bred:-}" "$badge" "${reset:-}" "$func_name" "${duration}s"
+ if declare -F ui_count_inc >/dev/null 2>&1; then
+ ui_count_inc "$badge"
+ fi
+ print_task "$badge" "$func_name" "$duration" ""
else
_print_status "$badge" "$func_name" "${duration}s"
fi
- if [[ "$badge" == "FAIL" ]] && [[ -s "$log_file" ]]; then
+ if [[ "$badge" == "FAIL" ]] && [[ -s "$log_file" ]] && [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
tail -n 5 "$log_file" | while IFS= read -r line; do
printf " %s\n" "$line"
done
@@ -90,7 +124,10 @@ _parallel_emit_job_output() {
local show_lines="$tail_lines"
[[ "$rc" -ne 0 ]] && show_lines=$((tail_lines * 2))
if [[ "$_force_print" == true ]]; then
- printf " %b[%-4s]%b %s %6s\n" "${bred:-}" "$badge" "${reset:-}" "$func_name" "${duration}s"
+ if declare -F ui_count_inc >/dev/null 2>&1; then
+ ui_count_inc "$badge"
+ fi
+ print_task "$badge" "$func_name" "$duration" ""
else
_print_status "$badge" "$func_name" "${duration}s"
fi
@@ -100,7 +137,10 @@ _parallel_emit_job_output() {
;;
full)
if [[ "$_force_print" == true ]]; then
- printf " %b[%-4s]%b %s %6s\n" "${bred:-}" "$badge" "${reset:-}" "$func_name" "${duration}s"
+ if declare -F ui_count_inc >/dev/null 2>&1; then
+ ui_count_inc "$badge"
+ fi
+ print_task "$badge" "$func_name" "$duration" ""
else
_print_status "$badge" "$func_name" "${duration}s"
fi
@@ -192,11 +232,14 @@ parallel_funcs() {
local batch_start_ts
batch_start_ts=$(date +%s)
local batch_label="${PARALLEL_LABEL:-parallel}"
+ local total_funcs=$#
+ local queued_count=0
+ local done_list=""
for func in "$@"; do
# Check if function exists
if ! declare -f "$func" >/dev/null 2>&1; then
- printf "%b[!] Function %s not found, skipping%b\n" "${yellow:-}" "$func" "${reset:-}" >&2
+ print_warnf "Function %s not found, skipping" "$func"
continue
fi
@@ -221,6 +264,7 @@ parallel_funcs() {
batch_funcs+=("$func")
batch_logs+=("$log_file")
batch_starts+=("$job_start_ts")
+ queued_count=$((queued_count + 1))
# Log if verbose (OUTPUT_VERBOSITY >= 2)
[[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
@@ -228,6 +272,15 @@ parallel_funcs() {
# If we've reached max jobs, flush the current batch.
if ((${#batch_pids[@]} >= max_jobs)); then
+ if [[ "${PARALLEL_MODE:-true}" == "true" ]]; then
+ local active_list=""
+ local i
+ for i in "${batch_funcs[@]}"; do
+ [[ -z "$active_list" ]] && active_list="${i} 00:00" || active_list="${active_list}, ${i} 00:00"
+ done
+ local queue_count=$((total_funcs - queued_count))
+ _parallel_snapshot "$active_list" "$done_list" "$queue_count"
+ fi
local idx rc batch_failed=0
for idx in "${!batch_pids[@]}"; do
if wait "${batch_pids[$idx]}" 2>/dev/null; then
@@ -238,6 +291,14 @@ parallel_funcs() {
local job_end_ts
job_end_ts=$(date +%s)
_parallel_emit_job_output "${batch_funcs[$idx]}" "${batch_logs[$idx]}" "$rc" "${batch_starts[$idx]}" "$job_end_ts"
+ local job_dur=$((job_end_ts - batch_starts[$idx]))
+ local dur_fmt
+ dur_fmt=$(format_duration "$job_dur")
+ if [[ -z "$done_list" ]]; then
+ done_list="${batch_funcs[$idx]} ${dur_fmt}"
+ else
+ done_list="${done_list}, ${batch_funcs[$idx]} ${dur_fmt}"
+ fi
[[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%b[*] Finished %s (PID: %s, rc=%s)%b\n" "${cyan:-}" "${batch_funcs[$idx]}" "${batch_pids[$idx]}" "$rc" "${reset:-}"
if [[ $rc -ne 0 ]]; then
((failed++))
@@ -246,6 +307,10 @@ parallel_funcs() {
rm -f "${batch_logs[$idx]}" 2>/dev/null || true
done
_parallel_batch_summary "${#batch_pids[@]}" "$batch_failed" "$batch_start_ts"
+ if [[ "${PARALLEL_MODE:-true}" == "true" ]]; then
+ local queue_count=$((total_funcs - queued_count))
+ _parallel_snapshot "none" "$done_list" "$queue_count"
+ fi
batch_pids=()
batch_funcs=()
batch_logs=()
@@ -256,6 +321,15 @@ parallel_funcs() {
# Wait for all remaining jobs and collect exit codes
if ((${#batch_pids[@]} > 0)); then
+ if [[ "${PARALLEL_MODE:-true}" == "true" ]]; then
+ local active_list=""
+ local i
+ for i in "${batch_funcs[@]}"; do
+ [[ -z "$active_list" ]] && active_list="${i} 00:00" || active_list="${active_list}, ${i} 00:00"
+ done
+ local queue_count=$((total_funcs - queued_count))
+ _parallel_snapshot "$active_list" "$done_list" "$queue_count"
+ fi
local idx rc batch_failed=0
for idx in "${!batch_pids[@]}"; do
if wait "${batch_pids[$idx]}" 2>/dev/null; then
@@ -266,6 +340,14 @@ parallel_funcs() {
local job_end_ts
job_end_ts=$(date +%s)
_parallel_emit_job_output "${batch_funcs[$idx]}" "${batch_logs[$idx]}" "$rc" "${batch_starts[$idx]}" "$job_end_ts"
+ local job_dur=$((job_end_ts - batch_starts[$idx]))
+ local dur_fmt
+ dur_fmt=$(format_duration "$job_dur")
+ if [[ -z "$done_list" ]]; then
+ done_list="${batch_funcs[$idx]} ${dur_fmt}"
+ else
+ done_list="${done_list}, ${batch_funcs[$idx]} ${dur_fmt}"
+ fi
[[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%b[*] Finished %s (PID: %s, rc=%s)%b\n" "${cyan:-}" "${batch_funcs[$idx]}" "${batch_pids[$idx]}" "$rc" "${reset:-}"
if [[ $rc -ne 0 ]]; then
((failed++))
@@ -274,6 +356,9 @@ parallel_funcs() {
rm -f "${batch_logs[$idx]}" 2>/dev/null || true
done
_parallel_batch_summary "${#batch_pids[@]}" "$batch_failed" "$batch_start_ts"
+ if [[ "${PARALLEL_MODE:-true}" == "true" ]]; then
+ _parallel_snapshot "none" "$done_list" "0"
+ fi
fi
rmdir "$parallel_log_root" 2>/dev/null || true
@@ -322,7 +407,7 @@ wait_for_jobs() {
local elapsed
elapsed=$(($(date +%s) - start_time))
if ((elapsed >= timeout)); then
- printf "%b[!] Timeout reached, killing remaining jobs%b\n" "${bred:-}" "${reset:-}" >&2
+ print_warnf "Timeout reached, killing remaining jobs"
jobs -p | xargs -r kill 2>/dev/null || true
return 1
fi
diff --git a/lib/ui.sh b/lib/ui.sh
index c85c37a..5066015 100644
--- a/lib/ui.sh
+++ b/lib/ui.sh
@@ -14,6 +14,7 @@ _UI_OK_COUNT=0
_UI_WARN_COUNT=0
_UI_FAIL_COUNT=0
_UI_SKIP_COUNT=0
+_UI_CACHE_COUNT=0
ui_init() {
# TTY detection
@@ -48,12 +49,13 @@ ui_count_inc() {
WARN) ((_UI_WARN_COUNT++)) || true ;;
FAIL) ((_UI_FAIL_COUNT++)) || true ;;
SKIP) ((_UI_SKIP_COUNT++)) || true ;;
+ CACHE) ((_UI_CACHE_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"
+ printf "OK:%d WARN:%d FAIL:%d SKIP:%d CACHE:%d" \
+ "$_UI_OK_COUNT" "$_UI_WARN_COUNT" "$_UI_FAIL_COUNT" "$_UI_SKIP_COUNT" "$_UI_CACHE_COUNT"
}
ui_header() {
@@ -64,12 +66,29 @@ ui_header() {
local outdir="${dir:-unknown}"
local started
started=$(date +'%Y-%m-%d %H:%M:%S')
+ local mode_label="FULL"
+ case "${opt_mode:-r}" in
+ n) mode_label="OSINT-ONLY" ;;
+ w) mode_label="WEB" ;;
+ s) mode_label="SUBDOMAINS" ;;
+ p) mode_label="PASSIVE" ;;
+ a) mode_label="ALL" ;;
+ z) mode_label="ZEN" ;;
+ esac
- 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"
+ local header_line
+ header_line=$(printf "reconftw %s by @six2dez | Authorized testing only" "${reconftw_version:-}")
+ local header_rule=""
+ local i
+ for ((i = 0; i < ${#header_line}; i++)); do
+ header_rule+="─"
+ done
+ printf "%b%s%b\n" "${bgreen:-}" "$header_rule" "${reset:-}"
+ printf "%b%s%b\n" "${bgreen:-}" "$header_line" "${reset:-}"
+ printf "%b%s%b\n" "${bgreen:-}" "$header_rule" "${reset:-}"
+ printf "Mode: %s | Target: %s | Profile: %s | Parallel: %s | Jobs: %s\n" \
+ "$mode_label" "$target" "$(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
@@ -82,10 +101,9 @@ ui_header() {
info_line="${DISK_SPACE_INFO}"
fi
fi
- printf " Info: %s\n" "$info_line"
+ printf "System: %s\n" "$info_line"
fi
- printf " Started: %s\n" "$started"
- printf "%b───────────────────────────────────────────────────────────────%b\n\n" "${bgreen:-}" "${reset:-}"
+ printf "Started: %s\n\n" "$started"
}
ui_section() {
@@ -124,27 +142,10 @@ ui_batch_start() {
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"
+ if declare -F print_task >/dev/null 2>&1; then
+ print_task "$badge" "$task" "$duration" "$detail"
else
- printf " %b[%-4s]%b %s %s %4ss\n" \
- "$color" "$badge" "${reset:-}" "$task" "$dots" "$duration"
+ printf " [%s] %s %ss\n" "$badge" "$task" "$duration"
fi
}
@@ -155,25 +156,23 @@ ui_batch_end() {
}
ui_summary() {
- local target="$1" duration="$2" outdir="$3"
- local subs="${4:-0}" webs="${5:-0}"
- local crit="${6:-0}" high="${7:-0}" med="${8:-0}" low="${9:-0}" info="${10:-0}"
+ local target="$1" duration="$2" outdir="$3" mode_label="$4"
+ local subs="${5:-0}" webs="${6:-0}"
+ local crit="${7:-0}" high="${8:-0}" med="${9:-0}" low="${10:-0}" info="${11:-0}"
+ local debug_log="${DEBUG_LOG:-}"
printf "\n"
- _print_rule
- printf " %bRESULTS: %s%b\n" "${bblue:-}" "$target" "${reset:-}"
- _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 │ %bℹ️ %d%b\n" \
- "${bred:-}" "$crit" "${reset:-}" \
- "${yellow:-}" "$high" "${reset:-}" \
- "${yellow:-}" "$med" "${reset:-}" \
- "${bblue:-}" "$low" "${reset:-}" \
- "${cyan:-}" "$info" "${reset:-}"
- printf " Duration: %s\n" "$duration"
- printf " Output: %s\n" "$outdir"
- _print_rule
+ printf "RESULTS %s\n" "$target"
+ printf "Mode: %s\n" "$mode_label"
+ printf "Subdomains: %s\n" "$subs"
+ printf "Web hosts: %s\n" "$webs"
+ printf "Findings: C %d | H %d | M %d | L %d | I %d\n" \
+ "$crit" "$high" "$med" "$low" "$info"
+ printf "Duration: %s\n" "$duration"
+ printf "Output: %s\n" "$outdir"
+ if [[ -n "$debug_log" ]] && (( _UI_FAIL_COUNT > 0 || _UI_WARN_COUNT > 0 )); then
+ printf "Debug log: %s\n" "$debug_log"
+ fi
printf "\n"
}
diff --git a/modules/core.sh b/modules/core.sh
index eeca3dc..8076134 100644
--- a/modules/core.sh
+++ b/modules/core.sh
@@ -110,7 +110,6 @@ function banner() {
local banner_code
if banner_code=$(banner_grabber); then
printf "\n%b%s" "$bgreen" "$banner_code"
- printf "\n %s by @six2dez%b\n" "$reconftw_version" "$reset"
else
printf "\n%bFailed to load banner.%b\n" "$bgreen" "$reset"
fi
@@ -344,7 +343,11 @@ function tools_installed() {
if [[ $all_installed == true ]]; then
: # Tools check OK, no output
else
- printf " Pending: %s\n" "${missing_tools[*]}"
+ if (( ${#missing_tools[@]} == 1 )); then
+ _print_msg WARN "Pending tool: ${missing_tools[0]}"
+ else
+ _print_msg WARN "Pending tools: ${missing_tools[*]}"
+ fi
fi
if [[ $CHECK_TOOLS_OR_EXIT == true && $all_installed != true ]]; then
@@ -568,8 +571,7 @@ function incremental_init() {
mkdir -p "$INCREMENTAL_DIR"/{subdomains,webs,hosts,vulns,previous}
- printf "%b[%s] Incremental mode enabled - will only process new findings%b\n" \
- "$bgreen" "$(date +'%Y-%m-%d %H:%M:%S')" "$reset"
+ print_notice INFO "incremental" "Incremental mode enabled - will only process new findings"
}
# Save current state for next incremental run
@@ -607,8 +609,7 @@ function incremental_diff() {
cp "$current_file" "$output_file" 2>/dev/null
local count
count=$(wc -l <"$output_file" 2>/dev/null || echo 0)
- printf "%b[%s] Incremental mode: First run for %s - %d items total%b\n" \
- "$bblue" "$(date +'%Y-%m-%d %H:%M:%S')" "$type" "$count" "$reset"
+ print_notice INFO "incremental" "First run for ${type}: ${count} items total"
return 0
fi
@@ -620,8 +621,7 @@ function incremental_diff() {
total_count=$(wc -l <"$current_file" 2>/dev/null || echo 0)
previous_count=$(wc -l <"$previous_file" 2>/dev/null || echo 0)
- printf "%b[%s] Incremental mode %s: %d new (previous: %d, total: %d)%b\n" \
- "$bblue" "$(date +'%Y-%m-%d %H:%M:%S')" "$type" "$new_count" "$previous_count" "$total_count" "$reset"
+ print_notice INFO "incremental" "${type}: ${new_count} new (previous: ${previous_count}, total: ${total_count})"
if [[ $new_count -eq 0 ]]; then
return 1 # No new items
@@ -639,8 +639,30 @@ function incremental_report() {
local report_file
local new_subs new_webs
+ local subs_diff webs_diff
report_file="$INCREMENTAL_DIR/incremental_report_$(date +%Y%m%d_%H%M%S).txt"
+ subs_diff="$(mktemp 2>/dev/null || echo /tmp/incremental_subs.$$)"
+ webs_diff="$(mktemp 2>/dev/null || echo /tmp/incremental_webs.$$)"
+ : >"$subs_diff"
+ : >"$webs_diff"
+
+ if [[ -f "$INCREMENTAL_DIR/previous/subdomains_latest.txt" ]]; then
+ comm -13 <(sort -u "$INCREMENTAL_DIR/previous/subdomains_latest.txt" 2>/dev/null || true) \
+ <(sort -u "subdomains/subdomains.txt" 2>/dev/null || true) >"$subs_diff"
+ new_subs=$(wc -l <"$subs_diff" | tr -d ' ')
+ else
+ new_subs=0
+ fi
+
+ if [[ -f "$INCREMENTAL_DIR/previous/webs_latest.txt" ]]; then
+ comm -13 <(sort -u "$INCREMENTAL_DIR/previous/webs_latest.txt" 2>/dev/null || true) \
+ <(sort -u "webs/webs.txt" 2>/dev/null || true) >"$webs_diff"
+ new_webs=$(wc -l <"$webs_diff" | tr -d ' ')
+ else
+ new_webs=0
+ fi
+
{
echo "==============================================="
echo "Incremental Scan Report"
@@ -648,42 +670,27 @@ function incremental_report() {
echo "Date: $(date +'%Y-%m-%d %H:%M:%S')"
echo "==============================================="
echo ""
-
- # Subdomain changes
- if [[ -f "$INCREMENTAL_DIR/previous/subdomains_latest.txt" ]]; then
- new_subs=$(comm -13 <(sort -u "$INCREMENTAL_DIR/previous/subdomains_latest.txt" 2>/dev/null || touch /tmp/empty) \
- <(sort -u "subdomains/subdomains.txt" 2>/dev/null || touch /tmp/empty) | wc -l)
- echo "New Subdomains: $new_subs"
- if [[ $new_subs -gt 0 ]]; then
- echo "---"
- comm -13 <(sort -u "$INCREMENTAL_DIR/previous/subdomains_latest.txt" 2>/dev/null || touch /tmp/empty) \
- <(sort -u "subdomains/subdomains.txt" 2>/dev/null || touch /tmp/empty) | head -20
- [[ $new_subs -gt 20 ]] && echo "... and $((new_subs - 20)) more"
- echo ""
- fi
+ echo "New Subdomains: $new_subs"
+ if [[ $new_subs -gt 0 ]]; then
+ echo "---"
+ head -20 "$subs_diff"
+ [[ $new_subs -gt 20 ]] && echo "... and $((new_subs - 20)) more"
+ echo ""
fi
-
- # Web changes
- if [[ -f "$INCREMENTAL_DIR/previous/webs_latest.txt" ]]; then
- new_webs=$(comm -13 <(sort -u "$INCREMENTAL_DIR/previous/webs_latest.txt" 2>/dev/null || touch /tmp/empty) \
- <(sort -u "webs/webs.txt" 2>/dev/null || touch /tmp/empty) | wc -l)
- echo "New Webs: $new_webs"
- if [[ $new_webs -gt 0 ]]; then
- echo "---"
- comm -13 <(sort -u "$INCREMENTAL_DIR/previous/webs_latest.txt" 2>/dev/null || touch /tmp/empty) \
- <(sort -u "webs/webs.txt" 2>/dev/null || touch /tmp/empty) | head -20
- [[ $new_webs -gt 20 ]] && echo "... and $((new_webs - 20)) more"
- echo ""
- fi
+ echo "New Webs: $new_webs"
+ if [[ $new_webs -gt 0 ]]; then
+ echo "---"
+ head -20 "$webs_diff"
+ [[ $new_webs -gt 20 ]] && echo "... and $((new_webs - 20)) more"
+ echo ""
fi
-
echo "==============================================="
echo "Full report saved to: $report_file"
echo "==============================================="
- } | tee "$report_file"
+ } >"$report_file"
- printf "%b[%s] Incremental report generated: %s%b\n" \
- "$bgreen" "$(date +'%Y-%m-%d %H:%M:%S')" "$report_file" "$reset"
+ rm -f "$subs_diff" "$webs_diff" 2>/dev/null || true
+ _print_status INFO "incremental_report" "subs ${new_subs}, webs ${new_webs} -> ${report_file}"
}
# Hash helper for alert fingerprinting.
@@ -907,8 +914,7 @@ function incremental_should_skip() {
new_webs=$(cat .tmp/webs_new_count 2>/dev/null || echo 1)
if [[ $new_subs -eq 0 && $new_webs -eq 0 ]]; then
- printf "%b[%s] Incremental mode: No new assets found, skipping heavy scans%b\n" \
- "$yellow" "$(date +'%Y-%m-%d %H:%M:%S')" "$reset"
+ print_notice WARN "incremental" "No new assets found, skipping heavy scans"
return 0 # Skip
fi
@@ -943,7 +949,7 @@ function output() {
# Prevent accidental deletion if $dir_output is a parent of $dir
if [[ $dir == "$dir_output"* ]]; then
- echo "[!] Output directory is a parent of the working directory. Aborting to prevent data loss."
+ _print_error "Output directory is a parent of the working directory. Aborting to prevent data loss."
return 1
fi
@@ -955,7 +961,7 @@ function output() {
if [[ "$dir" == "${SCRIPTPATH}/Recon/"* ]]; then
rm -rf -- "$dir"
else
- echo "[!] Refusing to delete directory outside Recon/: $dir"
+ _print_error "Refusing to delete directory outside Recon/: $dir"
return 1
fi
fi
@@ -1013,8 +1019,11 @@ function notification() {
return 0
fi
- # Print to terminal
- _print_msg "$level" "$1"
+ # Print to terminal in structured format (no counters)
+ print_notice "$level" "${FUNCNAME[1]:-notice}" "$1"
+ if [[ "$level" == "WARN" || "$level" == "FAIL" ]]; then
+ record_incident "$level" "${FUNCNAME[1]:-notice}" "$1"
+ fi
# Send to notify if notifications are enabled
if [[ -n $NOTIFY ]]; then
@@ -1082,7 +1091,7 @@ function start_func() {
if declare -F ui_log_jsonl >/dev/null 2>&1; then
ui_log_jsonl "INFO" "${1}" "Function started" "description=${2}"
fi
- if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
_print_msg "INFO" "Running ${1}..."
fi
}
@@ -1134,6 +1143,9 @@ function end_func() {
# Show detail line for non-OK statuses when message is present
if [[ -n "$message" ]] && [[ "$badge" != "OK" && "$badge" != "INFO" ]]; then
printf " %s\n" "$message"
+ if [[ "$badge" == "FAIL" || "$badge" == "WARN" ]]; then
+ record_incident "$badge" "$fn" "$message"
+ fi
fi
fi
log_json "SUCCESS" "${fn}" "Function completed" "runtime=${runtime}" "duration_sec=${duration}"
@@ -1141,14 +1153,7 @@ function end_func() {
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() {
@@ -1159,7 +1164,7 @@ function start_subfunc() {
if declare -F ui_log_jsonl >/dev/null 2>&1; then
ui_log_jsonl "INFO" "${1}" "Subfunction started" "description=${2}"
fi
- if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
_print_msg "INFO" "Running ${1}..."
fi
}
@@ -1178,14 +1183,7 @@ function end_subfunc() {
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
- case "${3:-OK}" in
- WARN) ui_count_inc WARN ;;
- FAIL) ui_count_inc FAIL ;;
- SKIP) ui_count_inc SKIP ;;
- *) ui_count_inc OK ;;
- esac
- fi
+ :
}
function check_inscope() {
@@ -1858,7 +1856,7 @@ function health_check() {
# 2. Check key recon tools
_print_status INFO "Checking recon tools..."
- local recon_tools=("subfinder" "httpx" "nuclei" "naabu" "ffuf" "dnsx" "anew" "notify")
+ local recon_tools=("subfinder" "httpx" "nuclei" "ffuf" "dnsx" "anew" "notify" "nmap" "nmapurls")
for tool in "${recon_tools[@]}"; do
if command -v "$tool" >/dev/null 2>&1; then
_print_status OK "$tool"
diff --git a/modules/modes.sh b/modules/modes.sh
index 5acd2a0..0fc3e2d 100644
--- a/modules/modes.sh
+++ b/modules/modes.sh
@@ -40,11 +40,6 @@ function start() {
if [[ $upgrade_before_running == true ]]; then
"${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
- else
- tools_installed
- fi
# Initialize incremental mode if enabled
incremental_init
@@ -81,7 +76,7 @@ function start() {
fi
mkdir -p "$dir"
cd "$dir" || {
- echo "Failed to cd directory in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to cd directory in %s @ line %s" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
if [[ $AXIOM == true ]]; then
@@ -101,6 +96,8 @@ function start() {
NOWT=$(date +"%T")
LOGFILE="${dir}/.log/${NOW}_${NOWT}.txt"
touch ".log/${NOW}_${NOWT}.txt"
+ DEBUG_LOG="${dir}/debug.log"
+ touch "$DEBUG_LOG"
echo "[$(date +'%Y-%m-%d %H:%M:%S')] Start ${NOW} ${NOWT}" >"${LOGFILE}"
enable_command_trace
@@ -113,6 +110,10 @@ function start() {
# Initialize structured logging if enabled
log_init
+ # Reset incidents for this run
+ INCIDENTS_LEVELS=()
+ INCIDENTS_ITEMS=()
+
# Initialize cache for wordlists/resolvers
cache_init
cache_clean "${CACHE_MAX_AGE_DAYS:-30}" 2>>"${LOGFILE:-/dev/null}" || true
@@ -138,6 +139,12 @@ function start() {
_print_rule
fi
+ if [[ "${MONITOR_MODE:-false}" == "true" ]] && [[ "${MONITOR_CYCLE:-1}" -gt 1 ]]; then
+ notification "Monitor cycle ${MONITOR_CYCLE}: skipping repeated tools check" info
+ else
+ tools_installed
+ fi
+
}
function end() {
@@ -194,7 +201,7 @@ function end() {
ai_cmd+=("${ai_strict_flag}")
fi
if ! "${ai_cmd[@]}" 2>>"${LOGFILE}" >/dev/null; then
- notification "AI report failed; check ${LOGFILE} for details" warn
+ notification "AI report failed; check ${DEBUG_LOG} for details" warn
fi
elif [[ -n "${ai_python}" ]]; then
notification "AI skipped: reconftw_ai script not found at ${ai_script}" warn
@@ -299,9 +306,23 @@ function end() {
fi
done
fi
- ui_summary "$domain" "$runtime" "$finaldir" "${subs_count:-0}" "${webs_count:-0}" \
+ local mode_label="FULL"
+ case "${opt_mode:-r}" in
+ n) mode_label="OSINT-ONLY" ;;
+ w) mode_label="WEB" ;;
+ s) mode_label="SUBDOMAINS" ;;
+ p) mode_label="PASSIVE" ;;
+ a) mode_label="ALL" ;;
+ z) mode_label="ZEN" ;;
+ esac
+ if [[ "${opt_mode:-r}" == "n" ]]; then
+ subs_count="N/A (OSINT-only)"
+ webs_count="N/A (OSINT-only)"
+ fi
+ ui_summary "$domain" "$runtime" "$finaldir" "$mode_label" "${subs_count:-0}" "${webs_count:-0}" \
"${vulns_count[critical]}" "${vulns_count[high]}" "${vulns_count[medium]}" \
"${vulns_count[low]}" "${vulns_count[info]}"
+ print_incidents "${DEBUG_LOG:-}"
else
_print_section "Scan Complete"
if [[ "${RECON_PARTIAL_RUN:-false}" == "true" ]]; then
@@ -311,6 +332,7 @@ function end() {
printf "%b Duration: %s%b\n" "${bgreen:-}" "$runtime" "${reset:-}"
printf "%b Output: %s%b\n" "${bgreen:-}" "$finaldir" "${reset:-}"
_print_rule
+ print_incidents "${DEBUG_LOG:-}"
fi
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
@@ -318,8 +340,10 @@ function end() {
# Print performance timing summary
print_timing_summary
write_perf_summary
- generate_consolidated_report || true
- export_reports || true
+ if [[ "${NO_REPORT:-false}" != "true" ]]; then
+ generate_consolidated_report || true
+ export_reports || true
+ fi
}
@@ -410,8 +434,6 @@ function passive() {
_print_section "Web Detection"
- webprobe_simple
- webprobe_full
favicon
cdnprovider
# shellcheck disable=SC2034 # PORTSCAN_ACTIVE controls scan behavior
@@ -539,11 +561,11 @@ function multi_osint() {
workdir="${SCRIPTPATH}/Recon/${multi}"
mkdir -p "$workdir" || {
- echo "Failed to create directory '$workdir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to create directory '%s' in %s @ line %s" "$workdir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
cd "$workdir" || {
- echo "Failed to cd directory '$workdir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to cd directory '%s' in %s @ line %s" "$workdir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
mkdir -p {.log,.tmp,webs,hosts,vulns,osint,screenshots,subdomains}
@@ -552,6 +574,8 @@ function multi_osint() {
NOWT=$(date +"%T")
LOGFILE="${workdir}/.log/${NOW}_${NOWT}.txt"
touch ".log/${NOW}_${NOWT}.txt"
+ DEBUG_LOG="${workdir}/debug.log"
+ touch "$DEBUG_LOG"
echo "[$(date +'%Y-%m-%d %H:%M:%S')] Start ${NOW} ${NOWT}" >"${LOGFILE}"
enable_command_trace
@@ -561,7 +585,7 @@ function multi_osint() {
called_fn_dir="$dir/.called_fn"
mkdir -p "$dir"
cd "$dir" || {
- echo "Failed to cd directory '$dir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to cd directory '%s' in %s @ line %s" "$dir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
mkdir -p {.log,.tmp,webs,hosts,vulns,osint,screenshots,subdomains}
@@ -569,6 +593,8 @@ function multi_osint() {
NOWT=$(date +"%T")
LOGFILE="${dir}/.log/${NOW}_${NOWT}.txt"
touch ".log/${NOW}_${NOWT}.txt"
+ DEBUG_LOG="${dir}/debug.log"
+ touch "$DEBUG_LOG"
echo "[$(date +'%Y-%m-%d %H:%M:%S')] Start ${NOW} ${NOWT}" >"${LOGFILE}"
domain_info
ip_info
@@ -583,7 +609,7 @@ function multi_osint() {
favicon
done <"$list"
cd "$workdir" || {
- echo "Failed to cd directory '$workdir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to cd directory '%s' in %s @ line %s" "$workdir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
dir=$workdir
@@ -738,11 +764,11 @@ function multi_recon() {
workdir="${SCRIPTPATH}/Recon/${multi}"
mkdir -p "$workdir" || {
- echo "Failed to create directory '$workdir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to create directory '%s' in %s @ line %s" "$workdir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
cd "$workdir" || {
- echo "Failed to cd directory '$workdir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to cd directory '%s' in %s @ line %s" "$workdir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
@@ -751,6 +777,8 @@ function multi_recon() {
NOWT=$(date +"%T")
LOGFILE="${workdir}/.log/${NOW}_${NOWT}.txt"
touch ".log/${NOW}_${NOWT}.txt"
+ DEBUG_LOG="${workdir}/debug.log"
+ touch "$DEBUG_LOG"
echo "[$(date +'%Y-%m-%d %H:%M:%S')] Start ${NOW} ${NOWT}" >"${LOGFILE}"
[ -n "$flist" ] && LISTTOTAL=$(wc -l <"$flist")
@@ -762,16 +790,16 @@ function multi_recon() {
# Ensure directories exist
mkdir -p "$dir" || {
- echo "Failed to create directory '$dir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to create directory '%s' in %s @ line %s" "$dir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
mkdir -p "$called_fn_dir" || {
- echo "Failed to create directory '$called_fn_dir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to create directory '%s' in %s @ line %s" "$called_fn_dir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
cd "$dir" || {
- echo "Failed to cd to directory '$dir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to cd to directory '%s' in %s @ line %s" "$dir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
@@ -785,9 +813,11 @@ function multi_recon() {
mkdir -p .log
touch "$LOGFILE" || {
- echo "Failed to create log file: $LOGFILE"
+ print_errorf "Failed to create log file: %s" "$LOGFILE"
exit 1
}
+ DEBUG_LOG="${dir}/debug.log"
+ touch "$DEBUG_LOG"
echo "[$(date +'%Y-%m-%d %H:%M:%S')] Start ${NOW} ${NOWT}" >"$LOGFILE"
enable_command_trace
loopstart=$(date +%s)
@@ -814,7 +844,7 @@ function multi_recon() {
fi
done
cd "$workdir" || {
- echo "Failed to cd directory '$workdir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to cd directory '%s' in %s @ line %s" "$workdir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
@@ -829,7 +859,7 @@ function multi_recon() {
dir="$workdir/targets/$domain"
called_fn_dir="$dir/.called_fn"
cd "$dir" || {
- echo "Failed to cd directory '$dir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to cd directory '%s' in %s @ line %s" "$dir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
subdomains_full
@@ -853,7 +883,7 @@ function multi_recon() {
fi
done
cd "$workdir" || {
- echo "Failed to cd directory '$workdir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to cd directory '%s' in %s @ line %s" "$workdir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
@@ -881,7 +911,7 @@ function multi_recon() {
dir="$workdir/targets/$domain"
called_fn_dir="$dir/.called_fn"
cd "$dir" || {
- echo "Failed to cd directory '$dir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to cd directory '%s' in %s @ line %s" "$dir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
loopstart=$(date +%s)
@@ -910,7 +940,7 @@ function multi_recon() {
dir="$workdir/targets/$domain"
called_fn_dir="$dir/.called_fn"
cd "$dir" || {
- echo "Failed to cd directory '$dir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to cd directory '%s' in %s @ line %s" "$dir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
cms_scanner
@@ -930,7 +960,7 @@ function multi_recon() {
fi
done
cd "$workdir" || {
- echo "Failed to cd directory '$workdir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to cd directory '%s' in %s @ line %s" "$workdir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
dir=$workdir
@@ -952,16 +982,16 @@ function multi_custom() {
dir="${SCRIPTPATH}/Recon/${multi}"
if [[ -z "$multi" || "$dir" != "${SCRIPTPATH}/Recon/"* ]]; then
- echo "[!] Refusing to remove '$dir' -- safety check failed"
+ print_errorf "Refusing to remove '%s' -- safety check failed" "$dir"
return 1
fi
rm -rf -- "$dir"
mkdir -p "$dir" || {
- echo "Failed to create directory '$dir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to create directory '%s' in %s @ line %s" "$dir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
cd "$dir" || {
- echo "Failed to cd directory '$dir' in ${FUNCNAME[0]} @ line ${LINENO}"
+ print_errorf "Failed to cd directory '%s' in %s @ line %s" "$dir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
@@ -971,6 +1001,8 @@ function multi_custom() {
NOWT=$(date +"%T")
LOGFILE="${dir}/.log/${NOW}_${NOWT}.txt"
touch ".log/${NOW}_${NOWT}.txt"
+ DEBUG_LOG="${dir}/debug.log"
+ touch "$DEBUG_LOG"
echo "[$(date +'%Y-%m-%d %H:%M:%S')] Start ${NOW} ${NOWT}" >"${LOGFILE}"
enable_command_trace
@@ -995,10 +1027,10 @@ function multi_custom() {
currently=$(date +"%H:%M:%S")
loopend=$(date +%s)
- getElapsedTime "$loopstart" "$loopend"
- _print_rule
- printf "${bgreen} Finished %s (%s/%s) for %s entries in %s (%s)${reset}\n" "$custom_f" "$func_count" "$func_total" "$entries" "$runtime" "$currently"
- _print_rule
+ local duration=$((loopend - loopstart))
+ _print_status OK "$custom_f" "${duration}s"
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
+ print_notice INFO "$custom_f" "entries ${entries} (${func_count}/${func_total}) at ${currently}"
done
if [[ $AXIOM == true ]]; then
@@ -1233,29 +1265,33 @@ function report_only_mode() {
NOWT=$(date +"%T")
LOGFILE="${dir}/.log/${NOW}_${NOWT}_report_only.txt"
touch "$LOGFILE"
+ DEBUG_LOG="${dir}/debug.log"
+ touch "$DEBUG_LOG"
runtime="report-only"
notification "Report-only mode: rebuilding reports from existing artifacts" info
build_hotlist || true
write_perf_summary || true
- generate_consolidated_report || true
- export_reports || true
+ if [[ "${NO_REPORT:-false}" != "true" ]]; then
+ generate_consolidated_report || true
+ export_reports || true
+ fi
notification "Report-only rebuild completed for ${domain}" good
}
function help() {
pt_header "Usage"
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 " %sTARGET OPTIONS%s\n" "${bblue}" "${reset}"
+ 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] [--gen-resolvers] [--export fmt] [-o OUTPUT]\n\n"
+ printf " %bTARGET OPTIONS%b\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 " %sMODE OPTIONS%s\n" "${bblue}" "${reset}"
- printf " -r, --recon Recon - Performs full recon process (without attacks)\n"
+ printf " %bMODE OPTIONS%b\n" "${bblue}" "${reset}"
+ printf " -r, --recon Recon - Performs full recon process (includes nuclei and fuzzing)\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"
printf " -a, --all All - Performs all checks and active exploitations\n"
@@ -1266,7 +1302,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 " %sGENERAL OPTIONS%s\n" "${bblue}" "${reset}"
+ printf " %bGENERAL OPTIONS%b\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"
@@ -1283,32 +1319,37 @@ function help() {
printf " --parallel-log m Parallel output mode: summary (default), tail, or full\n"
printf " --parallel Run independent functions in parallel (faster but uses more resources)\n"
printf " --no-parallel Force sequential execution\n"
+ printf " --show-cache Show cached modules lines (default collapses)\n"
+ printf " --no-banner Disable ASCII banner\n"
+ printf " --legal Show full legal block\n"
printf " --monitor Continuous monitoring mode (single target; -w supports -l)\n"
printf " --monitor-interval Minutes between cycles (default: 60)\n"
printf " --monitor-cycles Stop after N cycles (0 = infinite)\n"
printf " --report-only Rebuild report artifacts from existing Recon/<target>\n"
+ printf " --no-report Disable report generation and exports\n"
printf " --refresh-cache Force refresh of cached resolvers/wordlists\n"
- printf " --export fmt Export artifacts: json|html|csv|all\n"
+ printf " --gen-resolvers Generate custom resolvers with dnsvalidator\n"
+ printf " --export fmt Export artifacts: json|html|csv|all (default: all)\n"
printf " \n"
- printf " %sUSAGE EXAMPLES%s\n" "${bblue}" "${reset}"
- printf " %sPerform full recon (without attacks):%s\n" "${byellow}" "${reset}"
+ printf " %bUSAGE EXAMPLES%b\n" "${bblue}" "${reset}"
+ printf " %bPerform full recon (without attacks):%b\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -d example.com -r\n"
printf " \n"
- printf " %sPerform subdomain enumeration on multiple targets:%s\n" "${byellow}" "${reset}"
+ printf " %bPerform subdomain enumeration on multiple targets:%b\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -l targets.txt -s\n"
printf " \n"
- printf " %sPerform Web based scanning on a subdomains list:%s\n" "${byellow}" "${reset}"
+ printf " %bPerform Web based scanning on a subdomains list:%b\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -d example.com -l targets.txt -w\n"
printf " \n"
- printf " %sMultidomain recon:%s\n" "${byellow}" "${reset}"
+ printf " %bMultidomain recon:%b\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -m company -l domainlist.txt -r\n"
printf " \n"
- printf " %sPerform full recon (with active attacks) along Out-Of-Scope subdomains list:%s\n" "${byellow}" "${reset}"
+ printf " %bPerform full recon (with active attacks) along Out-Of-Scope subdomains list:%b\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -d example.com -x out.txt -a\n"
printf " \n"
- printf " %sAnalyze ReconFTW results with AI:%s\n" "${byellow}" "${reset}"
+ printf " %bAnalyze ReconFTW results with AI:%b\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -d example.com -r --ai\n"
printf " \n"
- printf " %sRun custom function:%s\n" "${byellow}" "${reset}"
+ printf " %bRun custom function:%b\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -d example.com -c nuclei_check \n"
}
diff --git a/modules/osint.sh b/modules/osint.sh
index 66dd34f..98a4df2 100644
--- a/modules/osint.sh
+++ b/modules/osint.sh
@@ -360,8 +360,8 @@ function third_party_misconfigs() {
# Change directory to Spoofy tool
if ! pushd "${tools}/misconfig-mapper" >/dev/null; then
- printf "%b[!] Failed to change directory to %s in %s at line %s.%b\n" \
- "$bred" "${tools}/misconfig-mapper" "${FUNCNAME[0]}" "$LINENO" "$reset"
+ print_warnf "Failed to change directory to %s in %s at line %s." \
+ "${tools}/misconfig-mapper" "${FUNCNAME[0]}" "$LINENO"
return 1
fi
@@ -373,8 +373,8 @@ function third_party_misconfigs() {
# Return to the previous directory
if ! popd >/dev/null; then
- printf "%b[!] Failed to return to previous directory in %s at line %s.%b\n" \
- "$bred" "${FUNCNAME[0]}" "$LINENO" "$reset"
+ print_warnf "Failed to return to previous directory in %s at line %s." \
+ "${FUNCNAME[0]}" "$LINENO"
return 1
fi
@@ -403,8 +403,8 @@ function spoof() {
# Change directory to Spoofy tool
if ! pushd "${tools}/Spoofy" >/dev/null; then
- printf "%b[!] Failed to change directory to %s in %s at line %s.%b\n" \
- "$bred" "${tools}/Spoofy" "${FUNCNAME[0]}" "$LINENO" "$reset"
+ print_warnf "Failed to change directory to %s in %s at line %s." \
+ "${tools}/Spoofy" "${FUNCNAME[0]}" "$LINENO"
return 1
fi
@@ -413,8 +413,8 @@ function spoof() {
# Return to the previous directory
if ! popd >/dev/null; then
- printf "%b[!] Failed to return to previous directory in %s at line %s.%b\n" \
- "$bred" "${FUNCNAME[0]}" "$LINENO" "$reset"
+ print_warnf "Failed to return to previous directory in %s at line %s." \
+ "${FUNCNAME[0]}" "$LINENO"
return 1
fi
diff --git a/modules/subdomains.sh b/modules/subdomains.sh
index 5f2c561..8ce0e8f 100644
--- a/modules/subdomains.sh
+++ b/modules/subdomains.sh
@@ -37,7 +37,8 @@ deep_wildcard_filter() {
cp "$input_file" ".tmp/dwf_working.txt"
: > ".tmp/dwf_wildcards.txt"
- printf "%b[*] Running deep wildcard detection (max %d iterations)%b\n" "$bblue" "$max_iterations" "$reset"
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
+ printf "%b[*] Running deep wildcard detection (max %d iterations)%b\n" "$bblue" "$max_iterations" "$reset"
while [[ $wildcards_found -gt 0 ]] && [[ $iteration -lt $max_iterations ]]; do
((iteration++))
@@ -126,7 +127,8 @@ deep_wildcard_filter() {
fi
fi
- printf "%b Iteration %d: found %d new wildcard parent(s)%b\n" "$yellow" "$iteration" "$wildcards_found" "$reset"
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
+ printf "%b Iteration %d: found %d new wildcard parent(s)%b\n" "$yellow" "$iteration" "$wildcards_found" "$reset"
done
# Copy final results to output
@@ -139,8 +141,9 @@ deep_wildcard_filter() {
wildcards_count=$(wc -l < ".tmp/dwf_wildcards.txt" 2>/dev/null | tr -d ' ' || echo 0)
local removed=$((original_count - filtered_count))
- printf "%b[*] Deep wildcard filter: %d wildcards detected, %d subdomains removed (%d -> %d)%b\n" \
- "$bgreen" "$wildcards_count" "$removed" "$original_count" "$filtered_count" "$reset"
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
+ printf "%b[*] Deep wildcard filter: %d wildcards detected, %d subdomains removed (%d -> %d)%b\n" \
+ "$bgreen" "$wildcards_count" "$removed" "$original_count" "$filtered_count" "$reset"
# Save wildcard list for reference
if [[ -s ".tmp/dwf_wildcards.txt" ]]; then
@@ -367,27 +370,8 @@ _subdomains_finalize() {
TOTAL_SUBS=$(sed '/^$/d' "subdomains/subdomains.txt" 2>/dev/null | wc -l | tr -d ' ')
if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
- _print_status OK "subdomains_full"
- printf " Total: %s subdomains\n" "$TOTAL_SUBS"
-
- 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 $_max_show ]]; then
- printf " %s\n" "$sub"
- else
- printf " ... and %d more (see subdomains/subdomains.txt)\n" "$((_sub_count - _max_show))"
- break
- fi
- done < "subdomains/subdomains.txt"
- fi
-
+ _print_status OK "subdomains_full" "${TOTAL_SUBS} found -> subdomains/subdomains.txt"
+ print_artifacts "subdomains/subdomains.txt"
fi
# Emit plugin event
@@ -396,11 +380,16 @@ _subdomains_finalize() {
# Incremental mode
incremental_diff "subdomains" "subdomains/subdomains.txt" "subdomains/subdomains_new.txt"
incremental_save "subdomains" "subdomains/subdomains.txt"
- incremental_diff "webs" "webs/webs.txt" "webs/webs_new.txt"
- incremental_save "webs" "webs/webs.txt"
+ if [[ -s "webs/webs.txt" ]]; then
+ incremental_diff "webs" "webs/webs.txt" "webs/webs_new.txt"
+ incremental_save "webs" "webs/webs.txt"
+ else
+ : > "webs/webs_new.txt"
+ fi
# Persist counts
wc -l < "subdomains/subdomains_new.txt" 2>/dev/null > .tmp/subs_new_count
+ [[ -f "webs/webs_new.txt" ]] || : > "webs/webs_new.txt"
wc -l < "webs/webs_new.txt" 2>/dev/null > .tmp/webs_new_count
# Asset store
@@ -581,8 +570,9 @@ function sub_crt() {
| sed -e 's/^\*\.//' >.tmp/crtsh_subdomains.txt; then
log_note "sub_crt: crt source returned no valid JSON; continuing with fallback sources" "${FUNCNAME[0]}" "${LINENO}"
fi
- printf "%b[*] Time fencing enabled: filtering crt.sh results to last %d days (since %s)%b\n" \
- "$bblue" "${DNS_TIME_FENCE_DAYS}" "$cutoff_date" "$reset"
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && \
+ printf "%b[*] Time fencing enabled: filtering crt.sh results to last %d days (since %s)%b\n" \
+ "$bblue" "${DNS_TIME_FENCE_DAYS}" "$cutoff_date" "$reset"
else
# Fallback if date calculation fails
if ! run_command crt -s -json -l "${CTR_LIMIT}" "$domain" 2>>"$LOGFILE" \
@@ -611,7 +601,7 @@ function sub_crt() {
# If INSCOPE is true, check inscope
if [[ $INSCOPE == true ]]; then
if ! check_inscope .tmp/crtsh_subs_tmp.txt 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] check_inscope command failed.%b\n" "$bred" "$reset"
+ print_warnf "check_inscope command failed."
return 1
fi
fi
@@ -640,14 +630,14 @@ function sub_active() {
# Combine subdomain files into subs_no_resolved.txt
if ! find .tmp -type f -iname "*_subs.txt" -exec cat {} + | anew -q .tmp/subs_no_resolved.txt; then
- printf "%b[!] Failed to collect subdomains into subs_no_resolved.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to collect subdomains into subs_no_resolved.txt."
return 1
fi
# Delete out-of-scope domains if outOfScope_file exists
if [[ -s $outOfScope_file ]]; then
if ! deleteOutScoped "$outOfScope_file" .tmp/subs_no_resolved.txt; then
- printf "%b[!] deleteOutScoped command failed.%b\n" "$bred" "$reset"
+ print_warnf "deleteOutScoped command failed."
return 1
fi
fi
@@ -687,7 +677,7 @@ function sub_active() {
# If INSCOPE is true, check inscope
if [[ $INSCOPE == true ]]; then
if ! check_inscope .tmp/subdomains_tmp.txt 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] check_inscope command failed.%b\n" "$bred" "$reset"
+ print_warnf "check_inscope command failed."
return 1
fi
fi
@@ -696,7 +686,7 @@ function sub_active() {
if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/subdomains_tmp.txt 2>>"$LOGFILE" \
| grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
| anew subdomains/subdomains.txt | sed '/^$/d' | wc -l); then
- printf "%b[!] Failed to process subdomains.%b\n" "$bred" "$reset"
+ print_warnf "Failed to process subdomains."
return 1
fi
@@ -758,7 +748,7 @@ function sub_tls() {
if [[ $INSCOPE == true ]]; then
if ! check_inscope .tmp/subdomains_tlsx_resolved.txt 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] check_inscope command failed.%b\n" "$bred" "$reset"
+ print_warnf "check_inscope command failed."
return 1
fi
fi
@@ -766,7 +756,7 @@ function sub_tls() {
touch .tmp/subdomains_tlsx_resolved.txt
if ! NUMOFLINES=$(anew subdomains/subdomains.txt <.tmp/subdomains_tlsx_resolved.txt | sed '/^$/d' | wc -l); then
- printf "%b[!] Counting new subdomains failed.%b\n" "$bred" "$reset"
+ print_warnf "Counting new subdomains failed."
return 1
fi
@@ -804,7 +794,7 @@ function sub_noerror() {
# Check inscope if INSCOPE is true
if [[ $INSCOPE == true ]]; then
if ! check_inscope .tmp/subs_noerror.txt 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] check_inscope command failed.%b\n" "$bred" "$reset"
+ print_warnf "check_inscope command failed."
return 1
fi
fi
@@ -813,7 +803,7 @@ function sub_noerror() {
if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/subs_noerror.txt 2>>"$LOGFILE" \
| grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
| sed 's/^\*\.//' | anew subdomains/subdomains.txt | sed '/^$/d' | wc -l); then
- printf "%b[!] Failed to process subdomains.%b\n" "$bred" "$reset"
+ print_warnf "Failed to process subdomains."
return 1
fi
@@ -900,7 +890,7 @@ function sub_dns() {
if [[ $INSCOPE == true ]]; then
if ! check_inscope .tmp/subdomains_dns_resolved.txt 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] check_inscope command failed.%b\n" "$bred" "$reset"
+ print_warnf "check_inscope command failed."
fi
fi
@@ -908,7 +898,7 @@ function sub_dns() {
if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/subdomains_dns_resolved.txt 2>>"$LOGFILE" \
| grep -E '^([a-zA-Z0-9\-\.]+\.)+[a-zA-Z]{1,}$' \
| anew subdomains/subdomains.txt | sed '/^$/d' | wc -l); then
- printf "%b[!] Failed to count new subdomains.%b\n" "$bred" "$reset"
+ print_warnf "Failed to count new subdomains."
return 1
fi
else
@@ -972,7 +962,7 @@ function sub_brute() {
# Check inscope if INSCOPE is true
if [[ $INSCOPE == true ]]; then
if ! check_inscope .tmp/subs_brute_valid.txt 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] check_inscope command failed.%b\n" "$bred" "$reset"
+ print_warnf "check_inscope command failed."
return 1
fi
fi
@@ -981,7 +971,7 @@ function sub_brute() {
if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/subs_brute_valid.txt 2>>"$LOGFILE" \
| grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
| sed 's/^\*\.//' | anew subdomains/subdomains.txt | sed '/^$/d' | wc -l); then
- printf "%b[!] Failed to process subdomains.%b\n" "$bred" "$reset"
+ print_warnf "Failed to process subdomains."
return 1
fi
@@ -1010,14 +1000,14 @@ function sub_scraping() {
# Initialize scrap_subs.txt
if ! touch .tmp/scrap_subs.txt; then
- printf "%b[!] Failed to create .tmp/scrap_subs.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create .tmp/scrap_subs.txt."
return 1
fi
# If in multi mode and subdomains.txt doesn't exist, create it
if [[ -n $multi ]] && [[ ! -f "$dir/subdomains/subdomains.txt" ]]; then
if ! printf "%b\n" "$domain" >"$dir/subdomains/subdomains.txt"; then
- printf "%b[!] Failed to create subdomains.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create subdomains.txt."
return 1
fi
fi
@@ -1106,7 +1096,7 @@ function sub_scraping() {
if [[ $INSCOPE == true ]] && [[ -s ".tmp/scrap_subs_resolved.txt" ]]; then
if ! check_inscope .tmp/scrap_subs_resolved.txt 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] check_inscope command failed.%b\n" "$bred" "$reset"
+ print_warnf "check_inscope command failed."
fi
fi
@@ -1173,7 +1163,7 @@ function sub_analytics() {
# Create necessary directories
if ! mkdir -p .tmp subdomains; then
- printf "%b[!] Failed to create directories.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create directories."
return 1
fi
@@ -1222,7 +1212,7 @@ function sub_analytics() {
if [[ $INSCOPE == true ]]; then
if ! check_inscope .tmp/analytics_subs_resolved.txt 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] check_inscope command failed.%b\n" "$bred" "$reset"
+ print_warnf "check_inscope command failed."
fi
fi
@@ -1345,14 +1335,14 @@ function sub_permut() {
# Remove out-of-scope domains if applicable
if [[ -s $outOfScope_file ]]; then
if ! deleteOutScoped "$outOfScope_file" .tmp/permute_subs.txt; then
- printf "%b[!] deleteOutScoped command failed.%b\n" "$bred" "$reset"
+ print_warnf "deleteOutScoped command failed."
fi
fi
# Check inscope if INSCOPE is true
if [[ $INSCOPE == true ]]; then
if ! check_inscope .tmp/permute_subs.txt 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] check_inscope command failed.%b\n" "$bred" "$reset"
+ print_warnf "check_inscope command failed."
fi
fi
@@ -1360,7 +1350,7 @@ function sub_permut() {
if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/permute_subs.txt 2>>"$LOGFILE" \
| grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
| anew subdomains/subdomains.txt | sed '/^$/d' | wc -l); then
- printf "%b[!] Failed to process subdomains.%b\n" "$bred" "$reset"
+ print_warnf "Failed to process subdomains."
return 1
fi
else
@@ -1383,7 +1373,7 @@ function sub_regex_permut() {
# Create necessary directories
if ! mkdir -p .tmp subdomains; then
- printf "%b[!] Failed to create directories.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create directories."
return 1
fi
@@ -1393,7 +1383,7 @@ function sub_regex_permut() {
# Change to the regulator directory
if ! pushd "${tools}/regulator" >/dev/null; then
- printf "%b[!] Failed to change directory to %s.%b\n" "$bred" "${tools}/regulator" "$reset"
+ print_warnf "Failed to change directory to %s." "${tools}/regulator"
return 1
fi
@@ -1408,7 +1398,7 @@ function sub_regex_permut() {
# Return to the previous directory
if ! popd >/dev/null; then
- printf "%b[!] Failed to return to previous directory.%b\n" "$bred" "$reset"
+ print_warnf "Failed to return to previous directory."
return 1
fi
@@ -1436,13 +1426,13 @@ function sub_regex_permut() {
if [[ -s ".tmp/regulator.txt" ]]; then
if [[ -s $outOfScope_file ]]; then
if ! deleteOutScoped "$outOfScope_file" .tmp/regulator.txt; then
- printf "%b[!] deleteOutScoped command failed.%b\n" "$bred" "$reset"
+ print_warnf "deleteOutScoped command failed."
fi
fi
if [[ $INSCOPE == true ]]; then
if ! check_inscope .tmp/regulator.txt 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] check_inscope command failed.%b\n" "$bred" "$reset"
+ print_warnf "check_inscope command failed."
fi
fi
@@ -1473,7 +1463,7 @@ function sub_ia_permut() {
# Create necessary directories
if ! mkdir -p .tmp subdomains; then
- printf "%b[!] Failed to create directories.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create directories."
return 1
fi
@@ -1507,13 +1497,13 @@ function sub_ia_permut() {
if [[ -s ".tmp/subwiz_resolved.txt" ]]; then
if [[ -s $outOfScope_file ]]; then
if ! deleteOutScoped "$outOfScope_file" .tmp/subwiz_resolved.txt; then
- printf "%b[!] deleteOutScoped command failed.%b\n" "$bred" "$reset"
+ print_warnf "deleteOutScoped command failed."
fi
fi
if [[ $INSCOPE == true ]]; then
if ! check_inscope .tmp/subwiz_resolved.txt 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] check_inscope command failed.%b\n" "$bred" "$reset"
+ print_warnf "check_inscope command failed."
fi
fi
@@ -1544,7 +1534,7 @@ function sub_recursive_passive() {
# Create necessary directories
if ! mkdir -p .tmp subdomains; then
- printf "%b[!] Failed to create directories.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create directories."
return 1
fi
@@ -1604,7 +1594,7 @@ function sub_recursive_passive() {
if [[ $INSCOPE == true ]]; then
if ! check_inscope .tmp/passive_recurs_tmp.txt 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] check_inscope command failed.%b\n" "$bred" "$reset"
+ print_warnf "check_inscope command failed."
fi
fi
@@ -1637,7 +1627,7 @@ function sub_recursive_passive() {
function sub_recursive_brute() {
# Create necessary directories
if ! mkdir -p .tmp subdomains; then
- printf "%b[!] Failed to create directories.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create directories."
return 1
fi
@@ -1752,12 +1742,12 @@ function sub_recursive_brute() {
if [[ $INSCOPE == true ]]; then
if [[ -s ".tmp/permute_recursive.txt" ]]; then
if ! check_inscope .tmp/permute_recursive.txt 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] check_inscope command failed on permute_recursive.txt.%b\n" "$bred" "$reset"
+ print_warnf "check_inscope command failed on permute_recursive.txt."
fi
fi
if [[ -s ".tmp/brute_recursive.txt" ]]; then
if ! check_inscope .tmp/brute_recursive.txt 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] check_inscope command failed on brute_recursive.txt.%b\n" "$bred" "$reset"
+ print_warnf "check_inscope command failed on brute_recursive.txt."
fi
fi
fi
@@ -1765,7 +1755,7 @@ function sub_recursive_brute() {
# Combine results for final validation
if [[ -s ".tmp/permute_recursive.txt" ]] || [[ -s ".tmp/brute_recursive.txt" ]]; then
if ! cat .tmp/permute_recursive.txt .tmp/brute_recursive.txt 2>>"$LOGFILE" | anew -q .tmp/brute_perm_recursive.txt; then
- printf "%b[!] Failed to combine final results.%b\n" "$bred" "$reset"
+ print_warnf "Failed to combine final results."
return 1
fi
fi
@@ -1819,7 +1809,7 @@ function subtakeover() {
# Create necessary directories
if ! mkdir -p .tmp webs subdomains; then
- printf "%b[!] Failed to create directories.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create directories."
return 1
fi
@@ -1829,7 +1819,7 @@ function subtakeover() {
# Initialize takeover file
if ! touch .tmp/tko.txt; then
- printf "%b[!] Failed to create .tmp/tko.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create .tmp/tko.txt."
return 1
fi
@@ -1874,7 +1864,7 @@ function subtakeover() {
# Count new takeover entries
if ! NUMOFLINES=$(cat .tmp/tko.txt 2>>"$LOGFILE" | anew webs/takeover.txt | sed '/^$/d' | wc -l); then
- printf "%b[!] Failed to count takeover entries.%b\n" "$bred" "$reset"
+ print_warnf "Failed to count takeover entries."
NUMOFLINES=0
fi
@@ -1884,7 +1874,7 @@ function subtakeover() {
if [[ $FARADAY == true ]]; then
if ! faraday-cli status 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] Faraday server is not running. Skipping Faraday integration.%b\n" "$bred" "$reset"
+ print_warnf "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
@@ -1908,7 +1898,7 @@ function zonetransfer() {
# Create necessary directories
if ! mkdir -p subdomains; then
- printf "%b[!] Failed to create subdomains directory.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create subdomains directory."
return 1
fi
@@ -1918,7 +1908,7 @@ function zonetransfer() {
# Initialize output file
if ! : >"subdomains/zonetransfer.txt"; then
- printf "%b[!] Failed to create zonetransfer.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create zonetransfer.txt."
return 1
fi
@@ -1951,7 +1941,7 @@ function zonetransfer() {
function s3buckets() {
# Create necessary directories
if ! mkdir -p .tmp subdomains; then
- printf "%b[!] Failed to create directories.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create directories."
return 1
fi
@@ -1962,7 +1952,7 @@ function s3buckets() {
# If in multi mode and subdomains.txt doesn't exist, create it
if [[ -n $multi ]] && [[ ! -f "$dir/subdomains/subdomains.txt" ]]; then
if ! printf "%b\n" "$domain" >"$dir/subdomains/subdomains.txt"; then
- printf "%b[!] Failed to create subdomains.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create subdomains.txt."
return 1
fi
fi
@@ -1981,17 +1971,17 @@ function s3buckets() {
if [[ -s ".tmp/s3buckets_tmp.txt" ]]; then
if ! cat .tmp/s3buckets_tmp.txt .tmp/s3buckets_tmp2.txt 2>>"$LOGFILE" | anew -q .tmp/s3buckets.txt; then
- printf "%b[!] Failed to process s3buckets_tmp.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to process s3buckets_tmp.txt."
fi
if ! sed_i '/^$/d' .tmp/s3buckets.txt; then
- printf "%b[!] Failed to clean s3buckets.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to clean s3buckets.txt."
fi
fi
fi
# Initialize the output file in the subdomains folder
if ! : >subdomains/cloudhunter_open_buckets.txt; then
- printf "%b[!] Failed to initialize cloudhunter_open_buckets.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to initialize cloudhunter_open_buckets.txt."
fi
# Determine the CloudHunter permutations flag based on the config
@@ -2008,7 +1998,7 @@ function s3buckets() {
permutation_file=""
;;
*)
- printf "%b[!] Invalid value for CLOUDHUNTER_PERMUTATION: %s.%b\n" "$bred" "$CLOUDHUNTER_PERMUTATION" "$reset"
+ print_warnf "Invalid value for CLOUDHUNTER_PERMUTATION: %s." "$CLOUDHUNTER_PERMUTATION"
return 1
;;
esac
@@ -2051,22 +2041,22 @@ function s3buckets() {
printf "Processing domain: %s\n" "$domain" >>"$LOGFILE"
(
if ! cd "$tools/CloudHunter"; then
- printf "%b[!] Failed to cd to %s.%b\n" "$bred" "$tools/CloudHunter" "$reset"
+ print_warnf "Failed to cd to %s." "$tools/CloudHunter"
return 1
fi
if [[ -n "$permutation_file" ]]; then
if ! PYTHONWARNINGS=ignore "${tools}/CloudHunter/venv/bin/python3" -W ignore ./cloudhunter.py "$PERMUTATION_FLAG" "$permutation_file" -r ./resolvers.txt -t 50 "$domain"; then
- printf "%b[!] CloudHunter command failed for domain %s.%b\n" "$bred" "$domain" "$reset"
+ print_warnf "CloudHunter command failed for domain %s." "$domain"
fi
elif ! PYTHONWARNINGS=ignore "${tools}/CloudHunter/venv/bin/python3" -W ignore ./cloudhunter.py -r ./resolvers.txt -t 50 "$domain"; then
- printf "%b[!] CloudHunter command failed for domain %s.%b\n" "$bred" "$domain" "$reset"
+ print_warnf "CloudHunter command failed for domain %s." "$domain"
fi
) >>"$dir/subdomains/cloudhunter_open_buckets.txt" 2>>"$LOGFILE"
# Process CloudHunter results
if [[ -s "subdomains/cloudhunter_open_buckets.txt" ]]; then
if ! NUMOFLINES1=$(cat subdomains/cloudhunter_open_buckets.txt 2>>"$LOGFILE" | anew subdomains/cloud_assets.txt | wc -l); then
- printf "%b[!] Failed to process cloudhunter_open_buckets.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to process cloudhunter_open_buckets.txt."
NUMOFLINES1=0
fi
if [[ $NUMOFLINES1 -gt 0 ]]; then
@@ -2079,7 +2069,7 @@ function s3buckets() {
# Process s3buckets results
if [[ -s ".tmp/s3buckets.txt" ]]; then
if ! NUMOFLINES2=$(cat .tmp/s3buckets.txt 2>>"$LOGFILE" | grep -aiv "not_exist" | grep -aiv "Warning:" | grep -aiv "invalid_name" | grep -aiv "^http" | awk 'NF' | anew subdomains/s3buckets.txt | sed '/^$/d' | wc -l); then
- printf "%b[!] Failed to process s3buckets.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to process s3buckets.txt."
NUMOFLINES2=0
fi
if [[ $NUMOFLINES2 -gt 0 ]]; then
@@ -2191,7 +2181,7 @@ function geo_info() {
# Create necessary directories
if ! mkdir -p hosts; then
- printf "%b[!] Failed to create hosts directory.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create hosts directory."
return 1
fi
@@ -2226,7 +2216,7 @@ function geo_info() {
if [[ -s $ips_file ]]; then
if ! touch "${dir}/hosts/ipinfo.txt"; then
- printf "%b[!] Failed to create ipinfo.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create ipinfo.txt."
fi
while IFS= read -r ip; do
diff --git a/modules/utils.sh b/modules/utils.sh
index 3e5235a..d9cb114 100644
--- a/modules/utils.sh
+++ b/modules/utils.sh
@@ -103,30 +103,30 @@ function validate_config() {
# Check conflicting configs
if [[ ${VULNS_GENERAL:-false} == true && ${SUBDOMAINS_GENERAL:-false} == false ]]; then
- printf "%b[WARN] VULNS_GENERAL=true but SUBDOMAINS_GENERAL=false -- vulnerability scans need subdomain data%b\n" "$yellow" "$reset"
+ print_warnf "VULNS_GENERAL=true but SUBDOMAINS_GENERAL=false -- vulnerability scans need subdomain data"
warnings=$((warnings + 1))
fi
# Validate numeric thread/rate variables
for var in FFUF_THREADS HTTPX_THREADS DALFOX_THREADS KATANA_THREADS HTTPX_RATELIMIT NUCLEI_RATELIMIT FFUF_RATELIMIT; do
if [[ -n "${!var:-}" && ! "${!var}" =~ ^[0-9]+$ ]]; then
- printf "%b[ERROR] %s must be numeric, got: %s%b\n" "$bred" "$var" "${!var}" "$reset"
+ print_errorf "%s must be numeric, got: %s" "$var" "${!var}"
errors=$((errors + 1))
fi
done
# Check Axiom tool availability if enabled
if [[ ${AXIOM:-false} == true ]] && ! command -v axiom-scan >/dev/null 2>&1; then
- printf "%b[WARN] AXIOM=true but axiom-scan not found in PATH%b\n" "$yellow" "$reset"
+ print_warnf "AXIOM=true but axiom-scan not found in PATH"
warnings=$((warnings + 1))
fi
if [[ $errors -gt 0 ]]; then
- printf "%b[ERROR] Configuration has %d error(s). Please fix before running.%b\n" "$bred" "$errors" "$reset"
+ print_errorf "Configuration has %d error(s). Please fix before running." "$errors"
return $E_CONFIG
fi
if [[ $warnings -gt 0 ]]; then
- printf "%b[INFO] Configuration has %d warning(s).%b\n" "$yellow" "$warnings" "$reset"
+ print_notice INFO "config" "Configuration has ${warnings} warning(s)."
fi
return 0
}
@@ -349,7 +349,15 @@ function run_command() {
if [[ "${ADAPTIVE_RATE_LIMIT:-false}" == "true" ]]; then
run_with_adaptive_rate "$@"
else
- "$@"
+ if [[ -n "${DEBUG_LOG:-}" ]]; then
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
+ "$@" 2> >(tee -a "$DEBUG_LOG" >&2)
+ else
+ "$@" 2>>"$DEBUG_LOG"
+ fi
+ else
+ "$@"
+ fi
fi
}
@@ -506,21 +514,18 @@ function sanitize_domain() {
# Check if domain is empty after sanitization
if [[ -z "$sanitized" ]]; then
- printf "%b[%s] ERROR: Invalid domain after sanitization: '%s'%b\n" \
- "$bred" "$(date +'%Y-%m-%d %H:%M:%S')" "$input_domain" "$reset" >&2
+ print_errorf "Invalid domain after sanitization: '%s'" "$input_domain"
return 1
fi
# Check for basic domain format (at least one dot for TLD)
if [[ ! "$sanitized" =~ \. ]]; then
- printf "%b[%s] WARNING: Domain '%s' has no TLD, may be invalid%b\n" \
- "$yellow" "$(date +'%Y-%m-%d %H:%M:%S')" "$sanitized" "$reset" >&2
+ print_warnf "Domain '%s' has no TLD, may be invalid" "$sanitized"
fi
# If sanitization removed characters, warn user
if [[ "$input_domain" != "$sanitized" ]]; then
- printf "%b[%s] INFO: Domain sanitized from '%s' to '%s'%b\n" \
- "$yellow" "$(date +'%Y-%m-%d %H:%M:%S')" "$input_domain" "$sanitized" "$reset" >&2
+ print_notice INFO "sanitize_domain" "Domain sanitized from '${input_domain}' to '${sanitized}'"
fi
echo "$sanitized"
@@ -537,8 +542,7 @@ function sanitize_ip() {
sanitized=$(echo "$input" | tr -cd '0-9./,')
if [[ -z "$sanitized" ]]; then
- printf "%b[%s] ERROR: Invalid IP/CIDR after sanitization: '%s'%b\n" \
- "$bred" "$(date +'%Y-%m-%d %H:%M:%S')" "$input" "$reset" >&2
+ print_errorf "Invalid IP/CIDR after sanitization: '%s'" "$input"
return 1
fi
@@ -573,9 +577,8 @@ function check_secrets_permissions() {
# Check if file is readable by group or others
if [[ -n "$perms" && "$perms" != "600" && "$perms" != "400" ]]; then
- printf "%b[%s] WARNING: Insecure permissions (%s) on sensitive file: %s%b\n" \
- "$yellow" "$(date +'%Y-%m-%d %H:%M:%S')" "$perms" "$file" "$reset" >&2
- printf "%b Recommended: chmod 600 %s%b\n" "$yellow" "$file" "$reset" >&2
+ print_warnf "Insecure permissions (%s) on sensitive file: %s" "$perms" "$file"
+ print_notice WARN "config" "Recommended: chmod 600 ${file}"
((warnings++))
fi
fi
diff --git a/modules/vulns.sh b/modules/vulns.sh
index 15decc3..479f3b3 100644
--- a/modules/vulns.sh
+++ b/modules/vulns.sh
@@ -504,7 +504,7 @@ function spraying() {
# Ensure portscan_active.gnmap exists and is not empty
if [[ ! -s "$dir/hosts/portscan_active.gnmap" ]]; then
- printf "%b[!] File $dir/hosts/portscan_active.gnmap does not exist or is empty.%b\n" "$bred" "$reset"
+ print_warnf "File %s/hosts/portscan_active.gnmap does not exist or is empty." "$dir"
end_func "Port scan results missing. Password Spraying aborted." "${FUNCNAME[0]}"
return 1
fi
@@ -601,7 +601,7 @@ function 4xxbypass() {
# Navigate to nomore403 tool directory
if ! pushd "${tools}/nomore403" >/dev/null; then
- printf "%b[!] Failed to navigate to nomore403 directory.%b\n" "$bred" "$reset"
+ print_warnf "Failed to navigate to nomore403 directory."
end_func "Failed to navigate to nomore403 directory during 403 Bypass." "${FUNCNAME[0]}"
return 1
fi
@@ -611,7 +611,7 @@ function 4xxbypass() {
# Return to the original directory
if ! popd >/dev/null; then
- printf "%b[!] Failed to return to the original directory.%b\n" "$bred" "$reset"
+ print_warnf "Failed to return to the original directory."
end_func "Failed to return to the original directory during 403 Bypass." "${FUNCNAME[0]}"
return 1
fi
@@ -670,7 +670,7 @@ function prototype_pollution() {
end_func "Results are saved in vulns/prototype_pollution.txt" "${FUNCNAME[0]}"
else
- printf "%b[!] File webs/url_extract_nodupes.txt is missing or empty.%b\n" "$bred" "$reset"
+ print_warnf "File webs/url_extract_nodupes.txt is missing or empty."
end_func "File webs/url_extract_nodupes.txt is missing or empty." "${FUNCNAME[0]}"
return 1
fi
@@ -766,7 +766,7 @@ function webcache() {
# Navigate to Web-Cache-Vulnerability-Scanner tool directory
if ! pushd "${tools}/Web-Cache-Vulnerability-Scanner" >/dev/null; then
- printf "%b[!] Failed to navigate to Web-Cache-Vulnerability-Scanner directory.%b\n" "$bred" "$reset"
+ print_warnf "Failed to navigate to Web-Cache-Vulnerability-Scanner directory."
end_func "Failed to navigate to Web-Cache-Vulnerability-Scanner directory during Web Cache Poisoning Checks." "${FUNCNAME[0]}"
return 1
fi
@@ -777,7 +777,7 @@ function webcache() {
# Return to the original directory
if ! popd >/dev/null; then
- printf "%b[!] Failed to return to the original directory.%b\n" "$bred" "$reset"
+ print_warnf "Failed to return to the original directory."
end_func "Failed to return to the original directory during Web Cache Poisoning Checks." "${FUNCNAME[0]}"
return 1
fi
@@ -857,7 +857,7 @@ function fuzzparams() {
if [[ $FARADAY == true ]]; then
# Check if the Faraday server is running
if ! faraday-cli status 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] Faraday server is not running. Skipping Faraday integration.%b\n" "$bred" "$reset"
+ print_warnf "Faraday server is not running. Skipping Faraday integration."
else
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
diff --git a/modules/web.sh b/modules/web.sh
index 923d59d..cc17885 100644
--- a/modules/web.sh
+++ b/modules/web.sh
@@ -83,22 +83,9 @@ print_webs_summary() {
[[ -s "$webs_file" ]] || return 0
sort -u "$webs_file" -o "$webs_file" 2>/dev/null || true
- local web_count shown max_show
+ local web_count
web_count=$(wc -l <"$webs_file" | tr -d ' ')
- max_show=10
- [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && max_show=$web_count
-
- printf " Total: %s webs\n" "$web_count"
- shown=0
- while IFS= read -r web; do
- shown=$((shown + 1))
- if [[ $shown -le $max_show ]]; then
- printf " %s\n" "$web"
- else
- printf " ... and %d more (see %s)\n" "$((web_count - max_show))" "$webs_file"
- break
- fi
- done <"$webs_file"
+ print_artifacts "${web_count} hosts -> ${webs_file}"
}
###############################################################################
@@ -160,7 +147,7 @@ function webprobe_simple() {
# Remove out-of-scope entries
if [[ -s $outOfScope_file ]]; then
if ! deleteOutScoped "$outOfScope_file" .tmp/probed_tmp.txt; then
- printf "%b[!] Failed to delete out-of-scope entries.%b\n" "$bred" "$reset"
+ print_warnf "Failed to delete out-of-scope entries."
fi
fi
@@ -168,7 +155,7 @@ function webprobe_simple() {
# Count new websites
if ! NUMOFLINES=$(anew webs/webs.txt <.tmp/probed_tmp.txt 2>/dev/null | sed '/^$/d' | wc -l); then
- printf "%b[!] Failed to count new websites.%b\n" "$bred" "$reset"
+ print_warnf "Failed to count new websites."
NUMOFLINES=0
fi
@@ -256,18 +243,13 @@ function webprobe_full() {
# Count new websites
if ! NUMOFLINES=$(anew webs/webs_uncommon_ports.txt <.tmp/probed_uncommon_ports_tmp.txt | sed '/^$/d' | wc -l); then
- printf "%b[!] Failed to count new websites.%b\n" "$bred" "$reset"
+ print_warnf "Failed to count new websites."
NUMOFLINES=0
fi
# Notify user
notification "Uncommon web ports: ${NUMOFLINES} new websites" "good"
- # Display new uncommon ports websites
- if [[ -s "webs/webs_uncommon_ports.txt" ]]; then
- cat "webs/webs_uncommon_ports.txt"
- fi
-
# Update webs_all.txt
cat webs/webs.txt webs/webs_uncommon_ports.txt 2>/dev/null | anew -q webs/webs_all.txt
@@ -381,8 +363,8 @@ function favicon() {
# Navigate to the fav-up tool directory
if ! pushd "${tools}/fav-up" >/dev/null; then
- printf "%b[!] Failed to change directory to %s in %s @ line %s.%b\n" \
- "$bred" "${tools}/fav-up" "${FUNCNAME[0]}" "${LINENO}" "$reset"
+ print_warnf "Failed to change directory to %s in %s @ line %s." \
+ "${tools}/fav-up" "${FUNCNAME[0]}" "${LINENO}"
return 1
fi
@@ -414,8 +396,8 @@ function favicon() {
# Return to the original directory
if ! popd >/dev/null; then
- printf "%b[!] Failed to return to the previous directory in %s @ line %s.%b\n" \
- "$bred" "${FUNCNAME[0]}" "${LINENO}" "$reset"
+ print_warnf "Failed to return to the previous directory in %s @ line %s." \
+ "${FUNCNAME[0]}" "${LINENO}"
fi
end_func "Results are saved in hosts/favicontest.txt" "${FUNCNAME[0]}"
@@ -480,11 +462,10 @@ function portscan() {
ips_nocdn_count=$(sort -u ".tmp/ips_nocdn.txt" | wc -l | tr -d ' ')
fi
- _print_msg INFO "Resolved IP addresses (No CDN): ${ips_nocdn_count}"
if ((ips_nocdn_count > 0)); then
- sort -u ".tmp/ips_nocdn.txt"
+ _print_msg INFO "Resolved IP addresses (No CDN): ${ips_nocdn_count} (see .tmp/ips_nocdn.txt)"
else
- printf " None\n"
+ _print_msg INFO "Resolved IP addresses (No CDN): none"
fi
printf "\n"
@@ -504,12 +485,12 @@ function portscan() {
if [[ $PORTSCAN_PASSIVE == true ]]; then
if [[ ! -f $ips_file ]]; then
- printf "%b[!] File %s does not exist.%b\n" "$bred" "$ips_file" "$reset"
+ print_warnf "File %s does not exist." "$ips_file"
else
json_array=()
while IFS= read -r cip; do
if ! json_result=$(curl -s "https://internetdb.shodan.io/${cip}"); then
- printf "%b[!] Failed to retrieve data for IP %s.%b\n" "$bred" "$cip" "$reset"
+ print_warnf "Failed to retrieve data for IP %s." "$cip"
else
json_array+=("$json_result")
fi
@@ -523,7 +504,7 @@ function portscan() {
done
formatted_json+="]"
if ! echo "$formatted_json" >"${dir}/hosts/portscan_shodan.txt"; then
- printf "%b[!] Failed to write portscan_shodan.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to write portscan_shodan.txt."
fi
fi
fi
@@ -570,7 +551,7 @@ function portscan() {
if [[ $FARADAY == true ]]; then
# Check if the Faraday server is running
if ! faraday-cli status 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] Faraday server is not running. Skipping Faraday integration.%b\n" "$bred" "$reset"
+ print_warnf "Faraday server is not running. Skipping Faraday integration."
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
@@ -580,11 +561,10 @@ function portscan() {
if [[ -s "hosts/webs.txt" ]]; then
if ! NUMOFLINES=$(wc -l <hosts/webs.txt); then
- printf "%b[!] Failed to count lines in hosts/webs.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to count lines in hosts/webs.txt."
NUMOFLINES=0
fi
notification "Webs detected from port scan: ${NUMOFLINES} new websites" "good"
- cat hosts/webs.txt
append_assets_from_file web url hosts/webs.txt
fi
@@ -676,7 +656,7 @@ function waf_checks() {
# Count the number of websites protected by WAF
if ! NUMOFLINES=$(sed '/^$/d' "webs/webs_wafs.txt" 2>>"$LOGFILE" | wc -l); then
- printf "%b[!] Failed to count lines in webs_wafs.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to count lines in webs_wafs.txt."
NUMOFLINES=0
fi
@@ -747,7 +727,9 @@ _nuclei_parse_results() {
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"
+ local _count
+ _count=$(wc -l <"nuclei_output/${crit}.txt" | tr -d ' ')
+ _print_status OK "nuclei_${crit}" "${_count} findings -> nuclei_output/${crit}.txt"
fi
fi
}
@@ -829,7 +811,7 @@ function nuclei_check() {
# Faraday integration
if [[ $FARADAY == true ]]; then
if ! faraday-cli status 2>>"$LOGFILE" >/dev/null; then
- printf "%b[!] Faraday server is not running. Skipping Faraday integration.%b\n" "$bred" "$reset"
+ print_warnf "Faraday server is not running. Skipping Faraday integration."
else
# Report all severity levels to Faraday
IFS=',' read -ra severity_array <<<"$NUCLEI_SEVERITY"
@@ -1019,7 +1001,7 @@ function fuzz() {
# Handle multi mode initialization
if [[ -n $multi ]] && [[ ! -f "$dir/webs/webs.txt" ]]; then
- printf "%b\n" "$domain" >"$dir/webs/webs.txt" || printf "%b[!] Failed to create webs.txt.%b\n" "$bred" "$reset"
+ printf "%b\n" "$domain" >"$dir/webs/webs.txt" || print_warnf "Failed to create webs.txt."
touch webs/webs_uncommon_ports.txt 2>>"$LOGFILE" || true
fi
@@ -1110,7 +1092,7 @@ function cms_scanner() {
# Create necessary directories
if ! mkdir -p .tmp/fuzzing webs cms; then
- printf "%b[!] Failed to create directories.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create directories."
return 1
fi
@@ -1352,7 +1334,7 @@ function urlchecks() {
if [[ -s ".tmp/url_extract_uddup.txt" ]]; then
if ! NUMOFLINES=$(anew webs/url_extract.txt <.tmp/url_extract_uddup.txt | sed '/^$/d' | wc -l); then
- printf "%b[!] Failed to update url_extract.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to update url_extract.txt."
NUMOFLINES=0
fi
notification "${NUMOFLINES} new URLs with parameters" "info"
@@ -1391,7 +1373,7 @@ function url_gf() {
# Create necessary directories
if ! mkdir -p .tmp webs gf; then
- printf "%b[!] Failed to create directories.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create directories."
return 1
fi
@@ -1462,7 +1444,7 @@ function url_ext() {
# Create necessary directories
if ! mkdir -p .tmp webs gf; then
- printf "%b[!] Failed to create directories.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create directories."
return 1
fi
@@ -1478,7 +1460,7 @@ function url_ext() {
# Initialize the output file
if ! : >webs/urls_by_ext.txt; then
- printf "%b[!] Failed to initialize webs/urls_by_ext.txt.%b\n" "$bred" "$reset"
+ print_warnf "Failed to initialize webs/urls_by_ext.txt."
fi
# Iterate over extensions and extract matching URLs
@@ -1526,7 +1508,7 @@ function jschecks() {
# Create necessary directories
if ! mkdir -p .tmp webs subdomains js; then
- printf "%b[!] Failed to create directories.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create directories."
return 1
fi
@@ -1541,7 +1523,7 @@ function jschecks() {
if [[ -s ".tmp/url_extract_js.txt" ]]; then
- printf "%bRunning: Fetching URLs 1/6%b\n" "$yellow" "$reset"
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%bRunning: Fetching URLs 1/6%b\n" "$yellow" "$reset"
if [[ $AXIOM != true ]]; then
subjs -ua "Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0" -c 40 <.tmp/url_extract_js.txt \
| grep -F "$domain" \
@@ -1559,7 +1541,7 @@ function jschecks() {
urless <.tmp/url_extract_js.txt \
| anew -q js/url_extract_js.txt 2>>"$LOGFILE" >/dev/null
- printf "%bRunning: Resolving JS URLs 2/6%b\n" "$yellow" "$reset"
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%bRunning: Resolving JS URLs 2/6%b\n" "$yellow" "$reset"
if [[ $AXIOM != true ]]; then
if [[ -s "js/url_extract_js.txt" ]]; then
httpx -follow-redirects -random-agent -silent -timeout "$HTTPX_TIMEOUT" -threads "$HTTPX_THREADS" \
@@ -1578,9 +1560,9 @@ function jschecks() {
fi
fi
- printf "%bRunning: Extracting JS from sourcemaps 3/6%b\n" "$yellow" "$reset"
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%bRunning: Extracting JS from sourcemaps 3/6%b\n" "$yellow" "$reset"
if ! mkdir -p .tmp/sourcemapper; then
- printf "%b[!] Failed to create sourcemapper directory.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create sourcemapper directory."
fi
if [[ -s "js/js_livelinks.txt" ]]; then
interlace -tL js/js_livelinks.txt -threads "$INTERLACE_THREADS" \
@@ -1597,7 +1579,7 @@ function jschecks() {
find .tmp/sourcemapper/ \( -name "*.js" -o -name "*.ts" \) -type f \
| jsluice urls | jq -r .url | anew -q .tmp/js_endpoints.txt || true
- printf "%bRunning: Gathering endpoints 4/6%b\n" "$yellow" "$reset"
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%bRunning: Gathering endpoints 4/6%b\n" "$yellow" "$reset"
if [[ -s "js/js_livelinks.txt" ]]; then
xnLinkFinder -i js/js_livelinks.txt -sf subdomains/subdomains.txt -d "$XNLINKFINDER_DEPTH" \
-o .tmp/js_endpoints.txt 2>>"$LOGFILE" >/dev/null
@@ -1608,7 +1590,7 @@ function jschecks() {
cat .tmp/js_endpoints.txt | anew -q js/js_endpoints.txt || true
fi
- printf "%bRunning: Gathering secrets 5/6%b\n" "$yellow" "$reset"
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%bRunning: Gathering secrets 5/6%b\n" "$yellow" "$reset"
if [[ -s "js/js_livelinks.txt" ]]; then
if [[ $AXIOM != true ]]; then
cat js/js_livelinks.txt | mantra -ua \"$HEADER\" -s | anew -q js/js_secrets.txt 2>>"$LOGFILE" >/dev/null || true
@@ -1627,7 +1609,7 @@ function jschecks() {
find .tmp/sourcemapper/ -type f -name "*.js" | jsluice secrets -j --patterns="${tools}/jsluice_patterns.json" | anew -q js/js_secrets_jsmap_jsluice.txt
fi
- printf "%bRunning: Building wordlist 6/6%b\n" "$yellow" "$reset"
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%bRunning: Building wordlist 6/6%b\n" "$yellow" "$reset"
if [[ -s "js/js_livelinks.txt" ]]; then
if [[ -n "${GETJSWORDS_VENV:-}" ]]; then
if [[ -f "${GETJSWORDS_VENV}/bin/activate" ]]; then
@@ -1765,7 +1747,7 @@ function wordlist_gen_roboxtractor() {
# Create necessary directories
if ! mkdir -p .tmp webs gf; then
- printf "%b[!] Failed to create directories.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create directories."
return 1
fi
@@ -1816,7 +1798,7 @@ function password_dict() {
# Create necessary directories
if ! mkdir -p "$dir/webs"; then
- printf "%b[!] Failed to create directories.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create directories."
return 1
fi
@@ -1858,7 +1840,7 @@ function brokenLinks() {
# Create necessary directories
if ! mkdir -p .tmp webs vulns; then
- printf "%b[!] Failed to create directories.%b\n" "$bred" "$reset"
+ print_warnf "Failed to create directories."
return 1
fi
diff --git a/reconftw.sh b/reconftw.sh
index e3665e0..8ed3af3 100755
--- a/reconftw.sh
+++ b/reconftw.sh
@@ -112,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,no-color,log-format:' -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,gen-resolvers,export:,report-only,no-report,parallel-log:,quiet,verbose,no-color,log-format:,show-cache,banner,no-banner,legal' -n 'reconFTW' -- "$@")
exit_status=$?
if [[ $exit_status -ne 0 ]]; then
@@ -124,6 +124,9 @@ fi
eval set -- "$PROGARGS"
unset PROGARGS
CLI_PARALLEL_MODE=""
+SHOW_CACHE=false
+SHOW_BANNER=false
+SHOW_LEGAL=false
while true; do
case "$1" in
@@ -132,14 +135,12 @@ while true; do
target_input="$2"
if [[ "$target_input" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(/[0-9]+)?$ ]]; then
if ! domain=$(sanitize_ip "$target_input"); then
- printf "%b[%s] ERROR: Invalid IP/CIDR provided: '%s'%b\n" \
- "$bred" "$(date +'%Y-%m-%d %H:%M:%S')" "$target_input" "$reset"
+ print_errorf "Invalid IP/CIDR provided: '%s'" "$target_input"
exit 1
fi
else
if ! domain=$(sanitize_domain "$target_input"); then
- printf "%b[%s] ERROR: Invalid domain provided: '%s'%b\n" \
- "$bred" "$(date +'%Y-%m-%d %H:%M:%S')" "$target_input" "$reset"
+ print_errorf "Invalid domain provided: '%s'" "$target_input"
exit 1
fi
fi
@@ -155,10 +156,8 @@ while true; do
'-l' | '--list')
list="$2"
if ! validate_file_readable "$list"; then
- printf "%b[%s] ERROR: List file not found or not readable: '%s'%b\n" \
- "$bred" "$(date +'%Y-%m-%d %H:%M:%S')" "$list" "$reset" >&2
- printf "%bUsage: -l <file> where file contains one target per line%b\n" \
- "$yellow" "$reset" >&2
+ print_errorf "List file not found or not readable: '%s'" "$list"
+ _print_msg WARN "Usage: -l <file> where file contains one target per line"
exit 1
fi
while IFS= read -r t; do
@@ -171,8 +170,7 @@ while true; do
'-x')
outOfScope_file=$2
if [[ -n "$outOfScope_file" ]] && ! validate_file_readable "$outOfScope_file"; then
- printf "%b[%s] ERROR: Out-of-scope file not found or not readable: '%s'%b\n" \
- "$bred" "$(date +'%Y-%m-%d %H:%M:%S')" "$outOfScope_file" "$reset" >&2
+ print_errorf "Out-of-scope file not found or not readable: '%s'" "$outOfScope_file"
exit 1
fi
shift 2
@@ -181,8 +179,7 @@ while true; do
'-i')
inScope_file=$2
if [[ -n "$inScope_file" ]] && ! validate_file_readable "$inScope_file"; then
- printf "%b[%s] ERROR: In-scope file not found or not readable: '%s'%b\n" \
- "$bred" "$(date +'%Y-%m-%d %H:%M:%S')" "$inScope_file" "$reset" >&2
+ print_errorf "In-scope file not found or not readable: '%s'" "$inScope_file"
exit 1
fi
shift 2
@@ -232,6 +229,26 @@ while true; do
shift 2
continue
;;
+ '--show-cache')
+ SHOW_CACHE=true
+ shift
+ continue
+ ;;
+ '--banner')
+ SHOW_BANNER=true
+ shift
+ continue
+ ;;
+ '--no-banner')
+ NO_BANNER=true
+ shift
+ continue
+ ;;
+ '--legal')
+ SHOW_LEGAL=true
+ shift
+ continue
+ ;;
'-z' | '--zen')
opt_mode='z'
shift
@@ -342,11 +359,15 @@ while true; do
shift
continue
;;
+ '--gen-resolvers')
+ CLI_GENERATE_RESOLVERS=true
+ shift
+ continue
+ ;;
'--export')
CLI_EXPORT_FORMAT="$2"
if [[ ! "$CLI_EXPORT_FORMAT" =~ ^(json|html|csv|all)$ ]]; then
- printf "%b[%s] ERROR: Invalid --export value '%s' (allowed: json|html|csv|all)%b\n" \
- "$bred" "$(date +'%Y-%m-%d %H:%M:%S')" "$CLI_EXPORT_FORMAT" "$reset" >&2
+ print_errorf "Invalid --export value '%s' (allowed: json|html|csv|all)" "$CLI_EXPORT_FORMAT"
exit 1
fi
shift 2
@@ -357,11 +378,15 @@ while true; do
shift
continue
;;
+ '--no-report')
+ NO_REPORT=true
+ shift
+ continue
+ ;;
'--parallel-log')
CLI_PARALLEL_LOG_MODE="$2"
if [[ ! "$CLI_PARALLEL_LOG_MODE" =~ ^(summary|tail|full)$ ]]; then
- printf "%b[%s] ERROR: Invalid --parallel-log value '%s' (allowed: summary|tail|full)%b\n" \
- "$bred" "$(date +'%Y-%m-%d %H:%M:%S')" "$CLI_PARALLEL_LOG_MODE" "$reset" >&2
+ print_errorf "Invalid --parallel-log value '%s' (allowed: summary|tail|full)" "$CLI_PARALLEL_LOG_MODE"
exit 1
fi
shift 2
@@ -385,14 +410,14 @@ while true; do
'--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
+ print_errorf "Invalid --log-format value '%s' (allowed: plain|jsonl)" "$CLI_LOG_FORMAT"
exit 1
fi
shift 2
continue
;;
'--help' | '-h')
+ HELP_REQUESTED=true
break
;;
*)
@@ -410,7 +435,7 @@ SCRIPTPATH="$(
pwd -P
)"
. "${SCRIPTPATH}"/reconftw.cfg || {
- echo "Error importing reconftw.cfg"
+ _print_error "Error importing reconftw.cfg"
exit 1
}
@@ -420,7 +445,7 @@ SCRIPTPATH="$(
if [[ -s $CUSTOM_CONFIG ]]; then
# shellcheck source=/home/six2dez/Tools/reconftw/custom_config.cfg
. "${CUSTOM_CONFIG}" || {
- echo "Error importing custom config"
+ _print_error "Error importing custom config"
exit 1
}
fi
@@ -438,6 +463,9 @@ fi
if [[ "${CLI_CACHE_REFRESH:-false}" == "true" ]]; then
CACHE_REFRESH=true
fi
+if [[ "${CLI_GENERATE_RESOLVERS:-false}" == "true" ]]; then
+ generate_resolvers=true
+fi
if [[ -n "${CLI_EXPORT_FORMAT:-}" ]]; then
EXPORT_FORMAT="${CLI_EXPORT_FORMAT}"
fi
@@ -462,6 +490,23 @@ if [[ -n "${CLI_NO_COLOR:-}" ]]; then
NO_COLOR=1
fi
+if [[ "${HELP_REQUESTED:-false}" == "true" ]]; then
+ help
+ exit 0
+fi
+
+if [[ "${NO_BANNER:-false}" == "true" ]]; then
+ SHOW_BANNER=false
+else
+ SHOW_BANNER=true
+fi
+
+if [[ "${NO_REPORT:-false}" == "true" ]]; then
+ EXPORT_FORMAT=""
+elif [[ -z "${EXPORT_FORMAT:-}" ]]; then
+ EXPORT_FORMAT="all"
+fi
+
if [[ $opt_deep ]]; then
DEEP=true
fi
@@ -496,16 +541,21 @@ else
fi
startdir=${PWD}
+SHOW_BANNER=${SHOW_BANNER:-true}
# Initialize UI layer after config and CLI overrides (before any output)
ui_init
-banner
-printf "\n\n" # Two empty lines after banner
-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"
-printf "\n"
+if [[ "${SHOW_BANNER:-false}" == "true" ]]; then
+ banner
+ printf "\n\n" # Two empty lines after banner
+fi
+if [[ "${SHOW_LEGAL:-false}" == "true" ]]; then
+ 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"
+ printf "\n"
+fi
check_version