Skip to content

reconFTW is a tool designed to perform automated recon on a target domain by running the best set of tools to perform scanning and finding out vulnerabilities

fixes web and sub_brute

six2dez051bfa2fedf6
diff --git a/README.md b/README.md
index ff44b57..47710f5 100644
--- a/README.md
+++ b/README.md
@@ -132,7 +132,8 @@ reconFTW is packed with features to make reconnaissance thorough and efficient.
- **Recursive Search**: Performs recursive passive or bruteforce enumeration combined ([dsieve](https://github.com/trickest/dsieve)).
- **Subdomain Takeover**: Detects vulnerable subdomains ([nuclei](https://github.com/projectdiscovery/nuclei) and [dnstake](https://github.com/pwnesia/dnstake)).
- **DNS Zone Transfer**: Checks for misconfigured DNS zone transfers ([dig](https://linux.die.net/man/1/dig)).
-- **Cloud Buckets**: Identifies misconfigured S3 buckets ([S3Scanner](https://github.com/sa7mon/S3Scanner) and [CloudHunter](https://github.com/belane/CloudHunter)).
+- **Cloud Buckets**: Identifies misconfigured cloud buckets and exposed storage assets ([S3Scanner](https://github.com/sa7mon/S3Scanner) and [cloud_enum](https://github.com/initstring/cloud_enum)).
+- **Cloud Coverage Note**: Cloud bucket checks no longer include Alibaba OSS coverage after replacing CloudHunter with cloud_enum.
- **Reverse IP Lookup**: Discovers subdomains via IP ranges ([hakip2host](https://github.com/hakluke/hakip2host)).
### Hosts
@@ -645,7 +646,8 @@ PASSWORD_DICT_ENGINE=cewler # cewler|pydictor
PASSWORD_MIN_LENGTH=5 # Min password length
PASSWORD_MAX_LENGTH=14 # Max password length
KATANA_HEADLESS_PROFILE=off # off|smart|full
-CLOUDHUNTER_PERMUTATION=NORMAL # Options: DEEP (very slow), NORMAL (slow), NONE
+CLOUD_ENUM_S3_PROFILE=optimized # optimized: quickscan (-qs, no -m/-b) | exhaustive: -m ${tools}/cloud_enum/enum_tools/fuzz.txt
+CLOUD_ENUM_S3_THREADS=20 # Threads used by cloud_enum in s3buckets/cloud enumeration
# Vulns
VULNS_GENERAL=false # Enable or disable the vulnerability module (very intrusive and slow)
diff --git a/config/reconftw_full.cfg b/config/reconftw_full.cfg
index 44dd20b..9f72673 100644
--- a/config/reconftw_full.cfg
+++ b/config/reconftw_full.cfg
@@ -37,6 +37,8 @@ SUBANALYTICS=true
SUBTAKEOVER=true
ZONETRANSFER=true
S3BUCKETS=true
+CLOUD_ENUM_S3_PROFILE=optimized
+CLOUD_ENUM_S3_THREADS=20
DEEP_WILDCARD_FILTER=true
# Web: full probing
diff --git a/config/reconftw_stealth.cfg b/config/reconftw_stealth.cfg
index 9971075..495c101 100644
--- a/config/reconftw_stealth.cfg
+++ b/config/reconftw_stealth.cfg
@@ -36,6 +36,8 @@ SUBANALYTICS=true
SUBTAKEOVER=false
ZONETRANSFER=false
S3BUCKETS=false
+CLOUD_ENUM_S3_PROFILE=optimized
+CLOUD_ENUM_S3_THREADS=20
DEEP_WILDCARD_FILTER=false
REVERSE_IP=false
diff --git a/install.sh b/install.sh
index 9a14f69..dd85440 100755
--- a/install.sh
+++ b/install.sh
@@ -269,7 +269,6 @@ declare -A pipxtools=(
["subwiz"]="hadriansecurity/subwiz"
["arjun"]="s0md3v/Arjun"
["gqlspection"]="doyensec/GQLSpection"
- ["cloud_enum"]="initstring/cloud_enum"
["postleaksNg"]="six2dez/postleaksNG"
["cewler"]="roys/cewler"
)
@@ -284,7 +283,7 @@ declare -A repos=(
["massdns"]="blechschmidt/massdns"
["testssl.sh"]="drwetter/testssl.sh"
["JSA"]="w9w/JSA"
- ["CloudHunter"]="belane/CloudHunter"
+ ["cloud_enum"]="initstring/cloud_enum"
["ultimate-nmap-parser"]="shifty0g/ultimate-nmap-parser"
["gitdorks_go"]="damit5/gitdorks_go"
["Web-Cache-Vulnerability-Scanner"]="Hackmanit/Web-Cache-Vulnerability-Scanner"
diff --git a/lib/common.sh b/lib/common.sh
index 9b0e422..8917d99 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -174,10 +174,45 @@ _ui_live_break_if_needed() {
fi
}
+_ui_human_output_enabled() {
+ if declare -F ui_human_output_enabled >/dev/null 2>&1; then
+ ui_human_output_enabled
+ return $?
+ fi
+ return 0
+}
+
+_ui_jsonl_enabled() {
+ if declare -F ui_is_jsonl >/dev/null 2>&1; then
+ ui_is_jsonl
+ return $?
+ fi
+ return 1
+}
+
+_truncate_with_ellipsis() {
+ local text="$1"
+ local max="${2:-0}"
+ if ! [[ "$max" =~ ^[0-9]+$ ]] || (( max < 1 )); then
+ printf "%s" "$text"
+ return 0
+ fi
+ if (( ${#text} <= max )); then
+ printf "%s" "$text"
+ return 0
+ fi
+ if (( max <= 3 )); then
+ printf "%s" "${text:0:max}"
+ return 0
+ fi
+ printf "%s..." "${text:0:max-3}"
+}
+
# Print a normalized task/status line
# Usage: print_task STATE module duration_seconds reason
print_task() {
[[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ _ui_human_output_enabled || return 0
_ui_live_break_if_needed
local state="$1" module="$2" duration="${3:-0}" reason="${4:-}"
local color=""
@@ -196,7 +231,18 @@ print_task() {
esac
local module_pad=26
+ local term_width=0
+ if declare -F ui_term_width >/dev/null 2>&1; then
+ term_width=$(ui_term_width)
+ fi
+ if [[ "$term_width" =~ ^[0-9]+$ ]] && ((term_width > 0)); then
+ local max_module_pad=$((term_width - 18))
+ ((max_module_pad < 12)) && max_module_pad=12
+ ((max_module_pad > 40)) && max_module_pad=40
+ module_pad="$max_module_pad"
+ fi
local mod="$module"
+ mod=$(_truncate_with_ellipsis "$mod" "$module_pad")
local pad=$((module_pad - ${#mod}))
((pad < 1)) && pad=1
local spaces
@@ -220,6 +266,7 @@ record_incident() {
}
print_incidents() {
+ _ui_human_output_enabled || return 0
local debug_log="${1:-}"
local count=${#INCIDENTS_ITEMS[@]}
((count == 0)) && return 0
@@ -237,9 +284,17 @@ print_incidents() {
# Print a compact artifacts line
# Usage: print_artifacts "file1" ["file2"...]
print_artifacts() {
- [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ if [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && ! _ui_jsonl_enabled; then
+ return 0
+ fi
local items="$*"
[[ -z "$items" ]] && return 0
+ if ! _ui_human_output_enabled; then
+ if declare -F ui_log_jsonl >/dev/null 2>&1; then
+ ui_log_jsonl "INFO" "artifacts" "Artifacts summary" "items=${items}"
+ fi
+ return 0
+ fi
printf "[INFO] Artifacts: %s\n" "$items"
}
@@ -248,6 +303,12 @@ print_artifacts() {
print_notice() {
local level="$1" module="$2" message="$3"
[[ -z "$module" ]] && module="notice"
+ if declare -F ui_log_jsonl >/dev/null 2>&1; then
+ ui_log_jsonl "$level" "$module" "$message"
+ fi
+ if ! _ui_human_output_enabled; then
+ return 0
+ fi
if [[ "$level" == "FAIL" ]] && [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]]; then
(OUTPUT_VERBOSITY=1; print_task "$level" "$module" "--" "$message")
else
@@ -307,6 +368,10 @@ _print_msg() {
INFO) color="${bblue:-}" ;;
*) color="${bblue:-}" ;;
esac
+ if declare -F ui_log_jsonl >/dev/null 2>&1; then
+ ui_log_jsonl "$level" "${FUNCNAME[1]:-module}" "$msg"
+ fi
+ _ui_human_output_enabled || return 0
if [[ "$level" == "INFO" ]] && [[ "${OUTPUT_VERBOSITY:-1}" -lt 2 ]]; then
return 0
fi
@@ -315,21 +380,47 @@ _print_msg() {
printf "%b[%s]%b %s\n" "$color" "$level" "${reset:-}" "$msg"
}
+# Print a warning message only once per run key.
+# Usage: warn_once "missing-tool-dnstake" "subtakeover: dnstake binary not found in PATH - install dnstake first"
+warn_once() {
+ local key="${1:-}"
+ shift || true
+ local msg="$*"
+ [[ -z "$key" || -z "$msg" ]] && return 1
+
+ if ! declare -p WARN_ONCE_KEYS >/dev/null 2>&1; then
+ declare -gA WARN_ONCE_KEYS=()
+ fi
+
+ if [[ "${WARN_ONCE_KEYS[$key]:-0}" == "1" ]]; then
+ return 1
+ fi
+
+ WARN_ONCE_KEYS["$key"]=1
+ _print_msg WARN "$msg"
+ return 0
+}
+
# Module start message with timestamp
# Usage: _print_module_start "OSINT"
_print_module_start() {
- [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
- if declare -F ui_live_progress_end >/dev/null 2>&1; then
- ui_live_progress_end
- fi
local title="${1^^}"
local ts
ts=$(date +'%Y-%m-%d %H:%M:%S')
-
- # Reset dry-run tracking for new module
+ # Reset dry-run tracking for new module.
if declare -F ui_dryrun_reset >/dev/null 2>&1; then
ui_dryrun_reset
fi
+ if declare -F ui_log_jsonl >/dev/null 2>&1; then
+ ui_log_jsonl "INFO" "$title" "Module started" "started=${ts}"
+ fi
+ if [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && ! _ui_jsonl_enabled; then
+ return 0
+ fi
+ _ui_human_output_enabled || return 0
+ if declare -F ui_live_progress_end >/dev/null 2>&1; then
+ ui_live_progress_end
+ fi
printf "\n%b── %s ───────────────────────────────────────────────────────────────%b\n" \
"${bgreen:-}" "$title" "${reset:-}"
@@ -339,13 +430,19 @@ _print_module_start() {
# Module end message with timestamp
# Usage: _print_module_end "OSINT"
_print_module_end() {
- [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
- if declare -F ui_live_progress_end >/dev/null 2>&1; then
- ui_live_progress_end
- fi
local title="${1^^}"
local ts
ts=$(date +'%Y-%m-%d %H:%M:%S')
+ if declare -F ui_log_jsonl >/dev/null 2>&1; then
+ ui_log_jsonl "INFO" "$title" "Module completed" "completed=${ts}"
+ fi
+ if [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && ! _ui_jsonl_enabled; then
+ return 0
+ fi
+ _ui_human_output_enabled || return 0
+ if declare -F ui_live_progress_end >/dev/null 2>&1; then
+ ui_live_progress_end
+ fi
# Show dry-run summary before completion timestamp
if declare -F ui_dryrun_summary >/dev/null 2>&1; then
@@ -365,10 +462,17 @@ _print_section() {
# Usage: _print_status OK "sub_passive" "12s"
# _print_status SKIP "sub_crt" "(disabled)"
_print_status() {
- [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ local jsonl_enabled=false
+ if _ui_jsonl_enabled; then
+ jsonl_enabled=true
+ fi
+ if [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && [[ "$jsonl_enabled" != "true" ]]; then
+ return 0
+ fi
local badge="$1" text="$2" detail="${3:-}"
local duration="0"
local reason=""
+ local hide_cache_human=false
if [[ -n "$detail" ]]; then
if [[ "$detail" =~ ^[0-9]+$ ]]; then
@@ -383,18 +487,30 @@ _print_status() {
fi
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
+ hide_cache_human=true
fi
- if [[ "$badge" == "INFO" ]] && [[ "${OUTPUT_VERBOSITY:-1}" -lt 2 ]]; then
+ if [[ "$badge" == "INFO" ]] && [[ "${OUTPUT_VERBOSITY:-1}" -lt 2 ]] && [[ "$jsonl_enabled" != "true" ]]; then
return 0
fi
if declare -F ui_count_inc >/dev/null 2>&1; then
ui_count_inc "$badge"
fi
+ if declare -F ui_log_jsonl >/dev/null 2>&1; then
+ ui_log_jsonl "$badge" "$text" "Status update" "duration=${duration}" "reason=${reason}"
+ fi
+ if ! _ui_human_output_enabled; then
+ 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
+ return 0
+ fi
+ if [[ "$hide_cache_human" == "true" ]]; then
+ return 0
+ fi
print_task "$badge" "$text" "$duration" "$reason"
if [[ "$badge" == "FAIL" ]]; then
[[ -z "$reason" ]] && reason="see debug.log"
@@ -408,6 +524,10 @@ _print_status() {
# Usage: _print_error "something failed"
_print_error() {
local msg="$1"
+ if declare -F ui_log_jsonl >/dev/null 2>&1; then
+ ui_log_jsonl "ERROR" "${FUNCNAME[1]:-module}" "$msg"
+ fi
+ _ui_human_output_enabled || return 0
_ui_live_break_if_needed
printf "%b[FAIL]%b %s\n" "${bred:-}" "${reset:-}" "$msg" >&2
}
@@ -416,6 +536,7 @@ _print_error() {
# Usage: _print_rule
_print_rule() {
[[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ _ui_human_output_enabled || return 0
printf "%b──────────────────────────────────────────────────────────────%b\n" "${bgreen:-}" "${reset:-}"
}
@@ -449,10 +570,12 @@ skip_notification() {
if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
_print_status "$badge" "$func_name" "0s"
- if [[ "$badge" == "SKIP" ]]; then
- printf " reason: %s\n" "$reason_code"
- elif [[ "$badge" == "CACHE" ]] && [[ "${SHOW_CACHE:-false}" == "true" ]]; then
- printf " reason: %s\n" "$reason_code"
+ if _ui_human_output_enabled; then
+ if [[ "$badge" == "SKIP" ]]; then
+ printf " reason: %s\n" "$reason_code"
+ elif [[ "$badge" == "CACHE" ]] && [[ "${SHOW_CACHE:-false}" == "true" ]]; then
+ printf " reason: %s\n" "$reason_code"
+ fi
fi
if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
if [[ "$badge" == "CACHE" ]]; then
@@ -540,8 +663,19 @@ run_tool() {
# Remove ANSI/control sequences from a text stream.
# Usage: some_command | strip_ansi_stream
strip_ansi_stream() {
- # CSI + OSC sequence stripping, keeping regular text intact.
- sed -E $'s/\x1B\\[[0-9;?]*[ -/]*[@-~]//g; s/\x1B\\][^\a]*(\a|\x1B\\\\)//g'
+ # Strip ANSI/OSC control sequences and normalize carriage-return updates.
+ # This keeps only the final segment of CR-updated lines and removes backspaces.
+ if command -v perl >/dev/null 2>&1; then
+ perl -pe '
+ s/\x1B\[[0-9;?]*[ -\/]*[@-~]//g;
+ s/\x1B\][^\x07]*(?:\x07|\x1B\\)//g;
+ s/.*\r//;
+ 1 while s/[^\x08]\x08//g;
+ s/\x08//g;
+ '
+ else
+ sed -E $'s/\x1B\\[[0-9;?]*[ -/]*[@-~]//g; s/\x1B\\][^\a]*(\a|\x1B\\\\)//g; s/.*\r//; :a; s/[^\x08]\x08//g; ta; s/\x08//g'
+ fi
}
# Run a command with periodic heartbeat status lines for long-running tasks.
@@ -577,7 +711,7 @@ run_with_heartbeat() {
run_command "$@" >>"$hb_log" 2>&1 &
local cmd_pid=$!
- if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && _ui_human_output_enabled; then
if declare -F ui_is_tty >/dev/null 2>&1 && ui_is_tty && declare -F ui_live_progress_begin >/dev/null 2>&1; then
use_live=true
ui_live_progress_begin
@@ -605,7 +739,7 @@ run_with_heartbeat() {
local rc=$?
elapsed=$(($(date +%s) - start_ts))
- if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]] && _ui_human_output_enabled; then
if [[ "$use_live" == true ]] && declare -F ui_live_progress_end >/dev/null 2>&1; then
ui_live_progress_end
else
@@ -669,12 +803,10 @@ filter_and_process() {
local count=0
if [[ -s "$input" ]]; then
- local escaped
- escaped=$(escape_domain_regex "$domain")
- count=$(grep "\\.${escaped}$\\|^${escaped}$" "$input" 2>/dev/null \
+ count=$(grep_domain "$input" "$domain" 2>/dev/null \
| anew "$output" 2>/dev/null \
| sed '/^$/d' \
- | wc -l | tr -d ' ')
+ | wc -l | tr -d ' ' || true)
fi
[[ "$count" =~ ^[0-9]+$ ]] || count=0
@@ -692,6 +824,15 @@ escape_domain_regex() {
printf '%s' "$1" | sed 's/[.[\*^$()+?{|]/\\&/g'
}
+# Build a robust ERE pattern that matches exact domain or any subdomain.
+# Usage: regex=$(domain_match_regex "example.com")
+domain_match_regex() {
+ local raw_domain="$1"
+ local escaped
+ escaped=$(escape_domain_regex "$raw_domain")
+ printf '(^|\\.)%s$' "$escaped"
+}
+
# Grep lines matching a domain (as subdomain or exact match) with proper escaping
# Usage: grep_domain input_file domain [extra_grep_flags...]
# Matches: "*.domain" and "domain" exactly (anchored)
@@ -699,9 +840,9 @@ grep_domain() {
local input="$1"
local raw_domain="$2"
shift 2
- local escaped
- escaped=$(escape_domain_regex "$raw_domain")
- grep "$@" "\.${escaped}$\|^${escaped}$" "$input"
+ local pattern
+ pattern=$(domain_match_regex "$raw_domain")
+ grep "$@" -E "$pattern" "$input"
}
###############################################################################
diff --git a/lib/parallel.sh b/lib/parallel.sh
index fe02681..9d209af 100644
--- a/lib/parallel.sh
+++ b/lib/parallel.sh
@@ -208,6 +208,14 @@ _parallel_emit_job_output() {
fi
_PARALLEL_LAST_BADGE="$badge"
+ if declare -F ui_human_output_enabled >/dev/null 2>&1 && ! ui_human_output_enabled; then
+ _print_status "$badge" "$func_name" "${duration}s"
+ if [[ -n "$reason_code" ]] && declare -F ui_log_jsonl >/dev/null 2>&1; then
+ ui_log_jsonl "INFO" "$func_name" "Status reason" "status=${badge}" "reason=${reason_code}"
+ fi
+ return 0
+ fi
+
# In quiet mode (OUTPUT_VERBOSITY==0), only show failures
if [[ "${OUTPUT_VERBOSITY:-1}" -eq 0 ]] && [[ "$badge" != "FAIL" ]]; then
return 0
@@ -287,11 +295,19 @@ _parallel_batch_summary() {
local batch_end
batch_end=$(date +%s)
local elapsed=$((batch_end - batch_start))
+ local jsonl_enabled=false
+ if declare -F ui_is_jsonl >/dev/null 2>&1 && ui_is_jsonl; then
+ jsonl_enabled=true
+ fi
- # Skip in quiet mode
- [[ "${OUTPUT_VERBOSITY:-1}" -eq 0 ]] && return 0
- # Skip batch envelope in summary mode at normal verbosity
- [[ "${PARALLEL_LOG_MODE:-summary}" == "summary" ]] && [[ "${OUTPUT_VERBOSITY:-1}" -lt 2 ]] && return 0
+ # Skip in quiet mode unless JSONL is enabled (events still useful to machines).
+ if [[ "${OUTPUT_VERBOSITY:-1}" -eq 0 ]] && [[ "$jsonl_enabled" != "true" ]]; then
+ return 0
+ fi
+ # Skip human batch envelope in summary mode at normal verbosity unless JSONL is enabled.
+ if [[ "${PARALLEL_LOG_MODE:-summary}" == "summary" ]] && [[ "${OUTPUT_VERBOSITY:-1}" -lt 2 ]] && [[ "$jsonl_enabled" != "true" ]]; then
+ return 0
+ fi
if declare -F ui_batch_end >/dev/null 2>&1; then
ui_batch_end "$ok" "$warn" "$fail" "$elapsed" "$skip" "$cache" "$completed" "$total"
@@ -373,7 +389,8 @@ parallel_funcs() {
if ((${#batch_pids[@]} == 0)); then
if declare -F ui_batch_start >/dev/null 2>&1; then
# Skip batch envelope in summary mode at normal verbosity - individual status lines suffice
- if [[ "$(_parallel_get_ui_mode)" != "clean" ]] && { [[ "${PARALLEL_LOG_MODE:-summary}" != "summary" ]] || [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; }; then
+ if { declare -F ui_is_jsonl >/dev/null 2>&1 && ui_is_jsonl; } \
+ || { [[ "$(_parallel_get_ui_mode)" != "clean" ]] && { [[ "${PARALLEL_LOG_MODE:-summary}" != "summary" ]] || [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; }; }; then
ui_batch_start "$batch_label" "$max_jobs"
fi
fi
diff --git a/lib/ui.sh b/lib/ui.sh
index 895fa98..4f3d282 100644
--- a/lib/ui.sh
+++ b/lib/ui.sh
@@ -9,6 +9,7 @@ declare -r _UI_SH_LOADED=1
_UI_IS_TTY=false
_UI_NO_COLOR=false
_UI_LOG_FORMAT="plain"
+_UI_JSONL_STRICT=false
_UI_OK_COUNT=0
_UI_WARN_COUNT=0
@@ -44,27 +45,85 @@ ui_init() {
fi
_UI_LOG_FORMAT="${LOG_FORMAT:-plain}"
+ case "$_UI_LOG_FORMAT" in
+ plain|jsonl|jsonl-strict) ;;
+ *) _UI_LOG_FORMAT="plain" ;;
+ esac
+ if [[ "$_UI_LOG_FORMAT" == "jsonl-strict" ]]; then
+ _UI_JSONL_STRICT=true
+ else
+ _UI_JSONL_STRICT=false
+ fi
}
ui_is_tty() {
[[ "$_UI_IS_TTY" == true ]]
}
+ui_is_jsonl() {
+ [[ "$_UI_LOG_FORMAT" == "jsonl" ]] || [[ "$_UI_LOG_FORMAT" == "jsonl-strict" ]]
+}
+
+ui_is_jsonl_strict() {
+ [[ "$_UI_JSONL_STRICT" == true ]]
+}
+
+ui_human_output_enabled() {
+ [[ "$_UI_JSONL_STRICT" != true ]]
+}
+
+ui_term_width() {
+ local width="${COLUMNS:-0}"
+ if ! [[ "$width" =~ ^[0-9]+$ ]] || ((width < 20)); then
+ if command -v tput >/dev/null 2>&1; then
+ width=$(tput cols 2>/dev/null || echo 0)
+ fi
+ fi
+ if ! [[ "$width" =~ ^[0-9]+$ ]] || ((width < 20)); then
+ width=80
+ fi
+ printf "%s" "$width"
+}
+
+ui_truncate_text() {
+ local text="$1"
+ local max="${2:-80}"
+ if ! [[ "$max" =~ ^[0-9]+$ ]] || ((max < 1)); then
+ printf "%s" "$text"
+ return 0
+ fi
+ if (( ${#text} <= max )); then
+ printf "%s" "$text"
+ return 0
+ fi
+ if (( max <= 3 )); then
+ printf "%s" "${text:0:max}"
+ return 0
+ fi
+ printf "%s..." "${text:0:max-3}"
+}
+
ui_live_progress_begin() {
+ ui_human_output_enabled || return 0
[[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
ui_is_tty || return 0
_UI_LIVE_ACTIVE=true
}
ui_live_progress_update() {
+ ui_human_output_enabled || return 0
[[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
ui_is_tty || return 0
local line="$1"
+ local width
+ width=$(ui_term_width)
+ line=$(ui_truncate_text "$line" "$width")
_UI_LIVE_ACTIVE=true
printf "\r %b%s%b\033[K" "${bblue:-}" "$line" "${reset:-}"
}
ui_live_progress_break() {
+ ui_human_output_enabled || return 0
[[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
ui_is_tty || return 0
[[ "$_UI_LIVE_ACTIVE" == true ]] || return 0
@@ -72,6 +131,7 @@ ui_live_progress_break() {
}
ui_live_progress_end() {
+ ui_human_output_enabled || return 0
[[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
ui_is_tty || return 0
if [[ "$_UI_LIVE_ACTIVE" == true ]]; then
@@ -113,21 +173,34 @@ ui_header() {
z) mode_label="ZEN" ;;
esac
+ ui_log_jsonl "INFO" "header" "Run header" \
+ "mode=${mode_label}" "target=${target}" "parallel=${parallel}" "jobs=${threads}" "outdir=${outdir}" "started=${started}"
+
+ [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ ui_human_output_enabled || return 0
+
local header_line
header_line=$(printf "reconftw %s by @six2dez | Authorized testing only" "${reconftw_version:-}")
+ local width
+ width=$(ui_term_width)
local header_rule=""
local i
- for ((i = 0; i < ${#header_line}; i++)); do
+ for ((i = 0; i < width; i++)); do
header_rule+="─"
done
+ header_line=$(ui_truncate_text "$header_line" "$width")
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"
+ local line
+ line=$(printf "Mode: %s | Target: %s | Profile: %s | Parallel: %s | Jobs: %s" \
+ "$mode_label" "$target" "$(basename "${profile}")" "$parallel" "$threads")
+ printf "%s\n" "$(ui_truncate_text "$line" "$width")"
+ line=$(printf "Output: %s" "$outdir")
+ printf "%s\n" "$(ui_truncate_text "$line" "$width")"
if [[ -n "${RECON_BEHIND_NAT:-}" ]] || [[ -n "${DNS_RESOLVER_SELECTED:-}" ]]; then
- printf "Network: behind_nat=%s | DNS: %s\n" "${RECON_BEHIND_NAT:-unknown}" "${DNS_RESOLVER_SELECTED:-unknown}"
+ line=$(printf "Network: behind_nat=%s | DNS: %s" "${RECON_BEHIND_NAT:-unknown}" "${DNS_RESOLVER_SELECTED:-unknown}")
+ printf "%s\n" "$(ui_truncate_text "$line" "$width")"
fi
if [[ -n "${PERF_PROFILE_INFO:-}" ]] || [[ -n "${DISK_SPACE_INFO:-}" ]]; then
local info_line=""
@@ -141,9 +214,11 @@ ui_header() {
info_line="${DISK_SPACE_INFO}"
fi
fi
- printf "System: %s\n" "$info_line"
+ line=$(printf "System: %s" "$info_line")
+ printf "%s\n" "$(ui_truncate_text "$line" "$width")"
fi
- printf "Started: %s\n\n" "$started"
+ line=$(printf "Started: %s" "$started")
+ printf "%s\n\n" "$(ui_truncate_text "$line" "$width")"
}
ui_section() {
@@ -154,6 +229,8 @@ ui_progress() {
local step="$1" current="$2" total="$3" pct="$4" eta="$5"
local counters
counters=$(ui_counts_summary)
+ ui_log_jsonl "INFO" "progress" "Module progress" \
+ "step=${step}" "current=${current}" "total=${total}" "pct=${pct}" "eta=${eta}" "counters=${counters}"
if ui_is_tty; then
ui_live_progress_begin
@@ -165,6 +242,9 @@ ui_progress() {
ui_batch_start() {
local label="$1" total_jobs="$2" batch_num="${3:-}" batch_total="${4:-}"
+ ui_log_jsonl "INFO" "parallel_batch" "Parallel batch started" \
+ "label=${label}" "jobs=${total_jobs}" "batch_num=${batch_num}" "batch_total=${batch_total}"
+ ui_human_output_enabled || return 0
ui_live_progress_break
if ui_is_tty; then
@@ -193,6 +273,10 @@ ui_batch_end() {
local ok="$1" warn="$2" fail="$3" elapsed="$4"
local skip="${5:-0}" cache="${6:-0}"
local completed="${7:-0}" total="${8:-0}"
+ ui_log_jsonl "INFO" "parallel_batch" "Parallel batch completed" \
+ "ok=${ok}" "warn=${warn}" "fail=${fail}" "skip=${skip}" "cache=${cache}" \
+ "completed=${completed}" "total=${total}" "elapsed=${elapsed}"
+ ui_human_output_enabled || return 0
ui_live_progress_break
printf " %b── ok:%d warn:%d fail:%d skip:%d cache:%d │ %d/%d completed │ %ds elapsed ──%b\n" \
"${bgreen:-}" "$ok" "$warn" "$fail" "$skip" "$cache" "$completed" "$total" "$elapsed" "${reset:-}"
@@ -204,6 +288,12 @@ ui_summary() {
local crit="${7:-0}" high="${8:-0}" med="${9:-0}" low="${10:-0}" info="${11:-0}"
local debug_log="${DEBUG_LOG:-}"
+ ui_log_jsonl "SUCCESS" "summary" "Run summary" \
+ "target=${target}" "mode=${mode_label}" "subdomains=${subs}" "web_hosts=${webs}" \
+ "critical=${crit}" "high=${high}" "medium=${med}" "low=${low}" "info=${info}" \
+ "duration=${duration}" "outdir=${outdir}"
+
+ ui_human_output_enabled || return 0
ui_live_progress_end
printf "\n"
printf "RESULTS %s\n" "$target"
@@ -221,13 +311,19 @@ ui_summary() {
}
ui_module_end() {
- [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+ if [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && ! ui_is_jsonl; then
+ return 0
+ fi
local module="$1"
shift
+ local files_list=""
if [[ $# -gt 0 ]]; then
- local files_list
files_list=$(printf '%s, ' "$@")
files_list="${files_list%, }"
+ fi
+ ui_log_jsonl "INFO" "$module" "Module completed" "artifacts=${files_list}"
+ ui_human_output_enabled || return 0
+ if [[ $# -gt 0 ]]; then
printf " %bOutput:%b %s\n\n" "${bblue:-}" "${reset:-}" "$files_list"
fi
_print_module_end "$module"
@@ -244,7 +340,7 @@ ui_json_escape() {
}
ui_log_jsonl() {
- [[ "$_UI_LOG_FORMAT" != "jsonl" ]] && return 0
+ ui_is_jsonl || return 0
local level="$1" module="$2" message="$3"
shift 3
@@ -261,7 +357,7 @@ ui_log_jsonl() {
if [[ "$kv" =~ ^([^=]+)=(.*)$ ]]; then
key=$(ui_json_escape "${BASH_REMATCH[1]}")
val=$(ui_json_escape "${BASH_REMATCH[2]}")
- extra+="\",\"${key}\":\"${val}"
+ extra+=",\"${key}\":\"${val}\""
fi
done
diff --git a/modules/axiom.sh b/modules/axiom.sh
index 617a6b6..8f7f080 100644
--- a/modules/axiom.sh
+++ b/modules/axiom.sh
@@ -128,6 +128,10 @@ function axiom_launch() {
}
function axiom_shutdown() {
+ if [[ "${AXIOM_RUNTIME_DISABLED:-false}" == "true" ]]; then
+ [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && notification "Axiom runtime already disabled; skipping fleet shutdown" info
+ return
+ fi
if [[ $AXIOM_FLEET_LAUNCH == true ]] && [[ $AXIOM_FLEET_SHUTDOWN == true ]] && [[ -n $AXIOM_FLEET_NAME ]]; then
#if [[ "$mode" == "subs_menu" ]] || [[ "$mode" == "list_recon" ]] || [[ "$mode" == "passive" ]] || [[ "$mode" == "all" ]]; then
if [[ $mode == "subs_menu" ]] || [[ $mode == "passive" ]] || [[ $mode == "all" ]]; then
@@ -145,20 +149,21 @@ function axiom_selected() {
if [[ ! $(axiom-ls 2>>"${LOGFILE:-/dev/null}" | tail -n +2 | sed '$ d' | wc -l) -gt 0 ]]; then
end_func "No axiom instances running" "${FUNCNAME[0]}" warn
- notification "No axiom instances running ${reset}\n\n" error
- exit
+ axiom_disable_runtime "no axiom instances running" "axiom-ls"
+ return 0
fi
if [[ ! $(cat ~/.axiom/selected.conf | sed '/^\s*$/d' | wc -l) -gt 0 ]]; then
end_func "No axiom instances selected" "${FUNCNAME[0]}" warn
- notification "No axiom instances selected ${reset}\n\n" error
- exit
+ axiom_disable_runtime "no axiom instances selected" "axiom-selected.conf"
+ return 0
fi
# Probe Axiom connectivity and optionally auto-repair host-key mismatches.
print_notice RUN "axiom_selected" "checking axiom connectivity"
- local axiom_probe_out
- axiom_probe_out="$(axiom-exec "echo reconftw-axiom-probe" 2>&1 || true)"
+ local axiom_probe_out axiom_probe_rc
+ axiom_probe_out="$(axiom-exec "echo reconftw-axiom-probe" 2>&1)"
+ axiom_probe_rc=$?
if echo "$axiom_probe_out" | grep -q "REMOTE HOST IDENTIFICATION HAS CHANGED"; then
echo "$axiom_probe_out" >>"${LOGFILE:-/dev/null}"
@@ -186,18 +191,23 @@ function axiom_selected() {
fi
done
- axiom_probe_out="$(axiom-exec "echo reconftw-axiom-probe" 2>&1 || true)"
+ axiom_probe_out="$(axiom-exec "echo reconftw-axiom-probe" 2>&1)"
+ axiom_probe_rc=$?
if echo "$axiom_probe_out" | grep -q "REMOTE HOST IDENTIFICATION HAS CHANGED"; then
- notification "Axiom host-key mismatch persists after auto-repair; disabling AXIOM for this run and continuing locally" warn
echo "$axiom_probe_out" >>"${LOGFILE:-/dev/null}"
- AXIOM=false
+ axiom_disable_runtime "host-key mismatch persists after auto-repair" "axiom-exec probe"
else
notification "Axiom known_hosts auto-repair completed successfully" good
fi
else
- notification "Axiom host-key mismatch detected; disabling AXIOM for this run and continuing locally" warn
- AXIOM=false
+ axiom_disable_runtime "host-key mismatch detected" "axiom-exec probe"
fi
fi
+
+ if [[ "$axiom_probe_rc" -ne 0 ]] || axiom_transport_error_detected "$axiom_probe_out"; then
+ echo "$axiom_probe_out" >>"${LOGFILE:-/dev/null}"
+ axiom_disable_runtime "probe connectivity failure" "axiom-exec probe"
+ fi
+
end_func "" "${FUNCNAME[0]}"
}
diff --git a/modules/core.sh b/modules/core.sh
index 1052efa..0944b5c 100644
--- a/modules/core.sh
+++ b/modules/core.sh
@@ -106,10 +106,51 @@ function banner_grabber() {
printf "%b\n" "$banner_code"
}
+function banner_grabber_compact() {
+ local banner_file="${SCRIPTPATH}/banners.txt"
+
+ if [[ ! -f $banner_file ]]; then
+ echo "Banner file not found: $banner_file" >&2
+ return 1
+ fi
+
+ # shellcheck source=/dev/null
+ source "$banner_file"
+
+ local -a compact_vars=()
+ local v code line_count
+ for v in $(compgen -A variable | grep '^banner[0-9]\+$'); do
+ code="${!v}"
+ line_count=$(printf "%s\n" "$code" | wc -l | tr -d ' ')
+ if [[ "$line_count" =~ ^[0-9]+$ ]] && ((line_count <= 4)); then
+ compact_vars+=("$v")
+ fi
+ done
+
+ if [[ ${#compact_vars[@]} -eq 0 ]]; then
+ return 1
+ fi
+
+ local rand_index=$((RANDOM % ${#compact_vars[@]}))
+ local banner_var="${compact_vars[$rand_index]}"
+ printf "%b\n" "${!banner_var}"
+}
+
function banner() {
local banner_code
- if banner_code=$(banner_grabber); then
- printf "\n%b%s" "$bgreen" "$banner_code"
+ local term_lines=0
+ if [[ -t 1 ]] && command -v tput >/dev/null 2>&1; then
+ term_lines=$(tput lines 2>/dev/null || echo 0)
+ fi
+
+ if [[ "$term_lines" =~ ^[0-9]+$ ]] && ((term_lines > 0 && term_lines < 28)); then
+ banner_code=$(banner_grabber_compact || banner_grabber || true)
+ else
+ banner_code=$(banner_grabber || true)
+ fi
+
+ if [[ -n "$banner_code" ]]; then
+ printf "\n%b%s%b\n" "$bgreen" "$banner_code" "$reset"
else
printf "\n%bFailed to load banner.%b\n" "$bgreen" "$reset"
fi
@@ -197,8 +238,8 @@ function tools_installed() {
["getjswords"]="${tools}/getjswords.py"
["JSA"]="${tools}/JSA/jsa.py"
["JSA_python"]="${tools}/JSA/venv/bin/python3"
- ["CloudHunter"]="${tools}/CloudHunter/cloudhunter.py"
- ["CloudHunter_python"]="${tools}/CloudHunter/venv/bin/python3"
+ ["cloud_enum"]="${tools}/cloud_enum/cloud_enum.py"
+ ["cloud_enum_python"]="${tools}/cloud_enum/venv/bin/python3"
["nmap-parse-output"]="${tools}/ultimate-nmap-parser/ultimate-nmap-parser.sh"
["regulator"]="${tools}/regulator/main.py"
["regulator_python"]="${tools}/regulator/venv/bin/python3"
@@ -304,7 +345,6 @@ function tools_installed() {
["grpcurl"]="grpcurl"
["arjun"]="arjun"
["gqlspection"]="gqlspection"
- ["cloud_enum"]="cloud_enum"
["toxicache"]="toxicache"
["favirecon"]="favirecon"
["TInjA"]="TInjA"
@@ -346,6 +386,8 @@ function tools_installed() {
else
_print_msg WARN "Pending tools: ${missing_tools[*]}"
fi
+
+ mark_missing_tools_warn_once "${missing_tools[@]}"
fi
if [[ $CHECK_TOOLS_OR_EXIT == true && $all_installed != true ]]; then
@@ -353,6 +395,21 @@ function tools_installed() {
fi
}
+# Mark warn_once keys for tools already reported in preflight to avoid duplicate warnings in runtime.
+# Usage: mark_missing_tools_warn_once "${missing_tools[@]}"
+mark_missing_tools_warn_once() {
+ local missing=("$@")
+ [[ ${#missing[@]} -eq 0 ]] && return 0
+
+ # dnstake is reported in preflight as "Pending tool", so suppress duplicate subtakeover warning.
+ if [[ " ${missing[*]} " == *" dnstake "* ]]; then
+ if ! declare -p WARN_ONCE_KEYS >/dev/null 2>&1; then
+ declare -gA WARN_ONCE_KEYS=()
+ fi
+ WARN_ONCE_KEYS["missing-tool-dnstake"]=1
+ fi
+}
+
###############################################################################################################
#################################### CRITICAL DEPENDENCIES CHECK ##############################################
###############################################################################################################
diff --git a/modules/modes.sh b/modules/modes.sh
index 44456c6..942d57d 100644
--- a/modules/modes.sh
+++ b/modules/modes.sh
@@ -447,16 +447,16 @@ function passive() {
_print_section "Subdomains"
- subdomains_full
+ run_module_with_axiom_failover subdomains_full
remove_big_files
_print_section "Web Detection"
- cdnprovider
+ run_module_with_axiom_failover cdnprovider
# shellcheck disable=SC2034 # PORTSCAN_ACTIVE controls scan behavior
PORTSCAN_ACTIVE=false
- portscan
- geo_info
+ run_module_with_axiom_failover portscan
+ run_module_with_axiom_failover geo_info
if [[ $AXIOM == true ]]; then
axiom_shutdown
@@ -488,10 +488,56 @@ function osint() {
cloud_enum_scan
}
+run_module_with_axiom_failover() {
+ local module_fn="$1"
+ shift || true
+
+ if ! declare -F "$module_fn" >/dev/null 2>&1; then
+ notification "Failover wrapper: unknown function '${module_fn}'" warn
+ return 1
+ fi
+
+ local axiom_before=false
+ if axiom_runtime_enabled; then
+ axiom_before=true
+ fi
+
+ "$module_fn" "$@"
+ local rc=$?
+
+ if [[ "$axiom_before" == "true" ]] \
+ && [[ "${AXIOM_RUNTIME_DISABLED:-false}" == "true" ]] \
+ && [[ "${AXIOM_FAILOVER_RETRY_ACTIVE:-false}" != "true" ]]; then
+ local prev_diff="${DIFF:-}"
+ local had_diff=false
+ [[ -v DIFF ]] && had_diff=true
+ local prev_retry="${AXIOM_FAILOVER_RETRY_ACTIVE:-false}"
+ local fail_reason="${AXIOM_RUNTIME_DISABLE_REASON:-unknown reason}"
+ local fail_cmd="${AXIOM_RUNTIME_DISABLE_CMD:-unknown command}"
+ AXIOM_FAILOVER_RETRY_ACTIVE=true
+
+ notification "Axiom failover in ${module_fn}; retrying once locally (${fail_reason})" warn
+ log_note "retrying module locally after axiom failover: module='${module_fn}' reason='${fail_reason}' cmd='${fail_cmd}'" "${FUNCNAME[0]}" "${LINENO}"
+
+ DIFF=true
+ "$module_fn" "$@"
+ rc=$?
+
+ if [[ "$had_diff" == "true" ]]; then
+ DIFF="$prev_diff"
+ else
+ unset DIFF
+ fi
+ AXIOM_FAILOVER_RETRY_ACTIVE="$prev_retry"
+ fi
+
+ return "$rc"
+}
+
function vulns() {
_print_section "Vulnerability Checks"
if [[ $VULNS_GENERAL == true ]]; then
- if [[ "${PARALLEL_MODE:-true}" == "true" ]] && declare -f parallel_funcs &>/dev/null; then
+ if [[ "${PARALLEL_MODE:-true}" == "true" ]] && declare -f parallel_funcs &>/dev/null && ! axiom_runtime_enabled; then
# Parallel execution - group independent checks
[[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%b[*] Running vulnerability checks in parallel mode%b\n" "$bblue" "$reset"
parallel_funcs "${PAR_VULNS_GROUP1_SIZE:-4}" crlf_checks xss ssrf_checks lfi
@@ -533,7 +579,7 @@ function vulns() {
test_ssl
else
crlf_checks
- xss
+ run_module_with_axiom_failover xss
ssrf_checks
lfi
ssti
@@ -542,9 +588,9 @@ function vulns() {
smuggling
webcache
spraying
- brokenLinks
- fuzzparams
- nuclei_dast
+ run_module_with_axiom_failover brokenLinks
+ run_module_with_axiom_failover fuzzparams
+ run_module_with_axiom_failover nuclei_dast
4xxbypass
test_ssl
fi
@@ -592,7 +638,7 @@ function multi_osint() {
init_dns_resolver
enable_command_trace
- while IFS= read -r domain; do
+ while IFS= read -r domain || [[ -n "$domain" ]]; do
[[ -z "$domain" ]] && continue
dir="$workdir/targets/$domain"
called_fn_dir="$dir/.called_fn"
@@ -622,6 +668,7 @@ function multi_osint() {
apileaks
third_party_misconfigs
zonetransfer
+ cloud_enum_scan
done <"$list"
cd "$workdir" || {
print_errorf "Failed to cd directory '%s' in %s @ line %s" "$workdir" "${FUNCNAME[0]}" "${LINENO}"
@@ -657,6 +704,9 @@ function recon() {
RECON_PARTIAL_RUN=true
RECON_OSINT_PARALLEL_FAILURES=$((RECON_OSINT_PARALLEL_FAILURES + osint_g2_rc))
fi
+ if [[ "${S3BUCKETS:-false}" != "true" ]]; then
+ cloud_enum_scan
+ fi
else
domain_info
ip_info
@@ -670,6 +720,9 @@ function recon() {
apileaks
third_party_misconfigs
zonetransfer
+ if [[ "${S3BUCKETS:-false}" != "true" ]]; then
+ cloud_enum_scan
+ fi
fi
ui_module_end "OSINT" "osint/" "subdomains/"
@@ -682,19 +735,19 @@ function recon() {
_print_section "Subdomains"
- subdomains_full
- subtakeover
+ run_module_with_axiom_failover subdomains_full
+ run_module_with_axiom_failover subtakeover
remove_big_files
- s3buckets
+ run_module_with_axiom_failover s3buckets
ui_module_end "Subdomains" "subdomains/" "webs/"
progress_module "Subdomains"
_print_section "Web Detection"
- webprobe_simple
- webprobe_full
+ run_module_with_axiom_failover webprobe_simple
+ run_module_with_axiom_failover webprobe_full
- if [[ "${PARALLEL_MODE:-true}" == "true" ]] && declare -f parallel_funcs &>/dev/null; then
+ if [[ "${PARALLEL_MODE:-true}" == "true" ]] && declare -f parallel_funcs &>/dev/null && ! axiom_runtime_enabled; then
parallel_funcs "${PAR_WEB_DETECT_GROUP_SIZE:-3}" screenshot cdnprovider portscan favirecon_tech
local webhost_rc=$?
if ((webhost_rc > 0)); then
@@ -707,12 +760,12 @@ function recon() {
fi
geo_info
else
- screenshot
+ run_module_with_axiom_failover screenshot
# virtualhosts
- cdnprovider
- portscan
+ run_module_with_axiom_failover cdnprovider
+ run_module_with_axiom_failover portscan
favirecon_tech
- geo_info
+ run_module_with_axiom_failover geo_info
fi
ui_module_end "Web Detection" "webs/" "hosts/" "screenshots/"
@@ -730,15 +783,15 @@ function recon() {
else
_print_section "Web Analysis"
- waf_checks
- nuclei_check
- graphql_scan
- fuzz
- iishortname
- urlchecks
- jschecks
+ run_module_with_axiom_failover waf_checks
+ run_module_with_axiom_failover nuclei_check
+ run_module_with_axiom_failover graphql_scan
+ run_module_with_axiom_failover fuzz
+ run_module_with_axiom_failover iishortname
+ run_module_with_axiom_failover urlchecks
+ run_module_with_axiom_failover jschecks
websocket_checks
- param_discovery
+ run_module_with_axiom_failover param_discovery
grpc_reflection
llm_probe
@@ -855,6 +908,9 @@ function multi_recon() {
apileaks
third_party_misconfigs
zonetransfer
+ if [[ "${S3BUCKETS:-false}" != "true" ]]; then
+ cloud_enum_scan
+ fi
currently=$(date +"%H:%M:%S")
loopend=$(date +%s)
getElapsedTime "$loopstart" "$loopend"
@@ -884,16 +940,16 @@ function multi_recon() {
print_errorf "Failed to cd directory '%s' in %s @ line %s" "$dir" "${FUNCNAME[0]}" "${LINENO}"
exit 1
}
- subdomains_full
- webprobe_simple
- webprobe_full
- subtakeover
+ run_module_with_axiom_failover subdomains_full
+ run_module_with_axiom_failover webprobe_simple
+ run_module_with_axiom_failover webprobe_full
+ run_module_with_axiom_failover subtakeover
remove_big_files
- screenshot
+ run_module_with_axiom_failover screenshot
# virtualhosts
- cdnprovider
- portscan
- geo_info
+ run_module_with_axiom_failover cdnprovider
+ run_module_with_axiom_failover portscan
+ run_module_with_axiom_failover geo_info
currently=$(date +"%H:%M:%S")
loopend=$(date +%s)
getElapsedTime "$loopstart" "$loopend"
@@ -924,9 +980,9 @@ function multi_recon() {
"$NUMOFLINES_pwndb_total" "$NUMOFLINES_subs_total" "$NUMOFLINES_subtko_total" \
"$NUMOFLINES_webs_total" "$NUMOFLINES_webs_total_uncommon" \
"$NUMOFLINES_ips_total" "$NUMOFLINES_cloudsprov_total"
- s3buckets
- waf_checks
- nuclei_check
+ run_module_with_axiom_failover s3buckets
+ run_module_with_axiom_failover waf_checks
+ run_module_with_axiom_failover nuclei_check
for domain in "${targets[@]}"; do
[[ -z "$domain" ]] && continue
loopstart=$(date +%s)
@@ -937,10 +993,10 @@ function multi_recon() {
exit 1
}
loopstart=$(date +%s)
- fuzz
- iishortname
- urlchecks
- jschecks
+ run_module_with_axiom_failover fuzz
+ run_module_with_axiom_failover iishortname
+ run_module_with_axiom_failover urlchecks
+ run_module_with_axiom_failover jschecks
currently=$(date +"%H:%M:%S")
loopend=$(date +%s)
getElapsedTime "$loopstart" "$loopend"
@@ -1046,7 +1102,7 @@ function multi_custom() {
loopstart=$(date +%s)
- $custom_f
+ run_module_with_axiom_failover "$custom_f"
currently=$(date +"%H:%M:%S")
loopend=$(date +%s)
@@ -1073,17 +1129,17 @@ function subs_menu() {
_print_section "Subdomains"
- subdomains_full
- subtakeover
+ run_module_with_axiom_failover subdomains_full
+ run_module_with_axiom_failover subtakeover
remove_big_files
zonetransfer
- s3buckets
+ run_module_with_axiom_failover s3buckets
_print_section "Web Detection"
- webprobe_simple
- webprobe_full
+ run_module_with_axiom_failover webprobe_simple
+ run_module_with_axiom_failover webprobe_full
favirecon_tech
- screenshot
+ run_module_with_axiom_failover screenshot
# virtualhosts
if [[ $AXIOM == true ]]; then
@@ -1096,31 +1152,31 @@ function subs_menu() {
function webs_menu() {
_print_section "Web Detection"
- webprobe_simple
- webprobe_full
+ run_module_with_axiom_failover webprobe_simple
+ run_module_with_axiom_failover webprobe_full
favirecon_tech
- subtakeover
+ run_module_with_axiom_failover subtakeover
remove_big_files
- screenshot
+ run_module_with_axiom_failover screenshot
# virtualhosts
_print_section "Web Analysis"
- waf_checks
- nuclei_check
- graphql_scan
- fuzz
+ run_module_with_axiom_failover waf_checks
+ run_module_with_axiom_failover nuclei_check
+ run_module_with_axiom_failover graphql_scan
+ run_module_with_axiom_failover fuzz
cms_scanner
- iishortname
- urlchecks
- jschecks
+ run_module_with_axiom_failover iishortname
+ run_module_with_axiom_failover urlchecks
+ run_module_with_axiom_failover jschecks
websocket_checks
url_gf
wordlist_gen
wordlist_gen_roboxtractor
password_dict
url_ext
- param_discovery
+ run_module_with_axiom_failover param_discovery
grpc_reflection
vulns
@@ -1136,26 +1192,26 @@ function zen_menu() {
_print_section "Subdomains"
- subdomains_full
- subtakeover
+ run_module_with_axiom_failover subdomains_full
+ run_module_with_axiom_failover subtakeover
remove_big_files
- s3buckets
+ run_module_with_axiom_failover s3buckets
_print_section "Web Detection"
- webprobe_simple
- webprobe_full
+ run_module_with_axiom_failover webprobe_simple
+ run_module_with_axiom_failover webprobe_full
favirecon_tech
- screenshot
+ run_module_with_axiom_failover screenshot
# virtualhosts
- cdnprovider
+ run_module_with_axiom_failover cdnprovider
_print_section "Web Analysis"
- waf_checks
- nuclei_check
- graphql_scan
- fuzz
- iishortname
+ run_module_with_axiom_failover waf_checks
+ run_module_with_axiom_failover nuclei_check
+ run_module_with_axiom_failover graphql_scan
+ run_module_with_axiom_failover fuzz
+ run_module_with_axiom_failover iishortname
if [[ $AXIOM == true ]]; then
axiom_shutdown
fi
@@ -1342,6 +1398,7 @@ function help() {
printf " --dry-run Show what would be executed without running commands\n"
printf " --quiet Minimal output (errors and final summary only)\n"
printf " --verbose Extra output (PIDs, debug info)\n"
+ printf " --log-format f Console format: plain, jsonl, jsonl-strict\n"
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"
diff --git a/modules/osint.sh b/modules/osint.sh
index 7462031..4eb55eb 100644
--- a/modules/osint.sh
+++ b/modules/osint.sh
@@ -521,7 +521,23 @@ function domain_info() {
# Run whois command and check for errors
run_command whois "$domain" >"osint/domain_info_general.txt"
- run_command "${tools}/msftrecon/venv/bin/python3" "${tools}/msftrecon/msftrecon/msftrecon.py" -d ${domain} 2>>"$LOGFILE" >osint/azure_tenant_domains.txt || true
+ : >osint/azure_tenant_domains.txt
+ local msftrecon_output msftrecon_rc
+ msftrecon_output=$(mktemp)
+ msftrecon_rc=0
+ if ! run_command "${tools}/msftrecon/venv/bin/python3" "${tools}/msftrecon/msftrecon/msftrecon.py" -d "${domain}" \
+ >"$msftrecon_output" 2>>"$LOGFILE"; then
+ msftrecon_rc=$?
+ fi
+
+ if [[ $msftrecon_rc -eq 0 ]]; then
+ cat "$msftrecon_output" >osint/azure_tenant_domains.txt
+ else
+ log_note "domain_info: msftrecon failed (rc=${msftrecon_rc}), continuing" "${FUNCNAME[0]}" "${LINENO}"
+ _print_msg WARN "domain_info: msftrecon failed, continuing"
+ : >osint/azure_tenant_domains.txt
+ fi
+ rm -f "$msftrecon_output"
company_name=$(unfurl format %r <<<"$domain")
run_command "${tools}/Scopify/venv/bin/python3" "${tools}/Scopify/scopify.py" -c ${company_name} >osint/scopify.txt
@@ -659,13 +675,60 @@ function cloud_enum_scan() {
&& [[ $CLOUD_ENUM == true ]] && [[ $OSINT == true ]] \
&& ! [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
- if ! command -v cloud_enum >/dev/null 2>&1; then
- _print_msg WARN "${FUNCNAME[0]}: cloud_enum not found in PATH"
+ local cloud_enum_profile cloud_enum_mutations cloud_enum_quickscan cloud_enum_threads
+ local cloud_enum_python cloud_enum_script company_name
+ cloud_enum_profile=$(printf "%s" "${CLOUD_ENUM_S3_PROFILE:-optimized}" | tr '[:upper:]' '[:lower:]')
+ case "$cloud_enum_profile" in
+ optimized)
+ cloud_enum_mutations=""
+ cloud_enum_quickscan=true
+ ;;
+ exhaustive)
+ cloud_enum_mutations="${tools}/cloud_enum/enum_tools/fuzz.txt"
+ cloud_enum_quickscan=false
+ ;;
+ *)
+ cloud_enum_mutations=""
+ cloud_enum_quickscan=true
+ ;;
+ esac
+ cloud_enum_threads="${CLOUD_ENUM_S3_THREADS:-20}"
+ if [[ ! "$cloud_enum_threads" =~ ^[0-9]+$ ]] || [[ "$cloud_enum_threads" -le 0 ]]; then
+ cloud_enum_threads=20
+ fi
+
+ cloud_enum_python="${tools}/cloud_enum/venv/bin/python3"
+ cloud_enum_script="${tools}/cloud_enum/cloud_enum.py"
+ if [[ ! -f "$cloud_enum_script" ]] || [[ ! -x "$cloud_enum_python" ]]; then
+ _print_msg WARN "${FUNCNAME[0]}: cloud_enum runtime not found at ${tools}/cloud_enum"
+ return 0
+ fi
+ if [[ "$cloud_enum_quickscan" != true ]] && [[ ! -f "$cloud_enum_mutations" ]]; then
+ _print_msg WARN "${FUNCNAME[0]}: mutations list not found (${cloud_enum_mutations})"
return 0
fi
+
start_func "${FUNCNAME[0]}" "Cloud storage enumeration"
company_name=$(unfurl format %r <<<"$domain")
- run_command cloud_enum -k "$company_name" -k "$domain" -k "${domain%%.*}" 2>>"$LOGFILE" | anew -q osint/cloud_enum.txt
+ local -a cloud_enum_cmd=(
+ env PYTHONWARNINGS=ignore
+ "$cloud_enum_python"
+ "$cloud_enum_script"
+ -k "$company_name"
+ -k "$domain"
+ -k "${domain%%.*}"
+ -t "$cloud_enum_threads"
+ )
+ if [[ -f "$resolvers" ]]; then
+ cloud_enum_cmd+=(-nsf "$resolvers")
+ fi
+ if [[ "$cloud_enum_quickscan" == true ]]; then
+ cloud_enum_cmd+=(-qs)
+ else
+ cloud_enum_cmd+=(-m "$cloud_enum_mutations")
+ fi
+
+ run_command "${cloud_enum_cmd[@]}" 2>>"$LOGFILE" | anew -q osint/cloud_enum.txt
end_func "Results are saved in $domain/osint/cloud_enum.txt" "${FUNCNAME[0]}"
else
if [[ $CLOUD_ENUM == false ]] || [[ $OSINT == false ]]; then
diff --git a/modules/subdomains.sh b/modules/subdomains.sh
index 53739b7..d367997 100644
--- a/modules/subdomains.sh
+++ b/modules/subdomains.sh
@@ -202,6 +202,7 @@ _subdomains_init() {
# Escape domain for safe use in grep regex (dots are literal, not wildcards)
DOMAIN_ESCAPED=$(escape_domain_regex "$domain")
+ DOMAIN_MATCH_REGEX=$(domain_match_regex "$domain")
# Check for sensitive domain exclusion
if [[ "${EXCLUDE_SENSITIVE:-false}" == true ]]; then
@@ -476,7 +477,7 @@ function sub_asn() {
jq -r '.domains[]? // empty' "$asn_json" \
| sed '/^$/d' \
| grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
- | grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" \
+ | grep -E "$DOMAIN_MATCH_REGEX" \
| sort -u \
| anew -q .tmp/subs_no_resolved.txt || true
if [[ -s .tmp/subs_no_resolved.txt ]]; then
@@ -694,17 +695,23 @@ function sub_active() {
fi
# Process subdomains and append new ones to subdomains.txt, count new lines
+ local candidate_count=0
+ local matched_count=0
if [[ -s ".tmp/subdomains_tmp.txt" ]]; then
- if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/subdomains_tmp.txt 2>>"$LOGFILE" \
+ candidate_count=$(wc -l <.tmp/subdomains_tmp.txt 2>/dev/null | tr -d ' ')
+ matched_count=$(grep -E "$DOMAIN_MATCH_REGEX" .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
- print_warnf "Failed to process subdomains."
- NUMOFLINES=0
- fi
+ | sed '/^$/d' | wc -l | tr -d ' ' || true)
+ NUMOFLINES=$(grep -E "$DOMAIN_MATCH_REGEX" .tmp/subdomains_tmp.txt 2>>"$LOGFILE" \
+ | grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
+ | anew subdomains/subdomains.txt | sed '/^$/d' | wc -l | tr -d ' ' || true)
+ [[ "$matched_count" =~ ^[0-9]+$ ]] || matched_count=0
+ [[ "$NUMOFLINES" =~ ^[0-9]+$ ]] || NUMOFLINES=0
else
NUMOFLINES=0
_print_msg WARN "No candidate subdomains produced by sub_active; continuing."
fi
+ log_note "sub_active counts: candidates=${candidate_count:-0} matched=${matched_count:-0} added=${NUMOFLINES:-0}" "${FUNCNAME[0]}" "${LINENO}"
end_subfunc "${NUMOFLINES} subs DNS resolved from passive" "${FUNCNAME[0]}"
else
@@ -748,7 +755,7 @@ function sub_tls() {
fi
if [[ -s ".tmp/subdomains_tlsx.txt" ]]; then
- grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/subdomains_tlsx.txt \
+ grep -E "$DOMAIN_MATCH_REGEX" .tmp/subdomains_tlsx.txt \
| grep -aEo 'https?://[^ ]+' \
| sed "s/|__ //" \
| sed '/^$/d' \
@@ -779,10 +786,8 @@ 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
- print_warnf "Counting new subdomains failed."
- return 1
- fi
+ NUMOFLINES=$(anew subdomains/subdomains.txt <.tmp/subdomains_tlsx_resolved.txt | sed '/^$/d' | wc -l | tr -d ' ' || true)
+ [[ "$NUMOFLINES" =~ ^[0-9]+$ ]] || NUMOFLINES=0
end_subfunc "${NUMOFLINES} new subs (tls active enum)" "${FUNCNAME[0]}"
else
@@ -824,12 +829,10 @@ function sub_noerror() {
fi
# Process subdomains and append new ones to subdomains.txt, count new lines
- if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/subs_noerror.txt 2>>"$LOGFILE" \
+ NUMOFLINES=$(grep -E "$DOMAIN_MATCH_REGEX" .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
- print_warnf "Failed to process subdomains."
- return 1
- fi
+ | sed 's/^\*\.//' | anew subdomains/subdomains.txt | sed '/^$/d' | wc -l | tr -d ' ' || true)
+ [[ "$NUMOFLINES" =~ ^[0-9]+$ ]] || NUMOFLINES=0
end_subfunc "${NUMOFLINES} new subs (DNS noerror)" "${FUNCNAME[0]}"
@@ -866,7 +869,7 @@ function sub_dns() {
jq -r '.. | strings | select(test("^(\\d{1,3}\\.){3}\\d{1,3}$|^[0-9a-fA-F:]+$"))' <"subdomains/subdomains_dnsregs.json" \
| sort -u | run_command hakip2host | awk '{print $3}' | unfurl -u domains \
- | sed -e 's/^\*\.//' -e 's/\.$//' -e '/\./!d' | grep "\.${DOMAIN_ESCAPED}$" \
+ | sed -e 's/^\*\.//' -e 's/\.$//' -e '/\./!d' | grep -E "$DOMAIN_MATCH_REGEX" \
| grep -E '^([a-zA-Z0-9][-a-zA-Z0-9]*\.)+[a-zA-Z]{2,}$' | sort -u \
| anew -q .tmp/subdomains_dns.txt || true
@@ -875,7 +878,7 @@ function sub_dns() {
| while IFS= read -r ip; do
[[ -z "$ip" ]] && continue
run_command curl -s "https://ip.thc.org/$ip" 2>>"$LOGFILE" \
- | grep "\.${DOMAIN_ESCAPED}$" \
+ | grep -E "$DOMAIN_MATCH_REGEX" \
| grep -E '^([a-zA-Z0-9][-a-zA-Z0-9]*\.)+[a-zA-Z]{2,}$' \
| sort -u \
| anew -q .tmp/subdomains_dns.txt || true
@@ -916,12 +919,10 @@ function sub_dns() {
fi
if [[ -s ".tmp/subdomains_dns_resolved.txt" ]]; then
- if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/subdomains_dns_resolved.txt 2>>"$LOGFILE" \
+ NUMOFLINES=$(grep -E "$DOMAIN_MATCH_REGEX" .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
- print_warnf "Failed to count new subdomains."
- return 1
- fi
+ | anew subdomains/subdomains.txt | sed '/^$/d' | wc -l | tr -d ' ' || true)
+ [[ "$NUMOFLINES" =~ ^[0-9]+$ ]] || NUMOFLINES=0
else
NUMOFLINES=0
_print_msg WARN "No DNS-resolved subdomains produced by sub_dns; continuing."
@@ -982,17 +983,23 @@ function sub_brute() {
fi
# Process subdomains and append new ones to subdomains.txt, count new lines
+ local brute_candidate_count=0
+ local brute_matched_count=0
if [[ -s ".tmp/subs_brute_valid.txt" ]]; then
- if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/subs_brute_valid.txt 2>>"$LOGFILE" \
+ brute_candidate_count=$(wc -l <.tmp/subs_brute_valid.txt 2>/dev/null | tr -d ' ')
+ brute_matched_count=$(grep -E "$DOMAIN_MATCH_REGEX" .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
- print_warnf "Failed to process subdomains."
- NUMOFLINES=0
- fi
+ | sed '/^$/d' | wc -l | tr -d ' ' || true)
+ NUMOFLINES=$(grep -E "$DOMAIN_MATCH_REGEX" .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 | tr -d ' ' || true)
+ [[ "$brute_matched_count" =~ ^[0-9]+$ ]] || brute_matched_count=0
+ [[ "$NUMOFLINES" =~ ^[0-9]+$ ]] || NUMOFLINES=0
else
NUMOFLINES=0
_print_msg WARN "No candidate subdomains produced by sub_brute; continuing."
fi
+ log_note "sub_brute counts: candidates=${brute_candidate_count:-0} matched=${brute_matched_count:-0} added=${NUMOFLINES:-0}" "${FUNCNAME[0]}" "${LINENO}"
end_subfunc "${NUMOFLINES} new subs (bruteforce)" "${FUNCNAME[0]}"
@@ -1119,7 +1126,7 @@ function sub_scraping() {
if [[ -s ".tmp/scrap_subs_resolved.txt" ]]; then
if ! NUMOFLINES=$(cat .tmp/scrap_subs_resolved.txt 2>>"$LOGFILE" \
- | grep -a "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" \
+ | grep -aE "$DOMAIN_MATCH_REGEX" \
| grep -Ea '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
| anew subdomains/subdomains.txt \
| tee .tmp/diff_scrap.txt \
@@ -1206,7 +1213,7 @@ function sub_analytics() {
fi
if [[ -s ".tmp/analytics_subs_tmp.txt" ]]; then
- grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/analytics_subs_tmp.txt \
+ grep -E "$DOMAIN_MATCH_REGEX" .tmp/analytics_subs_tmp.txt \
| grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
| sed "s/|__ //" | anew -q .tmp/analytics_subs_clean.txt || true
@@ -1381,12 +1388,10 @@ function sub_permut() {
fi
# Process subdomains and append new ones to subdomains.txt, count new lines
- if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/permute_subs.txt 2>>"$LOGFILE" \
+ NUMOFLINES=$(grep -E "$DOMAIN_MATCH_REGEX" .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
- print_warnf "Failed to process subdomains."
- return 1
- fi
+ | anew subdomains/subdomains.txt | sed '/^$/d' | wc -l | tr -d ' ' || true)
+ [[ "$NUMOFLINES" =~ ^[0-9]+$ ]] || NUMOFLINES=0
else
NUMOFLINES=0
fi
@@ -1467,13 +1472,12 @@ function sub_regex_permut() {
fi
fi
- if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/regulator.txt 2>>"$LOGFILE" \
+ NUMOFLINES=$(grep -E "$DOMAIN_MATCH_REGEX" .tmp/regulator.txt 2>>"$LOGFILE" \
| grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
| anew subdomains/subdomains.txt \
| sed '/^$/d' \
- | wc -l); then
- NUMOFLINES=0
- fi
+ | wc -l | tr -d ' ' || true)
+ [[ "$NUMOFLINES" =~ ^[0-9]+$ ]] || NUMOFLINES=0
else
NUMOFLINES=0
fi
@@ -1502,6 +1506,15 @@ function sub_ia_permut() {
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $SUBIAPERMUTE == true ]]; then
start_subfunc "${FUNCNAME[0]}" "Running: Permutations by AI analysis"
+ if [[ ! -s "subdomains/subdomains.txt" ]]; then
+ NUMOFLINES=0
+ log_note "sub_ia_permut skipped: reason=no_seed_subdomains" "${FUNCNAME[0]}" "${LINENO}"
+ end_subfunc "0 new subs (permutations by IA)" "${FUNCNAME[0]}" "SKIP"
+ return 0
+ fi
+
+ : >.tmp/subwiz.txt
+ : >.tmp/subwiz_resolved.txt
subwiz -i subdomains/subdomains.txt --no-resolve -o .tmp/subwiz.txt 2>>"$LOGFILE" >/dev/null
# Resolve the generated domains
@@ -1535,13 +1548,12 @@ function sub_ia_permut() {
fi
fi
- if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/subwiz_resolved.txt 2>>"$LOGFILE" \
+ NUMOFLINES=$(grep -E "$DOMAIN_MATCH_REGEX" .tmp/subwiz_resolved.txt 2>>"$LOGFILE" \
| grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
| anew subdomains/subdomains.txt \
| sed '/^$/d' \
- | wc -l); then
- NUMOFLINES=0
- fi
+ | wc -l | tr -d ' ' || true)
+ [[ "$NUMOFLINES" =~ ^[0-9]+$ ]] || NUMOFLINES=0
else
NUMOFLINES=0
fi
@@ -1624,13 +1636,12 @@ function sub_recursive_passive() {
fi
if [[ -s ".tmp/passive_recurs_tmp.txt" ]]; then
- if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/passive_recurs_tmp.txt 2>>"$LOGFILE" \
+ NUMOFLINES=$(grep -E "$DOMAIN_MATCH_REGEX" .tmp/passive_recurs_tmp.txt 2>>"$LOGFILE" \
| grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
| sed '/^$/d' \
| anew subdomains/subdomains.txt \
- | wc -l); then
- NUMOFLINES=0
- fi
+ | wc -l | tr -d ' ' || true)
+ [[ "$NUMOFLINES" =~ ^[0-9]+$ ]] || NUMOFLINES=0
else
NUMOFLINES=0
fi
@@ -1771,13 +1782,12 @@ function sub_recursive_brute() {
# Process final results
if [[ -s ".tmp/brute_perm_recursive_final.txt" ]]; then
- if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/brute_perm_recursive_final.txt 2>>"$LOGFILE" \
+ NUMOFLINES=$(grep -E "$DOMAIN_MATCH_REGEX" .tmp/brute_perm_recursive_final.txt 2>>"$LOGFILE" \
| grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
| sed '/^$/d' \
| anew subdomains/subdomains.txt \
- | wc -l); then
- NUMOFLINES=0
- fi
+ | wc -l | tr -d ' ' || true)
+ [[ "$NUMOFLINES" =~ ^[0-9]+$ ]] || NUMOFLINES=0
else
NUMOFLINES=0
fi
@@ -1817,7 +1827,7 @@ function subtakeover() {
fi
fi
if ! command -v dnstake >/dev/null 2>&1; then
- _print_msg WARN "${FUNCNAME[0]}: dnstake binary not found in PATH - install dnstake first"
+ warn_once "missing-tool-dnstake" "${FUNCNAME[0]}: dnstake binary not found in PATH - install dnstake first" || true
return 0
fi
start_func "${FUNCNAME[0]}" "Looking for possible subdomain and DNS takeover"
@@ -1951,8 +1961,8 @@ function s3buckets() {
# Check if the function should run
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $S3BUCKETS == true ]] && ! [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
- start_func "${FUNCNAME[0]}" "AWS S3 buckets search"
- print_notice RUN "s3buckets" "scanning S3 buckets"
+ start_func "${FUNCNAME[0]}" "S3 and cloud buckets search"
+ print_notice RUN "s3buckets" "scanning S3 and cloud buckets"
# If in multi mode and subdomains.txt doesn't exist, create it
if [[ -n $multi ]] && [[ ! -f "$dir/subdomains/subdomains.txt" ]]; then
@@ -1984,101 +1994,113 @@ function s3buckets() {
fi
fi
- # Initialize the output file in the subdomains folder
+ # Initialize cloud enumeration artifacts (legacy filenames kept for compatibility)
if ! : >subdomains/cloudhunter_open_buckets.txt; then
print_warnf "Failed to initialize cloudhunter_open_buckets.txt."
fi
+ if ! : >subdomains/.cloud_enum_s3.jsonl; then
+ print_warnf "Failed to initialize .cloud_enum_s3.jsonl."
+ fi
+ rm -f .tmp/cloud_enum_s3_legacy.txt .tmp/cloud_enum_public_aws_targets.txt .tmp/cloud_enum_public_gcp_targets.txt 2>/dev/null || true
- # Determine the CloudHunter permutations flag based on the config
- PERMUTATION_FLAG=""
- permutation_file=""
- case "$CLOUDHUNTER_PERMUTATION" in
- DEEP)
- permutation_file="$tools/CloudHunter/permutations-big.txt"
- ;;
- NORMAL)
- permutation_file="$tools/CloudHunter/permutations.txt"
+ local cloud_enum_profile cloud_enum_threads cloud_enum_mutations cloud_enum_quickscan
+ local cloud_enum_python cloud_enum_script cloud_enum_status cloud_enum_rc company_name
+ cloud_enum_profile=$(printf "%s" "${CLOUD_ENUM_S3_PROFILE:-optimized}" | tr '[:upper:]' '[:lower:]')
+ cloud_enum_threads="${CLOUD_ENUM_S3_THREADS:-20}"
+ if [[ ! "$cloud_enum_threads" =~ ^[0-9]+$ ]] || [[ "$cloud_enum_threads" -le 0 ]]; then
+ _print_msg WARN "Invalid CLOUD_ENUM_S3_THREADS (${cloud_enum_threads}); using default 20."
+ cloud_enum_threads=20
+ fi
+
+ case "$cloud_enum_profile" in
+ optimized)
+ cloud_enum_mutations=""
+ cloud_enum_quickscan=true
;;
- NONE)
- permutation_file=""
+ exhaustive)
+ cloud_enum_mutations="${tools}/cloud_enum/enum_tools/fuzz.txt"
+ cloud_enum_quickscan=false
;;
*)
- print_warnf "Invalid value for CLOUDHUNTER_PERMUTATION: %s." "$CLOUDHUNTER_PERMUTATION"
- return 1
+ _print_msg WARN "Invalid CLOUD_ENUM_S3_PROFILE (${cloud_enum_profile}); using optimized."
+ cloud_enum_profile="optimized"
+ cloud_enum_mutations=""
+ cloud_enum_quickscan=true
;;
esac
- if [[ -n "$permutation_file" ]]; then
- if [[ -f "$permutation_file" ]]; then
- PERMUTATION_FLAG="-p"
- else
- _print_msg WARN "CloudHunter permutations file not found (${permutation_file}); continuing without permutations."
- log_note "CloudHunter permutations file not found (${permutation_file}); continuing without permutations." "${FUNCNAME[0]}" "${LINENO}"
- permutation_file=""
- PERMUTATION_FLAG=""
- fi
- fi
-
- # Debug: Print the full CloudHunter command
- #printf "CloudHunter command: %s/venv/bin/python3 %s/cloudhunter.py %s -r %s/resolvers.txt -t 50 [URL]\n" "$tools/CloudHunter" "$tools/CloudHunter" "$PERMUTATION_FLAG" "$tools/CloudHunter" >>"$LOGFILE"
-
- # Debug: Check if files exist
- if [[ -f "$tools/CloudHunter/cloudhunter.py" ]]; then
- printf "cloudhunter.py exists\n" >>"$LOGFILE"
+ cloud_enum_python="${tools}/cloud_enum/venv/bin/python3"
+ cloud_enum_script="${tools}/cloud_enum/cloud_enum.py"
+ printf "Processing domain: %s\n" "$domain" >>"$LOGFILE"
+ print_notice RUN "cloud_enum" "enumerating cloud buckets (cloud_enum)"
+ start_subfunc "cloud_enum" "enumerating cloud buckets (cloud_enum)"
+ cloud_enum_status="OK"
+ cloud_enum_rc=0
+
+ if [[ ! -f "$cloud_enum_script" ]] || [[ ! -x "$cloud_enum_python" ]]; then
+ _print_msg WARN "cloud_enum runtime missing in ${tools}/cloud_enum; skipping cloud enumeration."
+ cloud_enum_status="WARN"
+ cloud_enum_rc=1
+ elif [[ "$cloud_enum_quickscan" != true ]] && [[ ! -f "$cloud_enum_mutations" ]]; then
+ _print_msg WARN "cloud_enum mutations file not found (${cloud_enum_mutations}); skipping cloud enumeration."
+ cloud_enum_status="WARN"
+ cloud_enum_rc=1
else
- printf "cloudhunter.py not found\n" >>"$LOGFILE"
- fi
-
- if [[ -n $permutation_file ]]; then
- if [[ -f $permutation_file ]]; then
- printf "Permutations file exists\n" >>"$LOGFILE"
+ company_name=$(unfurl format %r <<<"$domain")
+ local -a cloud_enum_cmd=(
+ env PYTHONWARNINGS=ignore
+ "$cloud_enum_python"
+ "$cloud_enum_script"
+ -k "$company_name"
+ -k "$domain"
+ -k "${domain%%.*}"
+ -t "$cloud_enum_threads"
+ -f json
+ -l "$dir/subdomains/.cloud_enum_s3.jsonl"
+ )
+ if [[ -f "$resolvers" ]]; then
+ cloud_enum_cmd+=(-nsf "$resolvers")
+ fi
+ if [[ "$cloud_enum_quickscan" == true ]]; then
+ cloud_enum_cmd+=(-qs)
else
- printf "Permutations file not found: %s\n" "$permutation_file" >>"$LOGFILE"
+ cloud_enum_cmd+=(-m "$cloud_enum_mutations")
fi
- fi
- if [[ -f "$tools/CloudHunter/resolvers.txt" ]]; then
- printf "resolvers.txt exists\n" >>"$LOGFILE"
- else
- printf "resolvers.txt not found\n" >>"$LOGFILE"
+ run_command "${cloud_enum_cmd[@]}" >>"$LOGFILE" 2>>"$LOGFILE" || cloud_enum_rc=$?
+ if [[ $cloud_enum_rc -ne 0 ]]; then
+ cloud_enum_status="WARN"
+ print_warnf "cloud_enum command failed for domain %s (exit %s)." "$domain" "$cloud_enum_rc"
+ log_note "cloud_enum command failed for domain ${domain} (exit ${cloud_enum_rc})." "${FUNCNAME[0]}" "${LINENO}"
+ fi
fi
+ end_subfunc "cloud_enum done" "cloud_enum" "$cloud_enum_status"
- printf "Processing domain: %s\n" "$domain" >>"$LOGFILE"
- print_notice RUN "cloudhunter" "enumerating cloud buckets (CloudHunter)"
- start_subfunc "cloudhunter" "enumerating cloud buckets (CloudHunter)"
- local cloudhunter_status="OK"
- local cloudhunter_rc=0
- local cloudhunter_prev_dir
- cloudhunter_prev_dir="$(pwd)"
- if cd "$tools/CloudHunter"; then
- if [[ -n "$permutation_file" ]]; then
- run_command env PYTHONWARNINGS=ignore "${tools}/CloudHunter/venv/bin/python3" -W ignore ./cloudhunter.py \
- "$PERMUTATION_FLAG" "$permutation_file" -r ./resolvers.txt -t 50 "$domain" \
- >>"$dir/subdomains/cloudhunter_open_buckets.txt" 2>>"$LOGFILE" || cloudhunter_rc=$?
- else
- run_command env PYTHONWARNINGS=ignore "${tools}/CloudHunter/venv/bin/python3" -W ignore ./cloudhunter.py \
- -r ./resolvers.txt -t 50 "$domain" \
- >>"$dir/subdomains/cloudhunter_open_buckets.txt" 2>>"$LOGFILE" || cloudhunter_rc=$?
+ # Process cloud_enum JSON results into legacy-compatible artifacts
+ if [[ -s "subdomains/.cloud_enum_s3.jsonl" ]]; then
+ if ! jq -Rr '
+ fromjson?
+ | select(type == "object")
+ | select((.platform | type) == "string" and (.access | type) == "string" and (.msg | type) == "string" and (.target | type) == "string")
+ | "\(.platform)/\(.access)/\(.msg)/\(.target)"
+ ' subdomains/.cloud_enum_s3.jsonl 2>>"$LOGFILE" | sort -u >.tmp/cloud_enum_s3_legacy.txt; then
+ print_warnf "Failed to normalize cloud_enum JSON output."
fi
- else
- print_warnf "Failed to cd to %s." "$tools/CloudHunter"
- cloudhunter_rc=1
- fi
- cd "$cloudhunter_prev_dir" 2>/dev/null || true
- if [[ $cloudhunter_rc -ne 0 ]]; then
- cloudhunter_status="WARN"
- print_warnf "CloudHunter command failed for domain %s (exit %s)." "$domain" "$cloudhunter_rc"
- log_note "CloudHunter command failed for domain ${domain} (exit ${cloudhunter_rc})." "${FUNCNAME[0]}" "${LINENO}"
- fi
- end_subfunc "cloudhunter done" "cloudhunter" "$cloudhunter_status"
+ if [[ -s ".tmp/cloud_enum_s3_legacy.txt" ]]; then
+ cat .tmp/cloud_enum_s3_legacy.txt >subdomains/cloudhunter_open_buckets.txt
+ fi
- # 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
- print_warnf "Failed to process cloudhunter_open_buckets.txt."
+ if ! NUMOFLINES1=$(jq -Rr '
+ fromjson?
+ | select(type == "object")
+ | select((.target | type) == "string" and (.target | length) > 0)
+ | .target
+ ' subdomains/.cloud_enum_s3.jsonl 2>>"$LOGFILE" | sort -u | anew subdomains/cloud_assets.txt | wc -l); then
+ print_warnf "Failed to process cloud_enum JSON output."
NUMOFLINES1=0
fi
+
if [[ $NUMOFLINES1 -gt 0 ]]; then
notification "${NUMOFLINES1} new cloud assets found" "info"
fi
@@ -2106,26 +2128,66 @@ function s3buckets() {
done <subdomains/s3buckets.txt
fi
- # Run trufflehog for open buckets found by CloudHunter
- if [[ -s "subdomains/cloudhunter_open_buckets.txt" ]]; then
- while IFS= read -r line; do
- if echo "$line" | grep -q "Aws Cloud"; then
- # AWS S3 Bucket
- bucket_name=$(echo "$line" | awk '{print $3}')
- run_command trufflehog s3 --bucket="$bucket_name" -j 2>/dev/null | jq -c | anew -q subdomains/cloudhunter_buckets_trufflehog.txt
- elif echo "$line" | grep -q "Google Cloud"; then
- # Google Cloud Storage
- bucket_name=$(echo "$line" | awk '{print $3}')
- run_command trufflehog gcs --project-id="$bucket_name" -j 2>/dev/null | jq -c | anew -q subdomains/cloudhunter_buckets_trufflehog.txt
- fi
- done <subdomains/cloudhunter_open_buckets.txt
+ # Run trufflehog for public buckets found by cloud_enum
+ if [[ -s "subdomains/.cloud_enum_s3.jsonl" ]]; then
+ jq -Rr '
+ fromjson?
+ | select(type == "object")
+ | select((.platform | type) == "string" and (.access | type) == "string" and (.msg | type) == "string" and (.target | type) == "string")
+ | select(.platform == "aws" and .access == "public" and (.msg | ascii_upcase | contains("S3 BUCKET")))
+ | .target
+ ' subdomains/.cloud_enum_s3.jsonl 2>>"$LOGFILE" | sort -u >.tmp/cloud_enum_public_aws_targets.txt || true
+
+ if [[ -s ".tmp/cloud_enum_public_aws_targets.txt" ]]; then
+ while IFS= read -r target; do
+ local bucket_host bucket_name
+ bucket_host="${target#http://}"
+ bucket_host="${bucket_host#https://}"
+ bucket_host="${bucket_host%%/*}"
+ bucket_name=""
+ if [[ "$bucket_host" =~ ^([^.]+)\.s3([.-][^.]+)?\.amazonaws\.com$ ]]; then
+ bucket_name="${BASH_REMATCH[1]}"
+ fi
+ if [[ -n "$bucket_name" ]]; then
+ run_command trufflehog s3 --bucket="$bucket_name" -j 2>/dev/null | jq -c | anew -q subdomains/cloudhunter_buckets_trufflehog.txt
+ fi
+ done <.tmp/cloud_enum_public_aws_targets.txt
+ fi
+
+ jq -Rr '
+ fromjson?
+ | select(type == "object")
+ | select((.platform | type) == "string" and (.access | type) == "string" and (.msg | type) == "string" and (.target | type) == "string")
+ | select(.platform == "gcp" and .access == "public" and (.msg | ascii_upcase | contains("GOOGLE BUCKET")))
+ | .target
+ ' subdomains/.cloud_enum_s3.jsonl 2>>"$LOGFILE" | sort -u >.tmp/cloud_enum_public_gcp_targets.txt || true
+
+ if [[ -s ".tmp/cloud_enum_public_gcp_targets.txt" ]]; then
+ while IFS= read -r target; do
+ local target_no_scheme bucket_name
+ target_no_scheme="${target#http://}"
+ target_no_scheme="${target_no_scheme#https://}"
+ bucket_name=""
+
+ if [[ "$target_no_scheme" == storage.googleapis.com/* ]]; then
+ bucket_name="${target_no_scheme#storage.googleapis.com/}"
+ bucket_name="${bucket_name%%/*}"
+ elif [[ "$target_no_scheme" =~ ^([^.]+)\.storage\.googleapis\.com(/.*)?$ ]]; then
+ bucket_name="${BASH_REMATCH[1]}"
+ fi
+
+ if [[ -n "$bucket_name" ]]; then
+ run_command trufflehog gcs --project-id="$bucket_name" -j 2>/dev/null | jq -c | anew -q subdomains/cloudhunter_buckets_trufflehog.txt
+ fi
+ done <.tmp/cloud_enum_public_gcp_targets.txt
+ fi
fi
# Append cloud assets to asset store
- append_assets_from_file cloud asset subdomains/cloudhunter_open_buckets.txt
+ append_assets_from_file cloud asset subdomains/cloud_assets.txt
append_assets_from_file cloud s3bucket subdomains/s3buckets.txt
- end_func "Results are saved in subdomains/s3buckets.txt, subdomains/cloud_assets.txt, subdomains/s3buckets_trufflehog.txt, and subdomains/cloudhunter_buckets_trufflehog.txt" "${FUNCNAME[0]}"
+ end_func "Results are saved in subdomains/s3buckets.txt, subdomains/cloud_assets.txt, subdomains/.cloud_enum_s3.jsonl, subdomains/s3buckets_trufflehog.txt, and subdomains/cloudhunter_buckets_trufflehog.txt" "${FUNCNAME[0]}"
else
if [[ $S3BUCKETS == false ]]; then
skip_notification "disabled"
diff --git a/modules/utils.sh b/modules/utils.sh
index 9d13728..ce27ccd 100644
--- a/modules/utils.sh
+++ b/modules/utils.sh
@@ -411,6 +411,12 @@ function run_command() {
return 0
fi
+ local cmd_name="${1##*/}"
+ if [[ "$cmd_name" == axiom-* ]]; then
+ _run_axiom_command_with_detection "$@"
+ return $?
+ fi
+
if [[ "${ADAPTIVE_RATE_LIMIT:-false}" == "true" ]]; then
run_with_adaptive_rate "$@"
else
@@ -461,6 +467,10 @@ MAX_RATE_LIMIT=500
RATE_LIMIT_BACKOFF_FACTOR=0.5
RATE_LIMIT_INCREASE_FACTOR=1.2
PARALLEL_PRESSURE_LEVEL=${PARALLEL_PRESSURE_LEVEL:-normal}
+AXIOM_RUNTIME_DISABLED=${AXIOM_RUNTIME_DISABLED:-false}
+AXIOM_RUNTIME_DISABLE_REASON=${AXIOM_RUNTIME_DISABLE_REASON:-}
+AXIOM_RUNTIME_DISABLE_CMD=${AXIOM_RUNTIME_DISABLE_CMD:-}
+AXIOM_RUNTIME_DISABLE_NOTIFIED=${AXIOM_RUNTIME_DISABLE_NOTIFIED:-false}
# Detect rate limit errors in command output
# Usage: detect_rate_limit_error <output_file_or_string>
@@ -474,6 +484,78 @@ function detect_rate_limit_error() {
return 1 # No rate limit detected
}
+axiom_runtime_enabled() {
+ [[ ${AXIOM:-false} == true ]] && [[ ${AXIOM_RUNTIME_DISABLED:-false} != true ]]
+}
+
+axiom_transport_error_detected() {
+ local output="$1"
+ [[ -z "$output" ]] && return 1
+ grep -qiE \
+ "(Unable to reach any instance selected|No instance supplied or instance not found|No axiom instances running|No axiom instances selected|Could not resolve hostname|Temporary failure in name resolution|Name or service not known|Connection timed out|i/o timeout|context deadline exceeded|dial tcp|connection refused|kex_exchange_identification|Host key verification failed|REMOTE HOST IDENTIFICATION HAS CHANGED)" \
+ <<<"$output"
+}
+
+axiom_disable_runtime() {
+ local reason="${1:-transport error}"
+ local cmd="${2:-axiom command}"
+
+ if [[ ${AXIOM_RUNTIME_DISABLED:-false} == true ]]; then
+ return 0
+ fi
+
+ AXIOM=false
+ AXIOM_RUNTIME_DISABLED=true
+ AXIOM_RUNTIME_DISABLE_REASON="$reason"
+ AXIOM_RUNTIME_DISABLE_CMD="$cmd"
+
+ if [[ ${AXIOM_RUNTIME_DISABLE_NOTIFIED:-false} != true ]]; then
+ AXIOM_RUNTIME_DISABLE_NOTIFIED=true
+ if declare -F notification >/dev/null 2>&1; then
+ notification "Axiom disabled for this run (${reason}). Falling back to local execution." warn
+ fi
+ fi
+
+ log_note "axiom runtime disabled: reason='${reason}' cmd='${cmd}'" "${FUNCNAME[0]}" "${LINENO}"
+}
+
+_handle_axiom_command_result() {
+ local rc="${1:-0}"
+ local cmd="${2:-}"
+ local err_file="${3:-}"
+ local err_out=""
+
+ if [[ -n "$err_file" && -f "$err_file" ]]; then
+ err_out=$(cat "$err_file")
+ fi
+
+ if [[ "$rc" -ne 0 ]] && axiom_transport_error_detected "$err_out"; then
+ axiom_disable_runtime "transport/connectivity failure" "$cmd"
+ fi
+}
+
+_run_axiom_command_with_detection() {
+ local -a cmd=("$@")
+ local axiom_err_tmp
+ local rc
+ axiom_err_tmp=$(mktemp)
+
+ if [[ -n "${DEBUG_LOG:-}" ]]; then
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
+ "${cmd[@]}" 2> >(tee -a "$axiom_err_tmp" "$DEBUG_LOG" >&2)
+ else
+ "${cmd[@]}" 2> >(tee -a "$axiom_err_tmp" "$DEBUG_LOG" >/dev/null)
+ fi
+ else
+ "${cmd[@]}" 2> >(tee -a "$axiom_err_tmp" >&2)
+ fi
+ rc=$?
+
+ _handle_axiom_command_result "$rc" "${cmd[*]}" "$axiom_err_tmp"
+ rm -f "$axiom_err_tmp" 2>/dev/null || true
+ return "$rc"
+}
+
# Adjust rate limit based on errors
# Usage: adjust_rate_limit <increase|decrease>
function adjust_rate_limit() {
diff --git a/reconftw.cfg b/reconftw.cfg
index 087338c..3284a2f 100644
--- a/reconftw.cfg
+++ b/reconftw.cfg
@@ -227,7 +227,8 @@ PASSWORD_MIN_LENGTH=5 # Min password length
PASSWORD_MAX_LENGTH=14 # Max password length
KATANA_HEADLESS_PROFILE=off # off|smart|full
KATANA_HEADLESS_SMART_LIMIT=15 # smart mode enables headless only for small target sets
-CLOUDHUNTER_PERMUTATION=NORMAL # Options: DEEP (very slow), NORMAL (slow), NONE
+CLOUD_ENUM_S3_PROFILE=optimized # optimized: quickscan (-qs, no -m/-b) | exhaustive: -m ${tools}/cloud_enum/enum_tools/fuzz.txt
+CLOUD_ENUM_S3_THREADS=20 # Threads used by cloud_enum in s3buckets/cloud enumeration
# Vulns
VULNS_GENERAL=false # Enable or disable the vulnerability module (very intrusive and slow)
diff --git a/reconftw.sh b/reconftw.sh
index 2996573..2fb7b75 100755
--- a/reconftw.sh
+++ b/reconftw.sh
@@ -160,7 +160,7 @@ while true; do
_print_msg WARN "Usage: -l <file> where file contains one target per line"
exit 1
fi
- while IFS= read -r t; do
+ while IFS= read -r t || [[ -n "$t" ]]; do
[[ -z "$t" ]] && continue
t=$(_sanitize_list_entry "$t") || continue
ipcidr_target "$t" "$list"
@@ -415,8 +415,8 @@ while true; do
;;
'--log-format')
CLI_LOG_FORMAT="$2"
- if [[ ! "$CLI_LOG_FORMAT" =~ ^(plain|jsonl)$ ]]; then
- print_errorf "Invalid --log-format value '%s' (allowed: plain|jsonl)" "$CLI_LOG_FORMAT"
+ if [[ ! "$CLI_LOG_FORMAT" =~ ^(plain|jsonl|jsonl-strict)$ ]]; then
+ print_errorf "Invalid --log-format value '%s' (allowed: plain|jsonl|jsonl-strict)" "$CLI_LOG_FORMAT"
exit 1
fi
shift 2
@@ -495,6 +495,10 @@ fi
if [[ -n "${CLI_NO_COLOR:-}" ]]; then
NO_COLOR=1
fi
+if [[ "${LOG_FORMAT:-plain}" == "jsonl-strict" ]]; then
+ # Machine-only output mode: suppress human-oriented rendering.
+ OUTPUT_VERBOSITY=0
+fi
if [[ "${HELP_REQUESTED:-false}" == "true" ]]; then
help
@@ -506,6 +510,10 @@ if [[ "${NO_BANNER:-false}" == "true" ]]; then
else
SHOW_BANNER=true
fi
+if [[ "${OUTPUT_VERBOSITY:-1}" -eq 0 ]]; then
+ SHOW_BANNER=false
+ SHOW_LEGAL=false
+fi
if [[ "${NO_REPORT:-false}" == "true" ]]; then
EXPORT_FORMAT=""
@@ -554,7 +562,7 @@ ui_init
if [[ "${SHOW_BANNER:-false}" == "true" ]]; then
banner
- printf "\n\n" # Two empty lines after banner
+ printf "\n" # Single empty line after banner
fi
if [[ "${SHOW_LEGAL:-false}" == "true" ]]; then
printf " %b[LEGAL]%b Authorized testing only. You confirm explicit permission\n" "$yellow" "$reset"
@@ -620,7 +628,7 @@ case $opt_mode in
mode="list_recon"
fi
sed_i 's/\r$//' "$flist"
- while IFS= read -r domain <&3; do
+ while IFS= read -r domain <&3 || [[ -n "$domain" ]]; do
[[ -z "$domain" ]] && continue
domain=$(_sanitize_list_entry "$domain") || continue
start
@@ -642,7 +650,7 @@ case $opt_mode in
mode="subs_menu"
fi
sed_i 's/\r$//' "$flist"
- while IFS= read -r domain <&3; do
+ while IFS= read -r domain <&3 || [[ -n "$domain" ]]; do
[[ -z "$domain" ]] && continue
domain=$(_sanitize_list_entry "$domain") || continue
subs_menu
@@ -657,7 +665,7 @@ case $opt_mode in
mode="passive"
fi
sed_i 's/\r$//' "$flist"
- while IFS= read -r domain <&3; do
+ while IFS= read -r domain <&3 || [[ -n "$domain" ]]; do
[[ -z "$domain" ]] && continue
domain=$(_sanitize_list_entry "$domain") || continue
passive
@@ -673,7 +681,7 @@ case $opt_mode in
mode="all"
fi
sed_i 's/\r$//' "$flist"
- while IFS= read -r domain <&3; do
+ while IFS= read -r domain <&3 || [[ -n "$domain" ]]; do
[[ -z "$domain" ]] && continue
domain=$(_sanitize_list_entry "$domain") || continue
all
@@ -705,7 +713,7 @@ case $opt_mode in
fi
if [[ -n $list ]]; then
sed_i 's/\r$//' "$flist"
- while IFS= read -r domain <&3; do
+ while IFS= read -r domain <&3 || [[ -n "$domain" ]]; do
[[ -z "$domain" ]] && continue
domain=$(_sanitize_list_entry "$domain") || continue
start
@@ -724,7 +732,7 @@ case $opt_mode in
mode="zen_menu"
fi
sed_i 's/\r$//' "$flist"
- while IFS= read -r domain <&3; do
+ while IFS= read -r domain <&3 || [[ -n "$domain" ]]; do
[[ -z "$domain" ]] && continue
domain=$(_sanitize_list_entry "$domain") || continue
zen_menu
@@ -748,7 +756,7 @@ case $opt_mode in
}
LOGFILE="${dir}/.log/${NOW}_${NOWT}.txt"
called_fn_dir=$dir/.called_fn
- $custom_function
+ run_module_with_axiom_failover "$custom_function"
cd "${SCRIPTPATH}" || {
echo "Failed to cd directory '${SCRIPTPATH}'"
exit 1
diff --git a/tests/fixtures/ui/full_v0.txt b/tests/fixtures/ui/full_v0.txt
new file mode 100644
index 0000000..dba220b
--- /dev/null
+++ b/tests/fixtures/ui/full_v0.txt
@@ -0,0 +1,9 @@
+
+RESULTS example.com
+Mode: FULL
+Subdomains: 1
+Web hosts: 0
+Findings: C 0 | H 0 | M 0 | L 0 | I 0
+Duration: 1m 00s
+Output: /tmp/recon
+
diff --git a/tests/fixtures/ui/full_v1.txt b/tests/fixtures/ui/full_v1.txt
new file mode 100644
index 0000000..7b434f0
--- /dev/null
+++ b/tests/fixtures/ui/full_v1.txt
@@ -0,0 +1,25 @@
+────────────────────────────────────────────────────────────────────────────────
+reconftw test-v0 by @six2dez | Authorized testing only
+────────────────────────────────────────────────────────────────────────────────
+Mode: FULL | Target: example.com | Profile: default | Parallel: true | Jobs: 4
+Output: /tmp/recon
+Network: behind_nat=no | DNS: dnsx
+System: PERF_PROFILE=balanced | cores=8 mem=16GB | Disk space OK: 10GB availa...
+Started: <TS>
+
+
+── SUBDOMAINS ───────────────────────────────────────────────────────────────
+Started: <TS>
+OK subdomains_full 0s
+ Output: subdomains/, webs/
+
+Completed: <TS>
+
+RESULTS example.com
+Mode: FULL
+Subdomains: 1
+Web hosts: 0
+Findings: C 0 | H 0 | M 0 | L 0 | I 0
+Duration: 1m 00s
+Output: /tmp/recon
+
diff --git a/tests/fixtures/ui/full_v2.txt b/tests/fixtures/ui/full_v2.txt
new file mode 100644
index 0000000..11db5df
--- /dev/null
+++ b/tests/fixtures/ui/full_v2.txt
@@ -0,0 +1,26 @@
+────────────────────────────────────────────────────────────────────────────────
+reconftw test-v0 by @six2dez | Authorized testing only
+────────────────────────────────────────────────────────────────────────────────
+Mode: FULL | Target: example.com | Profile: default | Parallel: true | Jobs: 4
+Output: /tmp/recon
+Network: behind_nat=no | DNS: dnsx
+System: PERF_PROFILE=balanced | cores=8 mem=16GB | Disk space OK: 10GB availa...
+Started: <TS>
+
+
+── SUBDOMAINS ───────────────────────────────────────────────────────────────
+Started: <TS>
+OK subdomains_full 0s
+[INFO] verbose_marker
+ Output: subdomains/, webs/
+
+Completed: <TS>
+
+RESULTS example.com
+Mode: FULL
+Subdomains: 1
+Web hosts: 0
+Findings: C 0 | H 0 | M 0 | L 0 | I 0
+Duration: 1m 00s
+Output: /tmp/recon
+
diff --git a/tests/fixtures/ui/subdomains_v0.txt b/tests/fixtures/ui/subdomains_v0.txt
new file mode 100644
index 0000000..100ed48
--- /dev/null
+++ b/tests/fixtures/ui/subdomains_v0.txt
@@ -0,0 +1,9 @@
+
+RESULTS example.com
+Mode: SUBDOMAINS
+Subdomains: 1
+Web hosts: 0
+Findings: C 0 | H 0 | M 0 | L 0 | I 0
+Duration: 1m 00s
+Output: /tmp/recon
+
diff --git a/tests/fixtures/ui/subdomains_v1.txt b/tests/fixtures/ui/subdomains_v1.txt
new file mode 100644
index 0000000..dc695b6
--- /dev/null
+++ b/tests/fixtures/ui/subdomains_v1.txt
@@ -0,0 +1,25 @@
+────────────────────────────────────────────────────────────────────────────────
+reconftw test-v0 by @six2dez | Authorized testing only
+────────────────────────────────────────────────────────────────────────────────
+Mode: SUBDOMAINS | Target: example.com | Profile: default | Parallel: true | ...
+Output: /tmp/recon
+Network: behind_nat=no | DNS: dnsx
+System: PERF_PROFILE=balanced | cores=8 mem=16GB | Disk space OK: 10GB availa...
+Started: <TS>
+
+
+── SUBDOMAINS ───────────────────────────────────────────────────────────────
+Started: <TS>
+OK subdomains_full 0s
+ Output: subdomains/, webs/
+
+Completed: <TS>
+
+RESULTS example.com
+Mode: SUBDOMAINS
+Subdomains: 1
+Web hosts: 0
+Findings: C 0 | H 0 | M 0 | L 0 | I 0
+Duration: 1m 00s
+Output: /tmp/recon
+
diff --git a/tests/fixtures/ui/subdomains_v2.txt b/tests/fixtures/ui/subdomains_v2.txt
new file mode 100644
index 0000000..8cb57b2
--- /dev/null
+++ b/tests/fixtures/ui/subdomains_v2.txt
@@ -0,0 +1,26 @@
+────────────────────────────────────────────────────────────────────────────────
+reconftw test-v0 by @six2dez | Authorized testing only
+────────────────────────────────────────────────────────────────────────────────
+Mode: SUBDOMAINS | Target: example.com | Profile: default | Parallel: true | ...
+Output: /tmp/recon
+Network: behind_nat=no | DNS: dnsx
+System: PERF_PROFILE=balanced | cores=8 mem=16GB | Disk space OK: 10GB availa...
+Started: <TS>
+
+
+── SUBDOMAINS ───────────────────────────────────────────────────────────────
+Started: <TS>
+OK subdomains_full 0s
+[INFO] verbose_marker
+ Output: subdomains/, webs/
+
+Completed: <TS>
+
+RESULTS example.com
+Mode: SUBDOMAINS
+Subdomains: 1
+Web hosts: 0
+Findings: C 0 | H 0 | M 0 | L 0 | I 0
+Duration: 1m 00s
+Output: /tmp/recon
+
diff --git a/tests/integration/test_list_targets.bats b/tests/integration/test_list_targets.bats
new file mode 100644
index 0000000..c3a7628
--- /dev/null
+++ b/tests/integration/test_list_targets.bats
@@ -0,0 +1,80 @@
+#!/usr/bin/env bats
+
+setup() {
+ local project_root
+ project_root="$(cd "$(dirname "$BATS_TEST_FILENAME")/../.." && pwd)"
+ export SCRIPTPATH="$project_root"
+ export TEST_DIR="$BATS_TEST_TMPDIR/reconftw_list_targets"
+ export MOCK_BIN="$TEST_DIR/mockbin"
+ mkdir -p "$TEST_DIR" "$MOCK_BIN"
+
+ cat >"$MOCK_BIN/git" <<'EOF'
+#!/usr/bin/env bash
+set -euo pipefail
+case "${1:-}" in
+ fetch)
+ exit 0
+ ;;
+ rev-parse)
+ shift
+ case "${1:-}" in
+ --is-inside-work-tree)
+ echo "true"
+ ;;
+ --abbrev-ref)
+ if [[ "${2:-}" == "HEAD" ]]; then
+ echo "dev"
+ elif [[ "${2:-}" == "--symbolic-full-name" ]]; then
+ echo "origin/dev"
+ fi
+ ;;
+ HEAD | origin/dev)
+ echo "deadbeef"
+ ;;
+ *)
+ echo "deadbeef"
+ ;;
+ esac
+ exit 0
+ ;;
+ *)
+ exit 0
+ ;;
+esac
+EOF
+ chmod +x "$MOCK_BIN/git"
+}
+
+teardown() {
+ [[ -n "${TARGET_1:-}" ]] && rm -rf "$SCRIPTPATH/Recon/$TARGET_1"
+ [[ -n "${TARGET_2:-}" ]] && rm -rf "$SCRIPTPATH/Recon/$TARGET_2"
+ [[ -d "${TEST_DIR:-}" ]] && rm -rf "$TEST_DIR"
+}
+
+@test "-l processes final target even without trailing newline" {
+ TARGET_1="noeof-$RANDOM-one.example.com"
+ TARGET_2="noeof-$RANDOM-two.example.com"
+ local list_file="$TEST_DIR/targets-noeof.txt"
+ printf "%s\n%s" "$TARGET_1" "$TARGET_2" >"$list_file"
+
+ run env PATH="$MOCK_BIN:$PATH" SKIP_CRITICAL_CHECK=true timeout 60 \
+ bash "$SCRIPTPATH/reconftw.sh" -l "$list_file" -s --dry-run --no-report --quiet --no-banner 2>&1
+
+ [ "$status" -eq 0 ]
+ [[ "$output" == *"RESULTS $TARGET_1"* ]]
+ [[ "$output" == *"RESULTS $TARGET_2"* ]]
+}
+
+@test "-l processes CRLF target lists without dropping entries" {
+ TARGET_1="crlf-$RANDOM-one.example.com"
+ TARGET_2="crlf-$RANDOM-two.example.com"
+ local list_file="$TEST_DIR/targets-crlf.txt"
+ printf "%s\r\n%s\r\n" "$TARGET_1" "$TARGET_2" >"$list_file"
+
+ run env PATH="$MOCK_BIN:$PATH" SKIP_CRITICAL_CHECK=true timeout 60 \
+ bash "$SCRIPTPATH/reconftw.sh" -l "$list_file" -s --dry-run --no-report --quiet --no-banner 2>&1
+
+ [ "$status" -eq 0 ]
+ [[ "$output" == *"RESULTS $TARGET_1"* ]]
+ [[ "$output" == *"RESULTS $TARGET_2"* ]]
+}
diff --git a/tests/integration/test_terminal_output_modes.bats b/tests/integration/test_terminal_output_modes.bats
new file mode 100644
index 0000000..e7f5bb0
--- /dev/null
+++ b/tests/integration/test_terminal_output_modes.bats
@@ -0,0 +1,54 @@
+#!/usr/bin/env bats
+
+setup() {
+ SCRIPTPATH="$(cd "$(dirname "$BATS_TEST_FILENAME")/../.." && pwd)"
+ export SCRIPTPATH
+}
+
+@test "--quiet hides header/sections but keeps final summary" {
+ run timeout 45 bash "$SCRIPTPATH/reconftw.sh" -d example.com -s --dry-run --no-report --quiet 2>&1
+ [ "$status" -eq 0 ]
+
+ [[ "$output" != *"Mode: SUBDOMAINS | Target:"* ]]
+ [[ "$output" != *"── SUBDOMAINS"* ]]
+ [[ "$output" == *"RESULTS example.com"* ]]
+ [[ "$output" == *"Mode: SUBDOMAINS"* ]]
+}
+
+@test "--log-format jsonl-strict emits JSONL lines only" {
+ run timeout 45 bash "$SCRIPTPATH/reconftw.sh" -d example.com -s --dry-run --no-report --log-format jsonl-strict 2>&1
+ [ "$status" -eq 0 ]
+
+ local has_header=0
+ local has_summary=0
+ local has_status=0
+
+ while IFS= read -r line; do
+ [[ -z "$line" ]] && continue
+ if [[ ! "$line" =~ ^\{.*\}$ ]]; then
+ echo "non-json line: $line"
+ return 1
+ fi
+ if command -v jq >/dev/null 2>&1; then
+ if ! printf '%s\n' "$line" | jq -e . >/dev/null 2>&1; then
+ echo "invalid json line: $line"
+ return 1
+ fi
+ module=$(printf '%s\n' "$line" | jq -r '.module // empty')
+ msg=$(printf '%s\n' "$line" | jq -r '.msg // empty')
+ [[ "$module" == "header" ]] && has_header=1
+ [[ "$module" == "summary" ]] && has_summary=1
+ [[ "$msg" == "Status update" ]] && has_status=1
+ fi
+ done <<< "$output"
+
+ if command -v jq >/dev/null 2>&1; then
+ [ "$has_header" -eq 1 ]
+ [ "$has_summary" -eq 1 ]
+ [ "$has_status" -eq 1 ]
+ else
+ [[ "$output" == *'"module":"header"'* ]]
+ [[ "$output" == *'"module":"summary"'* ]]
+ [[ "$output" == *'"msg":"Status update"'* ]]
+ fi
+}
diff --git a/tests/unit/test_common.bats b/tests/unit/test_common.bats
index cc0f30c..31d2eb8 100644
--- a/tests/unit/test_common.bats
+++ b/tests/unit/test_common.bats
@@ -308,3 +308,59 @@ EOF
[[ "$output" == *"new"* ]]
grep -q "new" "$outfile"
}
+
+###############################################################################
+# stream sanitization tests
+###############################################################################
+
+@test "strip_ansi_stream keeps final carriage-return segment" {
+ _run_strip_cr() { printf "line1\rline2\n" | strip_ansi_stream; }
+ run _run_strip_cr
+ [ "$status" -eq 0 ]
+ [ "$output" = "line2" ]
+}
+
+@test "strip_ansi_stream removes backspace redraw artifacts" {
+ _run_strip_bs() { printf "abc\b\bXY\n" | strip_ansi_stream; }
+ run _run_strip_bs
+ [ "$status" -eq 0 ]
+ [ "$output" = "aXY" ]
+}
+
+###############################################################################
+# domain matching helpers tests
+###############################################################################
+
+@test "grep_domain matches exact domain and subdomains only" {
+ cat > domains.txt <<'EOF'
+example.com
+api.example.com
+badexample.com
+foo.example.net
+EOF
+
+ run grep_domain domains.txt "example.com"
+ [ "$status" -eq 0 ]
+ [[ "$output" == *"example.com"* ]]
+ [[ "$output" == *"api.example.com"* ]]
+ [[ "$output" != *"badexample.com"* ]]
+ [[ "$output" != *"foo.example.net"* ]]
+}
+
+###############################################################################
+# warning helpers tests
+###############################################################################
+
+@test "warn_once emits the same warning key only once" {
+ WARN_ONCE_KEYS=()
+ _warn_twice() {
+ warn_once "missing-tool-dnstake" "dnstake missing"
+ warn_once "missing-tool-dnstake" "dnstake missing" || true
+ }
+
+ run _warn_twice
+ [ "$status" -eq 0 ]
+ local warn_count
+ warn_count=$(printf "%s\n" "$output" | grep -c "dnstake missing" || true)
+ [ "$warn_count" -eq 1 ]
+}
diff --git a/tests/unit/test_new_tool_integrations.bats b/tests/unit/test_new_tool_integrations.bats
index 9698467..4ea8e12 100644
--- a/tests/unit/test_new_tool_integrations.bats
+++ b/tests/unit/test_new_tool_integrations.bats
@@ -189,6 +189,491 @@ SH
grep -q "postman.new.example.com" "osint/postman_leaks.txt"
}
+@test "s3buckets uses cloud_enum and writes legacy-compatible artifacts" {
+ mkdir -p subdomains .tmp
+ printf '%s\n' 'target.example.com' > subdomains/subdomains.txt
+
+ export S3BUCKETS=true
+ export CLOUD_ENUM_S3_PROFILE="optimized"
+ export CLOUD_ENUM_S3_THREADS=7
+ export ASSET_STORE=false
+ export AXIOM=false
+ export multi=""
+ export tools="$TEST_DIR/tools"
+ mkdir -p "$tools/cloud_enum/venv/bin" "$tools/cloud_enum"
+
+ printf '%s\n' '1.1.1.1' > "$TEST_DIR/resolvers.txt"
+ export resolvers="$TEST_DIR/resolvers.txt"
+
+ cat > "$MOCK_BIN/anew" <<'SH'
+#!/usr/bin/env bash
+quiet=false
+if [[ "${1:-}" == "-q" ]]; then
+ quiet=true
+ shift
+fi
+outfile="$1"
+touch "$outfile"
+while IFS= read -r line; do
+ [[ -z "$line" ]] && continue
+ if ! grep -Fxq -- "$line" "$outfile"; then
+ printf '%s\n' "$line" >> "$outfile"
+ if [[ "$quiet" != true ]]; then
+ printf '%s\n' "$line"
+ fi
+ fi
+done
+SH
+ chmod +x "$MOCK_BIN/anew"
+
+ cat > "$MOCK_BIN/unfurl" <<'SH'
+#!/usr/bin/env bash
+if [[ "${1:-}" == "format" ]] && [[ "${2:-}" == "%r" ]]; then
+ while IFS= read -r line; do
+ printf '%s\n' "${line%%.*}"
+ done
+else
+ cat
+fi
+SH
+ chmod +x "$MOCK_BIN/unfurl"
+
+ cat > "$MOCK_BIN/s3scanner" <<'SH'
+#!/usr/bin/env bash
+printf '%s\n' 'scan-bucket'
+SH
+ chmod +x "$MOCK_BIN/s3scanner"
+
+ cat > "$MOCK_BIN/trufflehog" <<'SH'
+#!/usr/bin/env bash
+printf '%s\n' "$*" >> "$TEST_DIR/trufflehog_calls.txt"
+printf '%s\n' '{"DetectorName":"mock"}'
+SH
+ chmod +x "$MOCK_BIN/trufflehog"
+
+ cat > "$tools/cloud_enum/cloud_enum.py" <<'PY'
+print("mock")
+PY
+
+ cat > "$tools/cloud_enum/venv/bin/python3" <<'SH'
+#!/usr/bin/env bash
+printf '%s\n' "$*" > "$TEST_DIR/cloud_enum_args.txt"
+logfile=""
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -l)
+ logfile="$2"
+ shift 2
+ ;;
+ *)
+ shift
+ ;;
+ esac
+done
+mkdir -p "$(dirname "$logfile")"
+cat > "$logfile" <<'JSON'
+#### CLOUD_ENUM TEST ####
+{"platform":"aws","msg":"OPEN S3 BUCKET","target":"http://demo.s3.amazonaws.com","access":"public"}
+{"platform":"gcp","msg":"OPEN GOOGLE BUCKET","target":"http://storage.googleapis.com/public-gcp","access":"public"}
+{"platform":"gcp","msg":"Protected Google Bucket","target":"http://storage.googleapis.com/protected-gcp","access":"protected"}
+JSON
+exit 0
+SH
+ chmod +x "$tools/cloud_enum/venv/bin/python3"
+
+ run s3buckets
+ [ "$status" -eq 0 ]
+ [ -s "subdomains/cloudhunter_open_buckets.txt" ]
+ grep -q '^aws/public/OPEN S3 BUCKET/http://demo.s3.amazonaws.com$' "subdomains/cloudhunter_open_buckets.txt"
+ grep -q '^gcp/public/OPEN GOOGLE BUCKET/http://storage.googleapis.com/public-gcp$' "subdomains/cloudhunter_open_buckets.txt"
+ [ -s "subdomains/cloud_assets.txt" ]
+ grep -q '^http://demo.s3.amazonaws.com$' "subdomains/cloud_assets.txt"
+ [ -s "subdomains/cloudhunter_buckets_trufflehog.txt" ]
+ grep -q -- '--bucket=demo' "$TEST_DIR/trufflehog_calls.txt"
+ grep -q -- '--project-id=public-gcp' "$TEST_DIR/trufflehog_calls.txt"
+ grep -Eq -- '(^| )-qs( |$)' "$TEST_DIR/cloud_enum_args.txt"
+ ! grep -Eq -- '(^| )-m( |$)' "$TEST_DIR/cloud_enum_args.txt"
+ ! grep -Eq -- '(^| )-b( |$)' "$TEST_DIR/cloud_enum_args.txt"
+}
+
+@test "s3buckets exhaustive profile uses cloud_enum fuzz.txt mutations" {
+ mkdir -p subdomains .tmp
+ printf '%s\n' 'target.example.com' > subdomains/subdomains.txt
+
+ export S3BUCKETS=true
+ export CLOUD_ENUM_S3_PROFILE="exhaustive"
+ export CLOUD_ENUM_S3_THREADS=7
+ export ASSET_STORE=false
+ export AXIOM=false
+ export multi=""
+ export tools="$TEST_DIR/tools"
+ mkdir -p "$tools/cloud_enum/venv/bin" "$tools/cloud_enum/enum_tools"
+ printf '%s\n' 'corp' > "$tools/cloud_enum/enum_tools/fuzz.txt"
+
+ printf '%s\n' '1.1.1.1' > "$TEST_DIR/resolvers.txt"
+ export resolvers="$TEST_DIR/resolvers.txt"
+
+ cat > "$MOCK_BIN/anew" <<'SH'
+#!/usr/bin/env bash
+quiet=false
+if [[ "${1:-}" == "-q" ]]; then
+ quiet=true
+ shift
+fi
+outfile="$1"
+touch "$outfile"
+while IFS= read -r line; do
+ [[ -z "$line" ]] && continue
+ if ! grep -Fxq -- "$line" "$outfile"; then
+ printf '%s\n' "$line" >> "$outfile"
+ if [[ "$quiet" != true ]]; then
+ printf '%s\n' "$line"
+ fi
+ fi
+done
+SH
+ chmod +x "$MOCK_BIN/anew"
+
+ cat > "$MOCK_BIN/unfurl" <<'SH'
+#!/usr/bin/env bash
+if [[ "${1:-}" == "format" ]] && [[ "${2:-}" == "%r" ]]; then
+ while IFS= read -r line; do
+ printf '%s\n' "${line%%.*}"
+ done
+else
+ cat
+fi
+SH
+ chmod +x "$MOCK_BIN/unfurl"
+
+ cat > "$MOCK_BIN/s3scanner" <<'SH'
+#!/usr/bin/env bash
+printf '%s\n' 'scan-bucket'
+SH
+ chmod +x "$MOCK_BIN/s3scanner"
+
+ cat > "$MOCK_BIN/trufflehog" <<'SH'
+#!/usr/bin/env bash
+printf '%s\n' '{"DetectorName":"mock"}'
+SH
+ chmod +x "$MOCK_BIN/trufflehog"
+
+ cat > "$tools/cloud_enum/cloud_enum.py" <<'PY'
+print("mock")
+PY
+
+ cat > "$tools/cloud_enum/venv/bin/python3" <<'SH'
+#!/usr/bin/env bash
+printf '%s\n' "$*" > "$TEST_DIR/cloud_enum_args_exhaustive.txt"
+logfile=""
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -l)
+ logfile="$2"
+ shift 2
+ ;;
+ *)
+ shift
+ ;;
+ esac
+done
+mkdir -p "$(dirname "$logfile")"
+cat > "$logfile" <<'JSON'
+{"platform":"aws","msg":"OPEN S3 BUCKET","target":"http://demo.s3.amazonaws.com","access":"public"}
+JSON
+exit 0
+SH
+ chmod +x "$tools/cloud_enum/venv/bin/python3"
+
+ run s3buckets
+ [ "$status" -eq 0 ]
+ grep -Fq -- "-m $tools/cloud_enum/enum_tools/fuzz.txt" "$TEST_DIR/cloud_enum_args_exhaustive.txt"
+ ! grep -Eq -- '(^| )-qs( |$)' "$TEST_DIR/cloud_enum_args_exhaustive.txt"
+ ! grep -Eq -- '(^| )-b( |$)' "$TEST_DIR/cloud_enum_args_exhaustive.txt"
+}
+
+@test "s3buckets continues with s3scanner when cloud_enum fails" {
+ mkdir -p subdomains .tmp
+ printf '%s\n' 'target.example.com' > subdomains/subdomains.txt
+
+ export S3BUCKETS=true
+ export CLOUD_ENUM_S3_PROFILE="optimized"
+ export CLOUD_ENUM_S3_THREADS=7
+ export ASSET_STORE=false
+ export AXIOM=false
+ export tools="$TEST_DIR/tools"
+ mkdir -p "$tools/cloud_enum/venv/bin" "$tools/cloud_enum"
+
+ printf '%s\n' '1.1.1.1' > "$TEST_DIR/resolvers.txt"
+ export resolvers="$TEST_DIR/resolvers.txt"
+
+ cat > "$MOCK_BIN/anew" <<'SH'
+#!/usr/bin/env bash
+quiet=false
+if [[ "${1:-}" == "-q" ]]; then
+ quiet=true
+ shift
+fi
+outfile="$1"
+touch "$outfile"
+while IFS= read -r line; do
+ [[ -z "$line" ]] && continue
+ if ! grep -Fxq -- "$line" "$outfile"; then
+ printf '%s\n' "$line" >> "$outfile"
+ if [[ "$quiet" != true ]]; then
+ printf '%s\n' "$line"
+ fi
+ fi
+done
+SH
+ chmod +x "$MOCK_BIN/anew"
+
+ cat > "$MOCK_BIN/unfurl" <<'SH'
+#!/usr/bin/env bash
+if [[ "${1:-}" == "format" ]] && [[ "${2:-}" == "%r" ]]; then
+ while IFS= read -r line; do
+ printf '%s\n' "${line%%.*}"
+ done
+else
+ cat
+fi
+SH
+ chmod +x "$MOCK_BIN/unfurl"
+
+ cat > "$MOCK_BIN/s3scanner" <<'SH'
+#!/usr/bin/env bash
+printf '%s\n' 'scan-bucket-fallback'
+SH
+ chmod +x "$MOCK_BIN/s3scanner"
+
+ cat > "$MOCK_BIN/trufflehog" <<'SH'
+#!/usr/bin/env bash
+printf '%s\n' '{"DetectorName":"mock"}'
+SH
+ chmod +x "$MOCK_BIN/trufflehog"
+
+ cat > "$tools/cloud_enum/cloud_enum.py" <<'PY'
+print("mock")
+PY
+
+ cat > "$tools/cloud_enum/venv/bin/python3" <<'SH'
+#!/usr/bin/env bash
+exit 1
+SH
+ chmod +x "$tools/cloud_enum/venv/bin/python3"
+
+ run s3buckets
+ [ "$status" -eq 0 ]
+ [ -f "subdomains/cloudhunter_open_buckets.txt" ]
+ [ ! -s "subdomains/cloudhunter_open_buckets.txt" ]
+ [ -s "subdomains/s3buckets.txt" ]
+ grep -q '^scan-bucket-fallback$' "subdomains/s3buckets.txt"
+}
+
+@test "cloud_enum_scan uses local cloud_enum runtime with optimized quickscan flags" {
+ mkdir -p osint
+ export OSINT=true
+ export CLOUD_ENUM=true
+ export ASSET_STORE=false
+ export tools="$TEST_DIR/tools"
+ mkdir -p "$tools/cloud_enum/venv/bin" "$tools/cloud_enum"
+
+ printf '%s\n' '1.1.1.1' > "$TEST_DIR/resolvers.txt"
+ export resolvers="$TEST_DIR/resolvers.txt"
+
+ cat > "$MOCK_BIN/anew" <<'SH'
+#!/usr/bin/env bash
+quiet=false
+if [[ "${1:-}" == "-q" ]]; then
+ quiet=true
+ shift
+fi
+outfile="$1"
+touch "$outfile"
+while IFS= read -r line; do
+ [[ -z "$line" ]] && continue
+ if ! grep -Fxq -- "$line" "$outfile"; then
+ printf '%s\n' "$line" >> "$outfile"
+ if [[ "$quiet" != true ]]; then
+ printf '%s\n' "$line"
+ fi
+ fi
+done
+SH
+ chmod +x "$MOCK_BIN/anew"
+
+ cat > "$MOCK_BIN/unfurl" <<'SH'
+#!/usr/bin/env bash
+if [[ "${1:-}" == "format" ]] && [[ "${2:-}" == "%r" ]]; then
+ while IFS= read -r line; do
+ printf '%s\n' "${line%%.*}"
+ done
+else
+ cat
+fi
+SH
+ chmod +x "$MOCK_BIN/unfurl"
+
+ cat > "$tools/cloud_enum/cloud_enum.py" <<'PY'
+print("mock")
+PY
+
+ cat > "$tools/cloud_enum/venv/bin/python3" <<'SH'
+#!/usr/bin/env bash
+printf '%s\n' "$*" > "$TEST_DIR/cloud_enum_scan_args.txt"
+printf '%s\n' 'OPEN S3 BUCKET: http://demo.s3.amazonaws.com'
+exit 0
+SH
+ chmod +x "$tools/cloud_enum/venv/bin/python3"
+
+ run cloud_enum_scan
+ [ "$status" -eq 0 ]
+ [ -s "osint/cloud_enum.txt" ]
+ grep -q 'OPEN S3 BUCKET' "osint/cloud_enum.txt"
+ grep -q -- 'cloud_enum.py' "$TEST_DIR/cloud_enum_scan_args.txt"
+ grep -Eq -- '(^| )-qs( |$)' "$TEST_DIR/cloud_enum_scan_args.txt"
+ ! grep -Eq -- '(^| )-m( |$)' "$TEST_DIR/cloud_enum_scan_args.txt"
+ ! grep -Eq -- '(^| )-b( |$)' "$TEST_DIR/cloud_enum_scan_args.txt"
+}
+
+@test "cloud_enum_scan exhaustive profile uses local fuzz mutations file" {
+ mkdir -p osint
+ export OSINT=true
+ export CLOUD_ENUM=true
+ export ASSET_STORE=false
+ export CLOUD_ENUM_S3_PROFILE="exhaustive"
+ export tools="$TEST_DIR/tools"
+ mkdir -p "$tools/cloud_enum/venv/bin" "$tools/cloud_enum/enum_tools"
+ printf '%s\n' 'corp' > "$tools/cloud_enum/enum_tools/fuzz.txt"
+
+ printf '%s\n' '1.1.1.1' > "$TEST_DIR/resolvers.txt"
+ export resolvers="$TEST_DIR/resolvers.txt"
+
+ cat > "$MOCK_BIN/anew" <<'SH'
+#!/usr/bin/env bash
+quiet=false
+if [[ "${1:-}" == "-q" ]]; then
+ quiet=true
+ shift
+fi
+outfile="$1"
+touch "$outfile"
+while IFS= read -r line; do
+ [[ -z "$line" ]] && continue
+ if ! grep -Fxq -- "$line" "$outfile"; then
+ printf '%s\n' "$line" >> "$outfile"
+ if [[ "$quiet" != true ]]; then
+ printf '%s\n' "$line"
+ fi
+ fi
+done
+SH
+ chmod +x "$MOCK_BIN/anew"
+
+ cat > "$MOCK_BIN/unfurl" <<'SH'
+#!/usr/bin/env bash
+if [[ "${1:-}" == "format" ]] && [[ "${2:-}" == "%r" ]]; then
+ while IFS= read -r line; do
+ printf '%s\n' "${line%%.*}"
+ done
+else
+ cat
+fi
+SH
+ chmod +x "$MOCK_BIN/unfurl"
+
+ cat > "$tools/cloud_enum/cloud_enum.py" <<'PY'
+print("mock")
+PY
+
+ cat > "$tools/cloud_enum/venv/bin/python3" <<'SH'
+#!/usr/bin/env bash
+printf '%s\n' "$*" > "$TEST_DIR/cloud_enum_scan_exhaustive_args.txt"
+printf '%s\n' 'OPEN S3 BUCKET: http://demo.s3.amazonaws.com'
+exit 0
+SH
+ chmod +x "$tools/cloud_enum/venv/bin/python3"
+
+ run cloud_enum_scan
+ [ "$status" -eq 0 ]
+ [ -s "osint/cloud_enum.txt" ]
+ grep -q 'OPEN S3 BUCKET' "osint/cloud_enum.txt"
+ grep -Fq -- "-m $tools/cloud_enum/enum_tools/fuzz.txt" "$TEST_DIR/cloud_enum_scan_exhaustive_args.txt"
+ ! grep -Eq -- '(^| )-qs( |$)' "$TEST_DIR/cloud_enum_scan_exhaustive_args.txt"
+ ! grep -Eq -- '(^| )-b( |$)' "$TEST_DIR/cloud_enum_scan_exhaustive_args.txt"
+}
+
+@test "cloud_enum_scan exhaustive skips cleanly when fuzz file is missing" {
+ mkdir -p osint
+ export OSINT=true
+ export CLOUD_ENUM=true
+ export ASSET_STORE=false
+ export CLOUD_ENUM_S3_PROFILE="exhaustive"
+ export tools="$TEST_DIR/tools"
+ mkdir -p "$tools/cloud_enum/venv/bin" "$tools/cloud_enum"
+
+ printf '%s\n' '1.1.1.1' > "$TEST_DIR/resolvers.txt"
+ export resolvers="$TEST_DIR/resolvers.txt"
+
+ cat > "$MOCK_BIN/unfurl" <<'SH'
+#!/usr/bin/env bash
+if [[ "${1:-}" == "format" ]] && [[ "${2:-}" == "%r" ]]; then
+ while IFS= read -r line; do
+ printf '%s\n' "${line%%.*}"
+ done
+else
+ cat
+fi
+SH
+ chmod +x "$MOCK_BIN/unfurl"
+
+ cat > "$tools/cloud_enum/cloud_enum.py" <<'PY'
+print("mock")
+PY
+
+ cat > "$tools/cloud_enum/venv/bin/python3" <<'SH'
+#!/usr/bin/env bash
+printf '%s\n' "$*" > "$TEST_DIR/cloud_enum_scan_missing_fuzz_args.txt"
+exit 0
+SH
+ chmod +x "$tools/cloud_enum/venv/bin/python3"
+
+ run cloud_enum_scan
+ [ "$status" -eq 0 ]
+ grep -q "mutations list not found" <<<"$output"
+ [ ! -f "$TEST_DIR/cloud_enum_scan_missing_fuzz_args.txt" ]
+ [ ! -s "osint/cloud_enum.txt" ]
+}
+
+@test "multi_osint executes cloud_enum_scan for each target" {
+ export multi="multi-osint-test"
+ export list="$TEST_DIR/targets.txt"
+ printf '%s\n' 'one.example.com' 'two.example.com' > "$list"
+ export SCRIPTPATH="$TEST_DIR"
+
+ domain_info() { :; }
+ ip_info() { :; }
+ emails() { :; }
+ google_dorks() { :; }
+ github_repos() { :; }
+ github_leaks() { :; }
+ metadata() { :; }
+ apileaks() { :; }
+ third_party_misconfigs() { :; }
+ zonetransfer() { :; }
+ cloud_enum_scan() { printf '%s\n' "$domain" >> "$TEST_DIR/cloud_enum_scan_calls.txt"; }
+ init_dns_resolver() { :; }
+ enable_command_trace() { :; }
+ end() { :; }
+
+ run multi_osint
+ [ "$status" -eq 0 ]
+ [ -s "$TEST_DIR/cloud_enum_scan_calls.txt" ]
+ [ "$(wc -l < "$TEST_DIR/cloud_enum_scan_calls.txt")" -eq 2 ]
+ grep -q '^one.example.com$' "$TEST_DIR/cloud_enum_scan_calls.txt"
+ grep -q '^two.example.com$' "$TEST_DIR/cloud_enum_scan_calls.txt"
+}
+
@test "nuclei_dast is forced on when VULNS_GENERAL=true" {
mkdir -p webs .tmp gf vulns nuclei_output
printf 'https://target.example.com\n' > webs/webs_all.txt
diff --git a/tests/unit/test_osint_domain_info_msftrecon.bats b/tests/unit/test_osint_domain_info_msftrecon.bats
new file mode 100644
index 0000000..960d291
--- /dev/null
+++ b/tests/unit/test_osint_domain_info_msftrecon.bats
@@ -0,0 +1,99 @@
+#!/usr/bin/env bats
+
+setup() {
+ local project_root
+ project_root="$(cd "$(dirname "$BATS_TEST_FILENAME")/../.." && pwd)"
+
+ TEST_DIR="$(mktemp -d)"
+ MOCK_BIN="${TEST_DIR}/mockbin"
+ ORIG_PATH="$PATH"
+ mkdir -p "$MOCK_BIN"
+
+ export PATH="${MOCK_BIN}:$ORIG_PATH"
+ export SCRIPTPATH="$project_root"
+ export bred='' bblue='' bgreen='' byellow='' yellow='' reset=''
+ export NOTIFICATION=false
+ export OUTPUT_VERBOSITY=1
+ export domain="example.com"
+ export AXIOM=false
+ export DIFF=false
+ export DOMAIN_INFO=true
+ export OSINT=true
+
+ export dir="${TEST_DIR}/target"
+ export called_fn_dir="${dir}/.called_fn"
+ export LOGFILE="${dir}/.tmp/test.log"
+ export tools="${TEST_DIR}/tools"
+
+ mkdir -p "${dir}/.tmp" "$called_fn_dir" "${tools}/msftrecon/venv/bin" \
+ "${tools}/msftrecon/msftrecon" "${tools}/Scopify/venv/bin" "${tools}/Scopify"
+ cd "$dir" || exit 1
+ : >"$LOGFILE"
+
+ # shellcheck source=/dev/null
+ source "$project_root/reconftw.cfg" 2>/dev/null || true
+ export SCRIPTPATH="$project_root"
+ export tools="${TEST_DIR}/tools"
+ # shellcheck source=/dev/null
+ source "$project_root/reconftw.sh" --source-only
+
+ create_mock_whois
+ create_mock_unfurl
+ create_mock_msftrecon_python
+ create_mock_scopify_python
+ touch "${tools}/msftrecon/msftrecon/msftrecon.py" "${tools}/Scopify/scopify.py"
+}
+
+teardown() {
+ PATH="$ORIG_PATH"
+ cd /
+ rm -rf "$TEST_DIR"
+}
+
+create_mock_whois() {
+ cat >"${MOCK_BIN}/whois" <<'EOF'
+#!/usr/bin/env bash
+echo "Domain Name: EXAMPLE.COM"
+exit 0
+EOF
+ chmod +x "${MOCK_BIN}/whois"
+}
+
+create_mock_unfurl() {
+ cat >"${MOCK_BIN}/unfurl" <<'EOF'
+#!/usr/bin/env bash
+echo "example"
+exit 0
+EOF
+ chmod +x "${MOCK_BIN}/unfurl"
+}
+
+create_mock_msftrecon_python() {
+ cat >"${tools}/msftrecon/venv/bin/python3" <<'EOF'
+#!/usr/bin/env bash
+echo "Traceback (most recent call last):" >&2
+echo "msftrecon failure" >&2
+exit 1
+EOF
+ chmod +x "${tools}/msftrecon/venv/bin/python3"
+}
+
+create_mock_scopify_python() {
+ cat >"${tools}/Scopify/venv/bin/python3" <<'EOF'
+#!/usr/bin/env bash
+echo "scopify-result"
+exit 0
+EOF
+ chmod +x "${tools}/Scopify/venv/bin/python3"
+}
+
+@test "domain_info handles msftrecon failure with fail-soft warning and empty artifact" {
+ run domain_info
+
+ [ "$status" -eq 0 ]
+ [ -f "osint/azure_tenant_domains.txt" ]
+ [ ! -s "osint/azure_tenant_domains.txt" ]
+ [[ "$output" == *"msftrecon failed, continuing"* ]]
+ [[ "$output" != *"Traceback (most recent call last):"* ]]
+ grep -q "domain_info: msftrecon failed" "$LOGFILE"
+}
diff --git a/tests/unit/test_sub_tls_no_match.bats b/tests/unit/test_sub_tls_no_match.bats
index a6866a4..cbcc4de 100644
--- a/tests/unit/test_sub_tls_no_match.bats
+++ b/tests/unit/test_sub_tls_no_match.bats
@@ -42,6 +42,8 @@ SH
source "$project_root/reconftw.sh" --source-only
export DOMAIN_ESCAPED
DOMAIN_ESCAPED=$(escape_domain_regex "$domain")
+ export DOMAIN_MATCH_REGEX
+ DOMAIN_MATCH_REGEX=$(domain_match_regex "$domain")
}
teardown() {
@@ -61,4 +63,3 @@ teardown() {
! grep -q '^ERR\\(' "$LOGFILE"
[ -f ".tmp/subdomains_tlsx_clean.txt" ]
}
-
diff --git a/tests/unit/test_subdomains_asn.bats b/tests/unit/test_subdomains_asn.bats
index e76a7cd..8850fd1 100644
--- a/tests/unit/test_subdomains_asn.bats
+++ b/tests/unit/test_subdomains_asn.bats
@@ -21,6 +21,7 @@ setup() {
export ASN_ENUM=true
export domain="example.com"
export DOMAIN_ESCAPED="example\\.com"
+ export DOMAIN_MATCH_REGEX='(^|\\.)example\.com$'
export PDCP_API_KEY=""
export bred='' bblue='' bgreen='' byellow='' yellow='' reset=''
diff --git a/tests/unit/test_subdomains_filtering.bats b/tests/unit/test_subdomains_filtering.bats
new file mode 100644
index 0000000..b37a85c
--- /dev/null
+++ b/tests/unit/test_subdomains_filtering.bats
@@ -0,0 +1,155 @@
+#!/usr/bin/env bats
+
+setup() {
+ local project_root
+ project_root="$(cd "$(dirname "$BATS_TEST_FILENAME")/../.." && pwd)"
+
+ TEST_DIR="$(mktemp -d)"
+ MOCK_BIN="${TEST_DIR}/mockbin"
+ ORIG_PATH="$PATH"
+ mkdir -p "$MOCK_BIN"
+
+ export PATH="${MOCK_BIN}:$ORIG_PATH"
+ export SCRIPTPATH="$project_root"
+ export bred='' bblue='' bgreen='' byellow='' yellow='' reset=''
+ export NOTIFICATION=false
+ export OUTPUT_VERBOSITY=1
+
+ # shellcheck source=/dev/null
+ source "$project_root/reconftw.cfg" 2>/dev/null || true
+ # shellcheck source=/dev/null
+ source "$project_root/reconftw.sh" --source-only
+
+ export domain="example.com"
+ export dir="${TEST_DIR}/target"
+ export called_fn_dir="${dir}/.called_fn"
+ export LOGFILE="${dir}/.tmp/test.log"
+ export outOfScope_file="${dir}/outscope.txt"
+ export AXIOM=false
+ export DIFF=false
+ export DEEP=false
+ export INSCOPE=false
+ export RESOLVER_IQ=false
+ export SUBBRUTE=true
+ export SUBIAPERMUTE=true
+ export subs_wordlist="${dir}/wordlist.txt"
+ export subs_wordlist_big="${dir}/wordlist_big.txt"
+ export SUBWIZ_CALLED_FILE="${dir}/.tmp/subwiz.called"
+
+ mkdir -p "${dir}/.tmp" "${dir}/subdomains" "${dir}/webs" "$called_fn_dir"
+ cd "$dir" || exit 1
+ : >"$LOGFILE"
+ : >"$outOfScope_file"
+ printf "www\napi\n" >"$subs_wordlist"
+ cp "$subs_wordlist" "$subs_wordlist_big"
+
+ DOMAIN_ESCAPED=$(escape_domain_regex "$domain")
+ DOMAIN_MATCH_REGEX=$(domain_match_regex "$domain")
+ export DOMAIN_ESCAPED DOMAIN_MATCH_REGEX
+
+ create_mock_anew
+ create_mock_dnsx
+ create_mock_subwiz
+
+ _resolve_domains() {
+ cat "$1" >"$2"
+ }
+
+ _bruteforce_domains() {
+ local _wordlist="$1"
+ local _domain="$2"
+ local _output="$3"
+ : >"$_output"
+ printf "dev.%s\n%s\nexample.org\n" "$_domain" "$_domain" >"$_output"
+ return 0
+ }
+}
+
+teardown() {
+ PATH="$ORIG_PATH"
+ cd /
+ rm -rf "$TEST_DIR"
+}
+
+create_mock_anew() {
+ cat >"${MOCK_BIN}/anew" <<'EOF'
+#!/usr/bin/env bash
+set -euo pipefail
+quiet=false
+if [[ "${1:-}" == "-q" ]]; then
+ quiet=true
+ shift
+fi
+target="${1:-}"
+touch "$target"
+while IFS= read -r line; do
+ [[ -z "$line" ]] && continue
+ if ! grep -Fxq "$line" "$target"; then
+ echo "$line" >>"$target"
+ if [[ "$quiet" != true ]]; then
+ echo "$line"
+ fi
+ fi
+done
+exit 0
+EOF
+ chmod +x "${MOCK_BIN}/anew"
+}
+
+create_mock_dnsx() {
+ cat >"${MOCK_BIN}/dnsx" <<'EOF'
+#!/usr/bin/env bash
+exit 0
+EOF
+ chmod +x "${MOCK_BIN}/dnsx"
+}
+
+create_mock_subwiz() {
+ cat >"${MOCK_BIN}/subwiz" <<'EOF'
+#!/usr/bin/env bash
+touch "${SUBWIZ_CALLED_FILE:-/tmp/subwiz.called}"
+exit 0
+EOF
+ chmod +x "${MOCK_BIN}/subwiz"
+}
+
+@test "sub_active filters exact domain and subdomains with robust matcher" {
+ cat > .tmp/source_subs.txt <<'EOF'
+api.example.com
+example.com
+badexample.com
+foo.example.net
+EOF
+
+ run sub_active
+
+ [ "$status" -eq 0 ]
+ [ -f "subdomains/subdomains.txt" ]
+ grep -qx "api.example.com" "subdomains/subdomains.txt"
+ grep -qx "example.com" "subdomains/subdomains.txt"
+ ! grep -qx "badexample.com" "subdomains/subdomains.txt"
+ ! grep -qx "foo.example.net" "subdomains/subdomains.txt"
+ [ "$(wc -l < "subdomains/subdomains.txt" | tr -d ' ')" -eq 2 ]
+}
+
+@test "sub_brute appends only in-scope brute-force matches" {
+ run sub_brute
+
+ [ "$status" -eq 0 ]
+ [ -f "subdomains/subdomains.txt" ]
+ grep -qx "dev.example.com" "subdomains/subdomains.txt"
+ grep -qx "example.com" "subdomains/subdomains.txt"
+ ! grep -qx "example.org" "subdomains/subdomains.txt"
+ [ "$(wc -l < "subdomains/subdomains.txt" | tr -d ' ')" -eq 2 ]
+}
+
+@test "sub_ia_permut skips cleanly when seed subdomains are empty" {
+ : > "subdomains/subdomains.txt"
+ rm -f "$SUBWIZ_CALLED_FILE"
+
+ run sub_ia_permut
+
+ [ "$status" -eq 0 ]
+ [ ! -f "$SUBWIZ_CALLED_FILE" ]
+ grep -q "no_seed_subdomains" "$LOGFILE"
+}
diff --git a/tests/unit/test_ui_snapshots.bats b/tests/unit/test_ui_snapshots.bats
new file mode 100644
index 0000000..c0c27bd
--- /dev/null
+++ b/tests/unit/test_ui_snapshots.bats
@@ -0,0 +1,106 @@
+#!/usr/bin/env bats
+# Snapshot-like tests for stable UI contracts across modes/verbosity.
+
+setup() {
+ PROJECT_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/../.." && pwd)"
+
+ # Reset source guards for isolated test runs.
+ _COMMON_SH_LOADED=""
+ _UI_SH_LOADED=""
+
+ # shellcheck source=/dev/null
+ source "$PROJECT_ROOT/lib/common.sh"
+ # shellcheck source=/dev/null
+ source "$PROJECT_ROOT/lib/ui.sh"
+
+ # Deterministic, no-color output for fixtures.
+ bred=""; bblue=""; bgreen=""; byellow=""; yellow=""; reset=""; red=""; blue=""; green=""; cyan=""
+
+ export COLUMNS=80
+ export TERM=dumb
+}
+
+normalize_output() {
+ sed -E 's/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/<TS>/g'
+}
+
+generate_snapshot() {
+ local mode_char="$1"
+ local verbosity="$2"
+
+ domain="example.com"
+ CUSTOM_CONFIG="default"
+ PARALLEL_MODE=true
+ PARALLEL_MAX_JOBS=4
+ dir="/tmp/recon"
+ reconftw_version="test-v0"
+ RECON_BEHIND_NAT="no"
+ DNS_RESOLVER_SELECTED="dnsx"
+ PERF_PROFILE_INFO="PERF_PROFILE=balanced | cores=8 mem=16GB"
+ DISK_SPACE_INFO="Disk space OK: 10GB available at ."
+ DEBUG_LOG="/tmp/recon/debug.log"
+ LOG_FORMAT="plain"
+ OUTPUT_VERBOSITY="$verbosity"
+ opt_mode="$mode_char"
+
+ _UI_OK_COUNT=0
+ _UI_WARN_COUNT=0
+ _UI_FAIL_COUNT=0
+ _UI_SKIP_COUNT=0
+ _UI_CACHE_COUNT=0
+
+ ui_init
+
+ local mode_label="FULL"
+ [[ "$mode_char" == "s" ]] && mode_label="SUBDOMAINS"
+
+ ui_header
+ _print_section "Subdomains"
+ _print_status OK "subdomains_full" "0s"
+ _print_msg INFO "verbose_marker"
+ ui_module_end "Subdomains" "subdomains/" "webs/"
+ ui_summary "example.com" "1m 00s" "/tmp/recon" "$mode_label" "1" "0" 0 0 0 0 0
+}
+
+assert_fixture() {
+ local mode_char="$1"
+ local verbosity="$2"
+ local fixture_name="$3"
+ local fixture_path="$PROJECT_ROOT/tests/fixtures/ui/$fixture_name"
+
+ run generate_snapshot "$mode_char" "$verbosity"
+ [ "$status" -eq 0 ]
+
+ local normalized expected
+ normalized="$(printf '%s\n' "$output" | normalize_output)"
+ expected="$(cat "$fixture_path")"
+
+ if [[ "$normalized" != "$expected" ]]; then
+ diff -u <(printf '%s' "$expected") <(printf '%s' "$normalized")
+ return 1
+ fi
+}
+
+@test "UI snapshot FULL verbosity 0" {
+ assert_fixture "r" "0" "full_v0.txt"
+}
+
+@test "UI snapshot FULL verbosity 1" {
+ assert_fixture "r" "1" "full_v1.txt"
+}
+
+@test "UI snapshot FULL verbosity 2" {
+ assert_fixture "r" "2" "full_v2.txt"
+}
+
+@test "UI snapshot SUBDOMAINS verbosity 0" {
+ assert_fixture "s" "0" "subdomains_v0.txt"
+}
+
+@test "UI snapshot SUBDOMAINS verbosity 1" {
+ assert_fixture "s" "1" "subdomains_v1.txt"
+}
+
+@test "UI snapshot SUBDOMAINS verbosity 2" {
+ assert_fixture "s" "2" "subdomains_v2.txt"
+}
diff --git a/tests/unit/test_utils.bats b/tests/unit/test_utils.bats
index d0d3d44..72f8ce6 100644
--- a/tests/unit/test_utils.bats
+++ b/tests/unit/test_utils.bats
@@ -237,3 +237,114 @@ setup() {
# Function should return warning count (may be 0 if file not in list)
[ "$status" -eq 0 ] || [ "$status" -eq 1 ]
}
+
+@test "run_command disables Axiom runtime on transport failures" {
+ local tmpdir
+ tmpdir=$(mktemp -d)
+ mkdir -p "$tmpdir/mockbin"
+
+ cat >"$tmpdir/mockbin/axiom-scan" <<'EOF'
+#!/usr/bin/env bash
+echo "Could not resolve hostname axiom-node" >&2
+exit 255
+EOF
+ chmod +x "$tmpdir/mockbin/axiom-scan"
+
+ export PATH="$tmpdir/mockbin:$PATH"
+ export AXIOM=true
+ export AXIOM_RUNTIME_DISABLED=false
+ export AXIOM_RUNTIME_DISABLE_REASON=""
+ export AXIOM_RUNTIME_DISABLE_CMD=""
+ export AXIOM_RUNTIME_DISABLE_NOTIFIED=false
+ export DEBUG_LOG="$tmpdir/debug.log"
+ touch "$DEBUG_LOG"
+
+ local rc=0
+ run_command axiom-scan test-target -m httpx >/dev/null 2>&1 || rc=$?
+ [ "$rc" -ne 0 ]
+ [ "$AXIOM_RUNTIME_DISABLED" = "true" ]
+ [ "$AXIOM" = "false" ]
+ [ "$AXIOM_RUNTIME_DISABLE_REASON" = "transport/connectivity failure" ]
+ [[ "$AXIOM_RUNTIME_DISABLE_CMD" == *"axiom-scan test-target -m httpx"* ]]
+
+ rm -rf "$tmpdir"
+}
+
+@test "axiom_disable_runtime is idempotent after first failover" {
+ export AXIOM=true
+ export AXIOM_RUNTIME_DISABLED=false
+ export AXIOM_RUNTIME_DISABLE_REASON=""
+ export AXIOM_RUNTIME_DISABLE_CMD=""
+ export AXIOM_RUNTIME_DISABLE_NOTIFIED=false
+
+ axiom_disable_runtime "first failure" "axiom-scan first"
+ axiom_disable_runtime "second failure" "axiom-scan second"
+
+ [ "$AXIOM_RUNTIME_DISABLED" = "true" ]
+ [ "$AXIOM_RUNTIME_DISABLE_REASON" = "first failure" ]
+ [ "$AXIOM_RUNTIME_DISABLE_CMD" = "axiom-scan first" ]
+}
+
+@test "run_module_with_axiom_failover retries module locally once" {
+ local tmpdir
+ tmpdir=$(mktemp -d)
+ mkdir -p "$tmpdir/mockbin"
+
+ cat >"$tmpdir/mockbin/axiom-scan" <<'EOF'
+#!/usr/bin/env bash
+echo "Unable to reach any instance selected" >&2
+exit 1
+EOF
+ chmod +x "$tmpdir/mockbin/axiom-scan"
+
+ export PATH="$tmpdir/mockbin:$PATH"
+ export AXIOM=true
+ export AXIOM_RUNTIME_DISABLED=false
+ export AXIOM_RUNTIME_DISABLE_REASON=""
+ export AXIOM_RUNTIME_DISABLE_CMD=""
+ export AXIOM_RUNTIME_DISABLE_NOTIFIED=false
+ export AXIOM_FAILOVER_RETRY_ACTIVE=false
+ export DEBUG_LOG="$tmpdir/debug.log"
+ touch "$DEBUG_LOG"
+ unset DIFF 2>/dev/null || true
+
+ fake_calls=0
+ local_calls=0
+ fake_module() {
+ fake_calls=$((fake_calls + 1))
+ if [[ "$fake_calls" -eq 1 ]]; then
+ local rc=0
+ run_command axiom-scan payload -m httpx >/dev/null 2>&1 || rc=$?
+ return "$rc"
+ fi
+ local_calls=$((local_calls + 1))
+ return 0
+ }
+
+ run_module_with_axiom_failover fake_module
+ [ "$?" -eq 0 ]
+ [ "$fake_calls" -eq 2 ]
+ [ "$local_calls" -eq 1 ]
+ [ "$AXIOM_RUNTIME_DISABLED" = "true" ]
+ [ "$AXIOM" = "false" ]
+ [[ "${DIFF+x}" != "x" ]]
+
+ unset -f fake_module
+ rm -rf "$tmpdir"
+}
+
+@test "mark_missing_tools_warn_once marks dnstake key to avoid duplicate warnings" {
+ unset WARN_ONCE_KEYS 2>/dev/null || true
+
+ mark_missing_tools_warn_once "dnstake" "nuclei"
+
+ [ "${WARN_ONCE_KEYS[missing-tool-dnstake]}" = "1" ]
+}
+
+@test "mark_missing_tools_warn_once does nothing when dnstake is not missing" {
+ unset WARN_ONCE_KEYS 2>/dev/null || true
+
+ mark_missing_tools_warn_once "nuclei" "httpx"
+
+ [ -z "${WARN_ONCE_KEYS[missing-tool-dnstake]:-}" ]
+}