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

More fixes and stuff

six2dez5aa224042ef3
diff --git a/README.md b/README.md
index 579956b..6b74321 100644
--- a/README.md
+++ b/README.md
@@ -598,11 +598,11 @@ TLS_PORTS="21,22,25,80,110,135,143,261,271,324,443,448,465,563,614,631,636,664,6
INSCOPE=false # Uses inscope tool to filter the scope, requires .scope file in reconftw folder
# Web detection
-WEBPROBESIMPLE=true # Web probing on 80/443
-WEBPROBEFULL=true # Web probing in a large port list
+WEBPROBEFULL=true # Unified web probing over configured ports
WEBSCREENSHOT=true # Webs screenshooting
VIRTUALHOSTS=false # Check virtualhosts by fuzzing HOST header
UNCOMMON_PORTS_WEB="81,300,591,593,832,981,1010,1311,1099,2082,2095,2096,2480,3000,3001,3002,3003,3128,3333,4243,4567,4711,4712,4993,5000,5104,5108,5280,5281,5601,5800,6543,7000,7001,7396,7474,8000,8001,8008,8014,8042,8060,8069,8080,8081,8083,8088,8090,8091,8095,8118,8123,8172,8181,8222,8243,8280,8281,8333,8337,8443,8500,8834,8880,8888,8983,9000,9001,9043,9060,9080,9090,9091,9092,9200,9443,9502,9800,9981,10000,10250,11371,12443,15672,16080,17778,18091,18092,20720,32000,55440,55672"
+WEBPROBE_PORTS="80,443,${UNCOMMON_PORTS_WEB}" # Ports used by webprobe_full
# Host
FAVIRECON=true # Favicon-based technology recon for discovered web targets
@@ -645,7 +645,7 @@ FUZZ_RECURSION_DEPTH=2 # ffuf recursion depth used in DEEP mode
IIS_SHORTNAME=true
CMS_SCANNER=true # CMS scanner
WORDLIST=true # Wordlist generation
-ROBOTSWORDLIST=true # Check historic disallow entries on waybackMachine
+ROBOTSWORDLIST=true # Check historic disallow entries on waybackMachine (DEEP mode only)
PASSWORD_DICT=true # Generate password dictionary
PASSWORD_DICT_ENGINE=cewler # cewler|pydictor
PASSWORD_MIN_LENGTH=5 # Min password length
@@ -694,7 +694,6 @@ PROXY=false # Send to proxy the websites found
SENDZIPNOTIFY=false # Send to zip the results (over notify)
PRESERVE=true # set to true to avoid deleting the .called_fn files on really large scans
FFUF_FLAGS=" -mc all -fc 404 -sf -noninteractive -of json" # Ffuf flags
-HTTPX_FLAGS=" -follow-redirects -random-agent -status-code -silent -title -web-server -tech-detect -location -content-length" # Httpx flags for simple web probing
# HTTP options
HEADER="User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0" # Default header
@@ -881,6 +880,7 @@ reconFTW supports multiple modes and options for flexible reconnaissance. Use th
| `-f` | Custom configuration file path |
| `-o` | Output directory for results |
| `-v` | Enable Axiom distributed scanning |
+| `--vps-count` | Override Axiom fleet instance count for this run |
| `-q` | Set rate limit (requests per second) |
| `-y` | Enables AI results analysis |
| `--check-tools` | Exit if required tools are missing |
@@ -941,33 +941,39 @@ reconFTW supports multiple modes and options for flexible reconnaissance. Use th
./reconftw.sh -d target.com -r -v
```
-8. **Full Recon with Attacks (YOLO Mode)**:
+8. **Axiom Integration with fleet override**:
+
+ ```bash
+ ./reconftw.sh -d target.com -r -v 30
+ ```
+
+9. **Full Recon with Attacks (YOLO Mode)**:
```bash
./reconftw.sh -d target.com -a
```
-9. **Show Help**:
+10. **Show Help**:
```bash
./reconftw.sh -h
```
-10. **Force cache refresh**:
+11. **Force cache refresh**:
```bash
./reconftw.sh -d target.com -r --refresh-cache
```
-11. **Export all report artifacts**:
+12. **Export all report artifacts**:
```bash
./reconftw.sh -d target.com -r --export all
```
-12. **Continuous monitoring (every 30m, 48 cycles)**:
+13. **Continuous monitoring (every 30m, 48 cycles)**:
```bash
./reconftw.sh -d target.com -r --monitor --monitor-interval 30 --monitor-cycles 48
```
-13. **Rebuild reports only (no scan):**
+14. **Rebuild reports only (no scan):**
```bash
./reconftw.sh -d target.com --report-only --export all
```
diff --git a/Terraform/files/reconftw.cfg b/Terraform/files/reconftw.cfg
index 4f46ad4..5222367 100644
--- a/Terraform/files/reconftw.cfg
+++ b/Terraform/files/reconftw.cfg
@@ -90,11 +90,11 @@ TLS_PORTS="21,22,25,80,110,135,143,261,271,324,443,448,465,563,614,631,636,664,6
INSCOPE=false # Uses inscope tool to filter the scope, requires .scope file in reconftw folder
# Web detection
-WEBPROBESIMPLE=true # Web probing on 80/443
-WEBPROBEFULL=true # Web probing in a large port list
+WEBPROBEFULL=true # Unified web probing over configured ports
WEBSCREENSHOT=true # Webs screenshooting
VIRTUALHOSTS=false # Check virtualhosts by fuzzing HOST header
UNCOMMON_PORTS_WEB="81,300,591,593,832,981,1010,1311,1099,2082,2095,2096,2480,3000,3001,3002,3003,3128,3333,4243,4567,4711,4712,4993,5000,5104,5108,5280,5281,5601,5800,6543,7000,7001,7396,7474,8000,8001,8008,8014,8042,8060,8069,8080,8081,8083,8088,8090,8091,8095,8118,8123,8172,8181,8222,8243,8280,8281,8333,8337,8443,8500,8834,8880,8888,8983,9000,9001,9043,9060,9080,9090,9091,9092,9200,9443,9502,9800,9981,10000,10250,11371,12443,15672,16080,17778,18091,18092,20720,32000,55440,55672"
+WEBPROBE_PORTS="80,443,${UNCOMMON_PORTS_WEB}" # Ports used by webprobe_full
# Host
PORTSCANNER=true # Enable or disable the whole Port scanner module
@@ -159,7 +159,6 @@ PROXY=false # Send to proxy the websites found
SENDZIPNOTIFY=false # Send to zip the results (over notify)
PRESERVE=true # set to true to avoid deleting the .called_fn files on really large scans
FFUF_FLAGS=" -mc all -fc 404 -ach -sf -of json" # Ffuf flags
-HTTPX_FLAGS=" -follow-redirects -random-agent -status-code -silent -title -web-server -tech-detect -location -content-length" # Httpx flags for simple web probing
GOWITNESS_FLAGS=" --disable-logging --timeout 5"
# HTTP options
diff --git a/config/reconftw_full.cfg b/config/reconftw_full.cfg
index 9f72673..3ed8f7f 100644
--- a/config/reconftw_full.cfg
+++ b/config/reconftw_full.cfg
@@ -42,7 +42,6 @@ CLOUD_ENUM_S3_THREADS=20
DEEP_WILDCARD_FILTER=true
# Web: full probing
-WEBPROBESIMPLE=true
WEBPROBEFULL=true
WEBSCREENSHOT=true
VIRTUALHOSTS=true
diff --git a/config/reconftw_quick.cfg b/config/reconftw_quick.cfg
index 3a0f3ed..f8b13a5 100644
--- a/config/reconftw_quick.cfg
+++ b/config/reconftw_quick.cfg
@@ -17,8 +17,8 @@ SUBNOERROR=false
ZONETRANSFER=false
DEEP_WILDCARD_FILTER=false
-# Web: passive only
-WEBPROBEFULL=false
+# Web: probing enabled (full port set)
+WEBPROBEFULL=true
WEBSCREENSHOT=false
VIRTUALHOSTS=false
FAVIRECON=false
diff --git a/config/reconftw_stealth.cfg b/config/reconftw_stealth.cfg
index 495c101..46f519f 100644
--- a/config/reconftw_stealth.cfg
+++ b/config/reconftw_stealth.cfg
@@ -42,8 +42,7 @@ DEEP_WILDCARD_FILTER=false
REVERSE_IP=false
# Web: minimal probing, low threads
-WEBPROBESIMPLE=true
-WEBPROBEFULL=false
+WEBPROBEFULL=true
WEBSCREENSHOT=false
VIRTUALHOSTS=false
diff --git a/lib/common.sh b/lib/common.sh
index 1de3f83..d66441e 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -337,7 +337,7 @@ print_errorf() {
_print_error "$msg"
}
-# Generic message with [LEVEL] prefix (INFO/WARN/FAIL/OK)
+# Generic message with LEVEL prefix (INFO/WARN/FAIL/OK)
# Usage: _print_msg WARN "something happened"
_print_msg() {
local level="$1"
@@ -378,7 +378,7 @@ _print_msg() {
fi
[[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
_ui_live_break_if_needed
- printf "%b[%s]%b %s\n" "$color" "$level" "${reset:-}" "$msg"
+ printf "%b%-5s%b %s\n" "$color" "$level" "${reset:-}" "$msg"
}
# Print a warning message only once per run key.
@@ -405,7 +405,8 @@ warn_once() {
# Module start message with timestamp
# Usage: _print_module_start "OSINT"
_print_module_start() {
- local title="${1^^}"
+ local title
+ title=$(printf "%s" "${1:-}" | tr '[:lower:]' '[:upper:]')
local ts
ts=$(date +'%Y-%m-%d %H:%M:%S')
# Reset dry-run tracking for new module.
@@ -431,7 +432,8 @@ _print_module_start() {
# Module end message with timestamp
# Usage: _print_module_end "OSINT"
_print_module_end() {
- local title="${1^^}"
+ local title
+ title=$(printf "%s" "${1:-}" | tr '[:lower:]' '[:upper:]')
local ts
ts=$(date +'%Y-%m-%d %H:%M:%S')
if declare -F ui_log_jsonl >/dev/null 2>&1; then
@@ -547,21 +549,33 @@ _print_rule() {
# Show skip notification for disabled/already-processed functions
# Usage: skip_notification reason
-# reason: "disabled" | "processed" | custom message
+# reason: "disabled" | "mode" | "processed" | "processed-visible" | "noinput" | custom message
skip_notification() {
local func_name="${FUNCNAME[1]:-unknown}"
local reason="${1:-mode or configuration settings}"
local badge="SKIP"
local reason_code="config"
+ local mark_cache=false
case "$reason" in
disabled)
reason="mode or configuration settings"
;;
+ mode)
+ reason="mode constraints"
+ reason_code="mode"
+ ;;
processed)
reason="already processed"
badge="CACHE"
reason_code="cache"
+ mark_cache=true
+ ;;
+ processed-visible)
+ reason="already processed"
+ badge="SKIP"
+ reason_code="cache"
+ mark_cache=true
;;
noinput)
reason="missing required input data"
@@ -590,7 +604,7 @@ skip_notification() {
# Emit skip marker for parent process (parallel mode)
if [[ -n "${called_fn_dir:-}" ]]; then
printf "%s\n" "$reason_code" >"${called_fn_dir}/.status_reason_${func_name}" 2>/dev/null || true
- if [[ "$badge" == "CACHE" ]]; then
+ if [[ "$badge" == "CACHE" ]] || [[ "$mark_cache" == "true" ]]; then
: >"${called_fn_dir}/.cache_${func_name}" 2>/dev/null || true
else
: >"${called_fn_dir}/.skip_${func_name}" 2>/dev/null || true
diff --git a/modules/core.sh b/modules/core.sh
index 0944b5c..ebf16c1 100644
--- a/modules/core.sh
+++ b/modules/core.sh
@@ -203,6 +203,42 @@ function check_version() {
fi
}
+resolve_cloud_enum_runtime() {
+ local -n runtime_cmd_ref="$1"
+ local cloud_enum_python cloud_enum_script cloud_enum_bin
+
+ runtime_cmd_ref=()
+ cloud_enum_python="${tools}/cloud_enum/venv/bin/python3"
+ cloud_enum_script="${tools}/cloud_enum/cloud_enum.py"
+
+ if [[ -x "$cloud_enum_python" ]] && [[ -f "$cloud_enum_script" ]]; then
+ runtime_cmd_ref=("$cloud_enum_python" "$cloud_enum_script")
+ return 0
+ fi
+
+ cloud_enum_bin="$(command -v cloud_enum 2>/dev/null || true)"
+ if [[ -n "$cloud_enum_bin" ]]; then
+ runtime_cmd_ref=("$cloud_enum_bin")
+ return 0
+ fi
+
+ return 1
+}
+
+format_pending_tools_message() {
+ local -a missing=("$@")
+ local joined=""
+
+ if (( ${#missing[@]} == 1 )); then
+ printf "Pending tool: %s" "${missing[0]}"
+ return 0
+ fi
+
+ printf -v joined "%s, " "${missing[@]}"
+ joined="${joined%, }"
+ printf "Pending tools: %s" "$joined"
+}
+
function tools_installed() {
local all_installed=true
local missing_tools=()
@@ -238,8 +274,6 @@ function tools_installed() {
["getjswords"]="${tools}/getjswords.py"
["JSA"]="${tools}/JSA/jsa.py"
["JSA_python"]="${tools}/JSA/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"
@@ -378,14 +412,16 @@ function tools_installed() {
fi
done
+ local -a cloud_enum_runtime_cmd=()
+ if ! resolve_cloud_enum_runtime cloud_enum_runtime_cmd; then
+ all_installed=false
+ missing_tools+=("cloud_enum")
+ fi
+
if [[ $all_installed == true ]]; then
: # Tools check OK, no output
else
- if (( ${#missing_tools[@]} == 1 )); then
- _print_msg WARN "Pending tool: ${missing_tools[0]}"
- else
- _print_msg WARN "Pending tools: ${missing_tools[*]}"
- fi
+ _print_msg WARN "$(format_pending_tools_message "${missing_tools[@]}")"
mark_missing_tools_warn_once "${missing_tools[@]}"
fi
diff --git a/modules/modes.sh b/modules/modes.sh
index 942d57d..d32f5ce 100644
--- a/modules/modes.sh
+++ b/modules/modes.sh
@@ -438,8 +438,6 @@ function passive() {
SUBREGEXPERMUTE=false
# shellcheck disable=SC2034
SUB_RECURSIVE_BRUTE=false
- # shellcheck disable=SC2034
- WEBPROBESIMPLE=false
if [[ $AXIOM == true ]]; then
axiom_launch
axiom_selected
@@ -744,7 +742,6 @@ function recon() {
progress_module "Subdomains"
_print_section "Web Detection"
- 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 && ! axiom_runtime_enabled; then
@@ -941,7 +938,6 @@ function multi_recon() {
exit 1
}
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
@@ -1136,7 +1132,6 @@ function subs_menu() {
run_module_with_axiom_failover s3buckets
_print_section "Web Detection"
- run_module_with_axiom_failover webprobe_simple
run_module_with_axiom_failover webprobe_full
favirecon_tech
run_module_with_axiom_failover screenshot
@@ -1152,7 +1147,6 @@ function subs_menu() {
function webs_menu() {
_print_section "Web Detection"
- run_module_with_axiom_failover webprobe_simple
run_module_with_axiom_failover webprobe_full
favirecon_tech
run_module_with_axiom_failover subtakeover
@@ -1198,7 +1192,6 @@ function zen_menu() {
run_module_with_axiom_failover s3buckets
_print_section "Web Detection"
- run_module_with_axiom_failover webprobe_simple
run_module_with_axiom_failover webprobe_full
favirecon_tech
run_module_with_axiom_failover screenshot
@@ -1364,7 +1357,7 @@ function report_only_mode() {
function help() {
pt_header "Usage"
printf "\n Usage: %s [-d domain.tld] [-m name] [-l list.txt] [-x oos.txt] [-i in.txt] " "$0"
- printf "\n [-r] [-s] [-p] [-a] [-w] [-n] [-z] [-c] [-y] [-h] [-f] [--ai] [--deep] [--monitor] [--monitor-interval m] [--monitor-cycles n] [--report-only] [--refresh-cache] [--gen-resolvers] [--force] [--export fmt] [-o OUTPUT]\n\n"
+ printf "\n [-r] [-s] [-p] [-a] [-w] [-n] [-z] [-c] [-y] [-h] [-f] [--ai] [--deep] [--monitor] [--monitor-interval m] [--monitor-cycles n] [--vps-count n] [--report-only] [--refresh-cache] [--gen-resolvers] [--force] [--export fmt] [-o OUTPUT]\n\n"
printf " %bTARGET OPTIONS%b\n" "${bblue}" "${reset}"
printf " -d domain.tld Target domain\n"
printf " -m company Target company name\n"
@@ -1389,6 +1382,7 @@ function help() {
printf " -f config_file Alternate reconftw.cfg file\n"
printf " -o output/path Define output folder\n"
printf " -v, --vps Axiom distributed VPS\n"
+ printf " --vps-count n Override Axiom fleet instances for this run (implies AXIOM)\n"
printf " -q Rate limit in requests per second\n"
printf " --check-tools Exit if one of the tools is missing\n"
printf " --health-check Run system health check and exit\n"
@@ -1434,6 +1428,9 @@ function help() {
printf " %bAnalyze ReconFTW results with AI:%b\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -d example.com -r --ai\n"
printf " \n"
+ printf " %bRun recon on Axiom with 30 instances:%b\n" "${byellow}" "${reset}"
+ printf " ./reconftw.sh -d example.com -r -v 30\n"
+ printf " \n"
printf " %bRun custom function:%b\n" "${byellow}" "${reset}"
printf " ./reconftw.sh -d example.com -c nuclei_check \n"
}
diff --git a/modules/osint.sh b/modules/osint.sh
index 4eb55eb..3f1cce6 100644
--- a/modules/osint.sh
+++ b/modules/osint.sh
@@ -676,7 +676,8 @@ function cloud_enum_scan() {
&& ! [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
local cloud_enum_profile cloud_enum_mutations cloud_enum_quickscan cloud_enum_threads
- local cloud_enum_python cloud_enum_script company_name
+ local company_name
+ local -a cloud_enum_runtime_cmd cloud_enum_cmd
cloud_enum_profile=$(printf "%s" "${CLOUD_ENUM_S3_PROFILE:-optimized}" | tr '[:upper:]' '[:lower:]')
case "$cloud_enum_profile" in
optimized)
@@ -697,10 +698,8 @@ function cloud_enum_scan() {
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"
+ if ! resolve_cloud_enum_runtime cloud_enum_runtime_cmd; then
+ _print_msg WARN "${FUNCNAME[0]}: cloud_enum runtime not found (checked ${tools}/cloud_enum and PATH)"
return 0
fi
if [[ "$cloud_enum_quickscan" != true ]] && [[ ! -f "$cloud_enum_mutations" ]]; then
@@ -710,10 +709,9 @@ function cloud_enum_scan() {
start_func "${FUNCNAME[0]}" "Cloud storage enumeration"
company_name=$(unfurl format %r <<<"$domain")
- local -a cloud_enum_cmd=(
+ cloud_enum_cmd=(
env PYTHONWARNINGS=ignore
- "$cloud_enum_python"
- "$cloud_enum_script"
+ "${cloud_enum_runtime_cmd[@]}"
-k "$company_name"
-k "$domain"
-k "${domain%%.*}"
diff --git a/modules/subdomains.sh b/modules/subdomains.sh
index d367997..594a6c0 100644
--- a/modules/subdomains.sh
+++ b/modules/subdomains.sh
@@ -2004,7 +2004,8 @@ function s3buckets() {
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
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
+ local cloud_enum_status cloud_enum_rc company_name
+ local -a cloud_enum_runtime_cmd cloud_enum_cmd
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
@@ -2029,16 +2030,14 @@ function s3buckets() {
;;
esac
- 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."
+ if ! resolve_cloud_enum_runtime cloud_enum_runtime_cmd; then
+ _print_msg WARN "cloud_enum runtime missing (checked ${tools}/cloud_enum and PATH); skipping cloud enumeration."
cloud_enum_status="WARN"
cloud_enum_rc=1
elif [[ "$cloud_enum_quickscan" != true ]] && [[ ! -f "$cloud_enum_mutations" ]]; then
@@ -2047,10 +2046,9 @@ function s3buckets() {
cloud_enum_rc=1
else
company_name=$(unfurl format %r <<<"$domain")
- local -a cloud_enum_cmd=(
+ cloud_enum_cmd=(
env PYTHONWARNINGS=ignore
- "$cloud_enum_python"
- "$cloud_enum_script"
+ "${cloud_enum_runtime_cmd[@]}"
-k "$company_name"
-k "$domain"
-k "${domain%%.*}"
diff --git a/modules/utils.sh b/modules/utils.sh
index d7d4aed..dbbd1f7 100644
--- a/modules/utils.sh
+++ b/modules/utils.sh
@@ -142,6 +142,14 @@ function validate_config() {
warnings=$((warnings + 1))
fi
done
+ if [[ -n "${WEBPROBESIMPLE:-}" ]]; then
+ print_warnf "WEBPROBESIMPLE is deprecated/ignored; use WEBPROBEFULL + WEBPROBE_PORTS"
+ warnings=$((warnings + 1))
+ fi
+ if [[ -n "${HTTPX_FLAGS:-}" ]]; then
+ print_warnf "HTTPX_FLAGS is deprecated/ignored for web probing; use WEBPROBE_PORTS"
+ warnings=$((warnings + 1))
+ fi
if [[ -n "${MONITOR_MIN_SEVERITY:-}" ]]; then
case "${MONITOR_MIN_SEVERITY,,}" in
@@ -154,7 +162,7 @@ function validate_config() {
fi
# Validate numeric thread/rate variables
- for var in FFUF_THREADS HTTPX_THREADS DALFOX_THREADS KATANA_THREADS HTTPX_RATELIMIT NUCLEI_RATELIMIT FFUF_RATELIMIT DNSX_THREADS DNSX_RATE_LIMIT PERMUTATIONS_SHORT_THRESHOLD; do
+ for var in FFUF_THREADS HTTPX_THREADS DALFOX_THREADS KATANA_THREADS HTTPX_RATELIMIT NUCLEI_RATELIMIT FFUF_RATELIMIT DNSX_THREADS DNSX_RATE_LIMIT PERMUTATIONS_SHORT_THRESHOLD AXIOM_FLEET_COUNT; do
if [[ -n "${!var:-}" && ! "${!var}" =~ ^[0-9]+$ ]]; then
print_errorf "%s must be numeric, got: %s" "$var" "${!var}"
errors=$((errors + 1))
diff --git a/modules/web.sh b/modules/web.sh
index fbd4d1d..3bacd1c 100644
--- a/modules/web.sh
+++ b/modules/web.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# shellcheck disable=SC2154 # Variables defined in reconftw.cfg
# reconFTW - Web analysis module
-# Contains: webprobe_simple, webprobe_full, screenshot, virtualhosts,
+# Contains: webprobe_full, screenshot, virtualhosts,
# favirecon_tech,
# portscan, cdnprovider, waf_checks, nuclei_check, graphql_scan,
# param_discovery, grpc_reflection, fuzz, iishortname, cms_scanner,
@@ -17,27 +17,6 @@
# Helper Functions for Web Module
###############################################################################
-# Run httpx probe on input file
-# Usage: _run_httpx input_file output_file [extra_flags...]
-_run_httpx() {
- local input="$1"
- local output="$2"
- shift 2
- local extra_flags=("$@")
-
- if [[ $AXIOM != true ]]; then
- # shellcheck disable=SC2086 # HTTPX_FLAGS intentionally word-split
- run_command httpx $HTTPX_FLAGS -no-color -json -random-agent \
- "${extra_flags[@]}" \
- -o "$output" <"$input" 2>>"$LOGFILE" >/dev/null
- else
- # shellcheck disable=SC2086 # HTTPX_FLAGS intentionally word-split
- run_command axiom-scan "$input" -m httpx $HTTPX_FLAGS -no-color -json -random-agent \
- "${extra_flags[@]}" \
- -o "$output" "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
- fi
-}
-
# Normalize wildcard-prefixed hosts in URL-like lines.
# Examples:
# *.api.example.com -> api.example.com
@@ -46,56 +25,43 @@ _normalize_probe_urls() {
sed -E 's#^(https?://)\*\.#\1#; s#^\*\.##'
}
-# Detect whether a probe output file contains JSONL.
-# Returns 0 when the first non-empty line starts with "{", else 1.
-_probe_output_is_json() {
+# Validate probe output as JSONL. Empty files are valid.
+# Usage: _validate_probe_jsonl <input_file>
+_validate_probe_jsonl() {
local input_file="$1"
- local first_line
- first_line="$(awk 'NF {print; exit}' "$input_file" 2>/dev/null || true)"
- [[ "$first_line" =~ ^[[:space:]]*\{ ]]
+
+ [[ ! -s "$input_file" ]] && return 0
+ jq -e . "$input_file" >/dev/null 2>>"$LOGFILE"
}
-# Extract in-scope URLs from a probe file that may be JSONL or plain URL list.
-# Usage: _extract_probe_urls <input_file> <domain_filter> <output_file>
-_extract_probe_urls() {
+# Extract in-scope URLs from a JSONL probe file.
+# Usage: _extract_probe_urls_from_json <input_file> <domain_filter> <output_file>
+_extract_probe_urls_from_json() {
local input_file="$1"
local dom_filter="$2"
local output_file="$3"
[[ ! -s "$input_file" ]] && return 0
- if _probe_output_is_json "$input_file"; then
- jq -r 'try (.url // empty)' "$input_file" 2>/dev/null \
- | awk -v dom="$dom_filter" 'index($0, dom) && $0 ~ /^https?:\/\// {print}' \
- | _normalize_probe_urls \
- | anew_q_safe "$output_file"
- else
- awk -v dom="$dom_filter" 'index($0, dom) && $0 ~ /^https?:\/\// {print}' "$input_file" 2>/dev/null \
- | _normalize_probe_urls \
- | anew_q_safe "$output_file"
- fi
+ jq -r 'try (.url // empty)' "$input_file" 2>/dev/null \
+ | awk -v dom="$dom_filter" 'index($0, dom) && $0 ~ /^https?:\/\// {print}' \
+ | _normalize_probe_urls \
+ | sed '/^$/d' \
+ | anew_q_safe "$output_file"
}
-# Process httpx JSON output: extract URLs and web info
-# Usage: _process_httpx_output json_file url_output info_output
-_process_httpx_output() {
+# Render full-info JSONL into plain text entries.
+# Usage: _write_plain_webinfo <input_jsonl> <domain_filter> <output_file>
+_write_plain_webinfo() {
local json_file="$1"
- local url_output="$2"
- local info_output="$3"
-
+ local dom_filter="$2"
+ local output_file="$3"
+
[[ ! -s "$json_file" ]] && return 0
-
- # Extract URLs
- jq -r 'try .url' "$json_file" 2>/dev/null \
- | grep "$domain" \
- | grep -aEo 'https?://[^ ]+' \
- | _normalize_probe_urls \
- | anew_q_safe "$url_output"
- # Extract plain web info
jq -r 'try . | "\(.url) [\(.status_code)] [\(.title)] [\(.webserver)] \(.tech)"' "$json_file" \
- | grep "$domain" \
- | anew_q_safe "$info_output"
+ | awk -v dom="$dom_filter" 'index($0, dom)' \
+ | anew_q_safe "$output_file"
}
# Send URLs to proxy if enabled
@@ -131,228 +97,193 @@ print_webs_summary() {
# Main Web Functions
###############################################################################
-function webprobe_simple() {
+function webprobe_full() {
# Create necessary directories
if ! ensure_dirs .tmp webs subdomains; then return 1; fi
# Check if the function should run
- if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $WEBPROBESIMPLE == true ]]; then
- start_subfunc "${FUNCNAME[0]}" "Running: HTTP probing $domain"
-
- # Baseline cache files (some modules merge into these).
- touch .tmp/web_full_info.txt .tmp/web_full_info_probe.txt webs/web_full_info.txt webs/webs.txt 2>/dev/null || true
-
- # If in multi mode and subdomains.txt doesn't exist, create it
- if [[ -n $multi ]] && [[ ! -f "$dir/subdomains/subdomains.txt" ]]; then
- printf "%b\n" "$domain" >"$dir/subdomains/subdomains.txt"
- touch .tmp/web_full_info.txt webs/web_full_info.txt
- fi
-
- # Run httpx or axiom-scan
- if [[ $AXIOM != true ]]; then
- # shellcheck disable=SC2086 # HTTPX_FLAGS intentionally word-split
- run_command httpx $HTTPX_FLAGS -no-color -json -random-agent -threads "$HTTPX_THREADS" -rl "$HTTPX_RATELIMIT" \
- -retries 2 -timeout "$HTTPX_TIMEOUT" -o .tmp/web_full_info_probe.txt \
- <subdomains/subdomains.txt 2>>"$LOGFILE" >/dev/null
- else
- # shellcheck disable=SC2086 # HTTPX_FLAGS intentionally word-split
- run_command axiom-scan subdomains/subdomains.txt -m httpx $HTTPX_FLAGS -no-color -json -random-agent \
- -threads "$HTTPX_THREADS" -rl "$HTTPX_RATELIMIT" -retries 2 -timeout "$HTTPX_TIMEOUT" \
- -o .tmp/web_full_info_probe.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
- fi
-
- # webprobe_simple is expected to write JSONL when using httpx -json.
- # Some runners (or wrappers) may produce a plain URL list instead.
- local probe_is_json probe_input_lines urls_extracted
- probe_is_json=false
- if _probe_output_is_json ".tmp/web_full_info_probe.txt"; then
- probe_is_json=true
- fi
- probe_input_lines=$(awk 'NF {c++} END {print c+0}' .tmp/web_full_info_probe.txt 2>/dev/null)
-
- # Always start fresh for this run (used by urlchecks diff too).
- : >.tmp/probed_tmp.txt 2>/dev/null || true
-
- if [[ "$probe_is_json" == true ]]; then
- # Merge current probe output with prior cache/state.
- touch .tmp/web_full_info_probe.txt .tmp/web_full_info.txt 2>/dev/null || true
- if ! cat .tmp/web_full_info_probe.txt .tmp/web_full_info.txt 2>>"$LOGFILE" \
- | jq -cs 'unique_by(.input)[]' 2>>"$LOGFILE" >webs/web_full_info.txt; then
- log_note "webprobe_simple: failed to merge httpx JSON; falling back to probe-only" "${FUNCNAME[0]}" "${LINENO}"
- awk 'match($0, /^[[:space:]]*\{/) {print}' .tmp/web_full_info_probe.txt >.tmp/web_full_info_merge_input.jsonl 2>/dev/null || true
- if [[ -s ".tmp/web_full_info_merge_input.jsonl" ]]; then
- jq -cs 'unique_by(.input)[]' .tmp/web_full_info_merge_input.jsonl 2>>"$LOGFILE" >webs/web_full_info.txt || : >webs/web_full_info.txt
- else
- : >webs/web_full_info.txt
- fi
- fi
- # Keep cache as JSONL for later merges.
- cp webs/web_full_info.txt .tmp/web_full_info.txt 2>/dev/null || true
- else
- log_note "webprobe_simple: probe output not JSON; treating as URL list" "${FUNCNAME[0]}" "${LINENO}"
- fi
- _extract_probe_urls ".tmp/web_full_info_probe.txt" "$domain" ".tmp/probed_tmp.txt" || true
- urls_extracted=$(awk 'NF {c++} END {print c+0}' .tmp/probed_tmp.txt 2>/dev/null)
-
- # Fallback: if extraction from probe output produced nothing, try cached JSON.
- if [[ "${urls_extracted:-0}" -eq 0 ]] && [[ -s ".tmp/web_full_info.txt" ]] && _probe_output_is_json ".tmp/web_full_info.txt"; then
- _extract_probe_urls ".tmp/web_full_info.txt" "$domain" ".tmp/probed_tmp.txt" || true
- urls_extracted=$(awk 'NF {c++} END {print c+0}' .tmp/probed_tmp.txt 2>/dev/null)
- log_note "webprobe_simple: fallback to .tmp/web_full_info.txt urls_extracted=${urls_extracted}" "${FUNCNAME[0]}" "${LINENO}"
- fi
-
- log_note "webprobe_simple: probe_input_lines=${probe_input_lines} urls_extracted=${urls_extracted:-0} probe_is_json=${probe_is_json}" "${FUNCNAME[0]}" "${LINENO}"
-
- # Adaptive throttling heuristics: mark slow hosts (429/403) from httpx
- if [[ -s "webs/web_full_info.txt" ]]; then
- jq -r 'try select(.status_code==403 or .status_code==429) | .url' webs/web_full_info.txt 2>/dev/null \
- | awk -F/ '{print $3}' | sed 's/\:$//' | sort -u >.tmp/slow_hosts.txt
- fi
-
- # Extract web info to plain text
- if [[ -s "webs/web_full_info.txt" ]]; then
- jq -r 'try . |"\(.url) [\(.status_code)] [\(.title)] [\(.webserver)] \(.tech)"' webs/web_full_info.txt \
- | grep "$domain" | anew_q_safe webs/web_full_info_plain.txt
- fi
-
- # Remove out-of-scope entries
- if [[ -s $outOfScope_file ]]; then
- if ! deleteOutScoped "$outOfScope_file" .tmp/probed_tmp.txt; then
- print_warnf "Failed to delete out-of-scope entries."
- fi
- fi
+ if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $WEBPROBEFULL == true ]]; then
+ start_func "${FUNCNAME[0]}" "HTTP Probing Full Port Set"
- touch .tmp/probed_tmp.txt
+ # Prepare target/output files.
+ touch webs/webs.txt webs/webs_uncommon_ports.txt \
+ webs/web_full_info.txt webs/web_full_info_plain.txt \
+ webs/web_full_info_uncommon.txt webs/web_full_info_uncommon_plain.txt 2>/dev/null || true
+ : >.tmp/probed_common_ports_tmp.txt 2>/dev/null || true
+ : >.tmp/probed_uncommon_ports_tmp.txt 2>/dev/null || true
+ : >.tmp/probed_tmp.txt 2>/dev/null || true
+ : >.tmp/slow_hosts.txt 2>/dev/null || true
- # Count new websites
- if ! NUMOFLINES=$(anew_safe webs/webs.txt <.tmp/probed_tmp.txt 2>/dev/null | sed '/^$/d' | wc -l); then
- print_warnf "Failed to count new websites."
- NUMOFLINES=0
- fi
+ # If in multi mode and subdomains.txt doesn't exist, create it
+ if [[ -n $multi ]] && [[ ! -f "$dir/subdomains/subdomains.txt" ]]; then
+ printf "%b\n" "$domain" >"$dir/subdomains/subdomains.txt"
+ fi
- # Update webs_all.txt
- ensure_webs_all || true
+ if [[ ! -s "subdomains/subdomains.txt" ]]; then
+ end_func "No subdomains/subdomains.txt file found, web probing skipped." "${FUNCNAME[0]}" "SKIP_NOINPUT"
+ plugins_emit after_webprobe "$domain" "$dir"
+ return 0
+ fi
- # Asset store: append probed webs
- append_assets_from_file web url webs/webs.txt
+ local probe_ports="${WEBPROBE_PORTS:-80,443,${UNCOMMON_PORTS_WEB:-}}"
+ probe_ports=$(printf '%s' "$probe_ports" | sed -E 's/,+/,/g; s/^,//; s/,$//')
+ local probe_out=".tmp/web_full_info_probe.txt"
+ local common_json_tmp=".tmp/web_full_info_common_current.txt"
+ local uncommon_json_tmp=".tmp/web_full_info_uncommon_current.txt"
+ local -a axiom_extra_args=()
- end_subfunc "${NUMOFLINES} new websites resolved" "${FUNCNAME[0]}"
+ : >"$probe_out" 2>/dev/null || true
+ : >"$common_json_tmp" 2>/dev/null || true
+ : >"$uncommon_json_tmp" 2>/dev/null || true
- # Send websites to proxy if conditions met
- if [[ $PROXY == true ]] && [[ -n $proxy_url ]] && [[ $(wc -l <webs/webs.txt) -le $DEEP_LIMIT2 ]]; then
- notification "Sending websites to proxy" "info"
- run_command ffuf -mc all -w webs/webs.txt -u FUZZ -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
+ if [[ $AXIOM == true ]] && [[ -n "${AXIOM_EXTRA_ARGS:-}" ]]; then
+ local _ifs="$IFS"
+ IFS=' '
+ read -r -a axiom_extra_args <<<"$AXIOM_EXTRA_ARGS"
+ IFS="$_ifs"
fi
- else
- if [[ $WEBPROBESIMPLE == false ]]; then
- skip_notification "disabled"
+ if [[ $AXIOM != true ]]; then
+ local -a httpx_cmd=(
+ httpx
+ -follow-host-redirects
+ -random-agent
+ -status-code
+ -p "$probe_ports"
+ -threads "$HTTPX_UNCOMMONPORTS_THREADS"
+ -rl "$HTTPX_RATELIMIT"
+ -timeout "$HTTPX_UNCOMMONPORTS_TIMEOUT"
+ -silent
+ -retries 2
+ -title
+ -web-server
+ -tech-detect
+ -location
+ -no-color
+ -json
+ -o "$probe_out"
+ )
+ run_command "${httpx_cmd[@]}" <subdomains/subdomains.txt 2>>"$LOGFILE" >/dev/null
else
- skip_notification "processed"
+ local -a axiom_cmd=(
+ axiom-scan
+ subdomains/subdomains.txt
+ -m httpx
+ -follow-host-redirects
+ -H "${HEADER}"
+ -status-code
+ -p "$probe_ports"
+ -threads "$HTTPX_UNCOMMONPORTS_THREADS"
+ -timeout "$HTTPX_UNCOMMONPORTS_TIMEOUT"
+ -silent
+ -retries 2
+ -title
+ -web-server
+ -tech-detect
+ -location
+ -no-color
+ -json
+ -o "$probe_out"
+ )
+ if [[ ${#axiom_extra_args[@]} -gt 0 ]]; then
+ axiom_cmd+=("${axiom_extra_args[@]}")
+ fi
+ run_command "${axiom_cmd[@]}" 2>>"$LOGFILE" >/dev/null
fi
- fi
- # Emit plugin event
- plugins_emit after_webprobe "$domain" "$dir"
+ if [[ -s "$probe_out" ]] && ! _validate_probe_jsonl "$probe_out"; then
+ end_func "Invalid non-JSON output detected in ${probe_out}" "${FUNCNAME[0]}" "FAIL"
+ plugins_emit after_webprobe "$domain" "$dir"
+ return 1
+ fi
-}
+ if [[ -s "$probe_out" ]]; then
+ jq -cr --arg dom "$domain" '
+ def effective_port:
+ if (.port? != null and ((.port | tostring | length) > 0)) then (.port | tostring)
+ elif ((.url // "") | test(":[0-9]+(/|$)")) then ((.url // "") | capture(":(?<p>[0-9]+)(/|$)").p)
+ elif ((.url // "") | startswith("https://")) then "443"
+ elif ((.url // "") | startswith("http://")) then "80"
+ else ""
+ end;
+ select((.url // "") | contains($dom))
+ | select(effective_port == "80" or effective_port == "443")
+ ' "$probe_out" 2>>"$LOGFILE" >"$common_json_tmp"
-function webprobe_full() {
-
- # Create necessary directories
- if ! ensure_dirs .tmp webs subdomains; then return 1; fi
-
- # Check if the function should run
- if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $WEBPROBEFULL == true ]]; then
- start_func "${FUNCNAME[0]}" "HTTP Probing Non-Standard Ports"
+ jq -cr --arg dom "$domain" '
+ def effective_port:
+ if (.port? != null and ((.port | tostring | length) > 0)) then (.port | tostring)
+ elif ((.url // "") | test(":[0-9]+(/|$)")) then ((.url // "") | capture(":(?<p>[0-9]+)(/|$)").p)
+ elif ((.url // "") | startswith("https://")) then "443"
+ elif ((.url // "") | startswith("http://")) then "80"
+ else ""
+ end;
+ select((.url // "") | contains($dom))
+ | select(effective_port != "80" and effective_port != "443")
+ ' "$probe_out" 2>>"$LOGFILE" >"$uncommon_json_tmp"
+ fi
- # If in multi mode and subdomains.txt doesn't exist, create it
- if [[ -n $multi ]] && [[ ! -f "$dir/subdomains/subdomains.txt" ]]; then
- printf "%b\n" "$domain" >"$dir/subdomains/subdomains.txt"
- touch webs/webs.txt
- fi
-
- # Check if subdomains.txt is non-empty
- if [[ -s "subdomains/subdomains.txt" ]]; then
- if [[ $AXIOM != true ]]; then
- # Run httpx on subdomains.txt
- run_command httpx -follow-host-redirects -random-agent -status-code \
- -p "$UNCOMMON_PORTS_WEB" -threads "$HTTPX_UNCOMMONPORTS_THREADS" \
- -timeout "$HTTPX_UNCOMMONPORTS_TIMEOUT" -silent -retries 2 \
- -title -web-server -tech-detect -location -no-color -json \
- -o .tmp/web_full_info_uncommon.txt <subdomains/subdomains.txt 2>>"$LOGFILE" >/dev/null
- else
- # Run axiom-scan with httpx module on subdomains.txt
- run_command axiom-scan subdomains/subdomains.txt -m httpx -follow-host-redirects \
- -H "${HEADER}" -status-code -p "$UNCOMMON_PORTS_WEB" \
- -threads "$HTTPX_UNCOMMONPORTS_THREADS" -timeout "$HTTPX_UNCOMMONPORTS_TIMEOUT" \
- -silent -retries 2 -title -web-server -tech-detect -location -no-color -json \
- -o .tmp/web_full_info_uncommon.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
- fi
+ if [[ -s "$common_json_tmp" ]]; then
+ cat "$common_json_tmp" | anew_q_safe "webs/web_full_info.txt"
+ fi
+ if [[ -s "$uncommon_json_tmp" ]]; then
+ cat "$uncommon_json_tmp" | anew_q_safe "webs/web_full_info_uncommon.txt"
fi
- # Process web_full_info_uncommon.txt
- if [[ -s ".tmp/web_full_info_uncommon.txt" ]]; then
- local uncommon_is_json uncommon_input_lines uncommon_urls_extracted
- uncommon_is_json=false
- if _probe_output_is_json ".tmp/web_full_info_uncommon.txt"; then
- uncommon_is_json=true
- fi
- uncommon_input_lines=$(awk 'NF {c++} END {print c+0}' .tmp/web_full_info_uncommon.txt 2>/dev/null)
+ _write_plain_webinfo "$common_json_tmp" "$domain" "webs/web_full_info_plain.txt"
+ _write_plain_webinfo "$uncommon_json_tmp" "$domain" "webs/web_full_info_uncommon_plain.txt"
- : >.tmp/probed_uncommon_ports_tmp.txt 2>/dev/null || true
- _extract_probe_urls ".tmp/web_full_info_uncommon.txt" "$domain" ".tmp/probed_uncommon_ports_tmp.txt" || true
+ _extract_probe_urls_from_json "$common_json_tmp" "$domain" ".tmp/probed_common_ports_tmp.txt"
+ _extract_probe_urls_from_json "$uncommon_json_tmp" "$domain" ".tmp/probed_uncommon_ports_tmp.txt"
- if [[ "$uncommon_is_json" != true ]]; then
- log_note "webprobe_full: probe output not JSON; treating as URL list" "${FUNCNAME[0]}" "${LINENO}"
- awk -v dom="$domain" 'index($0, dom) && $0 ~ /^https?:\/\// {print}' .tmp/web_full_info_uncommon.txt 2>/dev/null \
- | _normalize_probe_urls \
- | anew_q_safe webs/web_full_info_uncommon.txt
- fi
+ if [[ -s "$outOfScope_file" ]]; then
+ deleteOutScoped "$outOfScope_file" ".tmp/probed_common_ports_tmp.txt" || true
+ deleteOutScoped "$outOfScope_file" ".tmp/probed_uncommon_ports_tmp.txt" || true
+ fi
- if [[ "$uncommon_is_json" == true ]]; then
- # Extract plain web info
- jq -r 'try . | "\(.url) [\(.status_code)] [\(.title)] [\(.webserver)] \(.tech)"' .tmp/web_full_info_uncommon.txt \
- | grep "$domain" \
- | anew_q_safe webs/web_full_info_uncommon_plain.txt
-
- # Update webs_full_info_uncommon.txt based on whether domain is IP
- if [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
- cat .tmp/web_full_info_uncommon.txt 2>>"$LOGFILE" | anew_q_safe webs/web_full_info_uncommon.txt
- else
- grep "$domain" .tmp/web_full_info_uncommon.txt | anew_q_safe webs/web_full_info_uncommon.txt
- fi
- fi
- uncommon_urls_extracted=$(awk 'NF {c++} END {print c+0}' .tmp/probed_uncommon_ports_tmp.txt 2>/dev/null)
+ local common_new=0
+ local uncommon_new=0
+ if ! common_new=$(anew_safe "webs/webs.txt" <".tmp/probed_common_ports_tmp.txt" 2>/dev/null | sed '/^$/d' | wc -l); then
+ print_warnf "Failed to count common web targets."
+ common_new=0
+ fi
+ if ! uncommon_new=$(anew_safe "webs/webs_uncommon_ports.txt" <".tmp/probed_uncommon_ports_tmp.txt" 2>/dev/null | sed '/^$/d' | wc -l); then
+ print_warnf "Failed to count uncommon web targets."
+ uncommon_new=0
+ fi
- # Fallback: try prior uncommon cache when current extraction yields nothing.
- if [[ "${uncommon_urls_extracted:-0}" -eq 0 ]] && [[ -s "webs/web_full_info_uncommon.txt" ]]; then
- _extract_probe_urls "webs/web_full_info_uncommon.txt" "$domain" ".tmp/probed_uncommon_ports_tmp.txt" || true
- uncommon_urls_extracted=$(awk 'NF {c++} END {print c+0}' .tmp/probed_uncommon_ports_tmp.txt 2>/dev/null)
- log_note "webprobe_full: fallback to webs/web_full_info_uncommon.txt urls_extracted=${uncommon_urls_extracted}" "${FUNCNAME[0]}" "${LINENO}"
- fi
- log_note "webprobe_full: probe_input_lines=${uncommon_input_lines} urls_extracted=${uncommon_urls_extracted:-0} probe_is_json=${uncommon_is_json}" "${FUNCNAME[0]}" "${LINENO}"
+ cat ".tmp/probed_common_ports_tmp.txt" ".tmp/probed_uncommon_ports_tmp.txt" 2>/dev/null \
+ | sed '/^$/d' \
+ | sort -u >".tmp/probed_tmp.txt"
- # Count new websites
- if ! NUMOFLINES=$(anew_safe webs/webs_uncommon_ports.txt <.tmp/probed_uncommon_ports_tmp.txt | sed '/^$/d' | wc -l); then
- print_warnf "Failed to count new websites."
- NUMOFLINES=0
- fi
+ if [[ -s "$probe_out" ]]; then
+ jq -r 'try select(.status_code==403 or .status_code==429) | .url' "$probe_out" 2>/dev/null \
+ | awk -F/ '{print $3}' \
+ | sed 's/:.*$//' \
+ | sed '/^$/d' \
+ | sort -u >".tmp/slow_hosts.txt"
+ fi
- # Notify user
- notification "Uncommon web ports: ${NUMOFLINES} new websites" "good"
+ notification "Common web ports: ${common_new} new websites" "good"
+ notification "Uncommon web ports: ${uncommon_new} new websites" "good"
- # Update webs_all.txt
- ensure_webs_all || true
+ ensure_webs_all || true
+ append_assets_from_file web url webs/webs.txt
+ append_assets_from_file web url webs/webs_uncommon_ports.txt
- # Send to proxy if conditions met
- if [[ $PROXY == true ]] && [[ -n $proxy_url ]] && [[ $(wc -l <webs/webs_uncommon_ports.txt) -le $DEEP_LIMIT2 ]]; then
- notification "Sending websites with uncommon ports to proxy" "info"
- run_command ffuf -mc all -w webs/webs_uncommon_ports.txt -u FUZZ -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
+ if [[ $PROXY == true ]] && [[ -n $proxy_url ]]; then
+ if [[ -s "webs/webs.txt" ]] && [[ $(wc -l <webs/webs.txt) -le $DEEP_LIMIT2 ]]; then
+ notification "Sending websites to proxy" "info"
+ run_command ffuf -mc all -w webs/webs.txt -u FUZZ -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
+ fi
+ if [[ -s "webs/webs_uncommon_ports.txt" ]] && [[ $(wc -l <webs/webs_uncommon_ports.txt) -le $DEEP_LIMIT2 ]]; then
+ notification "Sending websites with uncommon ports to proxy" "info"
+ run_command ffuf -mc all -w webs/webs_uncommon_ports.txt -u FUZZ -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
fi
fi
- end_func "Results are saved in $domain/webs/webs_uncommon_ports.txt" "${FUNCNAME[0]}"
+
+ end_func "Results are saved in $domain/webs/[webs.txt|webs_uncommon_ports.txt|webs_all.txt]" "${FUNCNAME[0]}"
print_webs_summary
else
if [[ $WEBPROBEFULL == false ]]; then
@@ -362,6 +293,9 @@ function webprobe_full() {
fi
fi
+ # Emit plugin event
+ plugins_emit after_webprobe "$domain" "$dir"
+
}
function screenshot() {
@@ -1507,7 +1441,7 @@ function cms_scanner() {
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
return
else
- skip_notification "processed"
+ skip_notification "processed-visible"
fi
fi
}
@@ -2107,6 +2041,7 @@ function wordlist_gen_roboxtractor() {
# Check if the function should run
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $ROBOTSWORDLIST == true ]] \
+ && [[ ${DEEP:-false} == true ]] \
&& ! [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
start_func "${FUNCNAME[0]}" "Robots Wordlist Generation"
@@ -2136,6 +2071,8 @@ function wordlist_gen_roboxtractor() {
skip_notification "disabled"
elif [[ $domain =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
return
+ elif [[ ${DEEP:-false} != true ]]; then
+ skip_notification "mode"
else
skip_notification "processed"
fi
diff --git a/reconftw.cfg b/reconftw.cfg
index 3b4357f..b2891ff 100644
--- a/reconftw.cfg
+++ b/reconftw.cfg
@@ -165,11 +165,11 @@ TLS_PORTS=$(cat "${SCRIPTPATH}/config/tls_ports.txt" 2>/dev/null | tr -d '\n') #
INSCOPE=false # Uses inscope tool to filter the scope, requires .scope file in reconftw folder
# Web detection
-WEBPROBESIMPLE=true # Web probing on 80/443
-WEBPROBEFULL=true # Web probing in a large port list
+WEBPROBEFULL=true # Unified web probing over configured ports
WEBSCREENSHOT=true # Webs screenshooting
VIRTUALHOSTS=false # Check virtualhosts by fuzzing HOST header
UNCOMMON_PORTS_WEB=$(cat "${SCRIPTPATH}/config/uncommon_ports_web.txt" 2>/dev/null | tr -d '\n') # Uncommon web ports for full probing
+WEBPROBE_PORTS="80,443,${UNCOMMON_PORTS_WEB}" # Ports used by webprobe_full
# Host
FAVIRECON=true # Favicon-based technology recon over discovered web targets
@@ -221,7 +221,7 @@ FUZZ_RECURSION_DEPTH=2 # ffuf recursion depth used in DEEP mode
IIS_SHORTNAME=true
CMS_SCANNER=true # CMS scanner
WORDLIST=true # Wordlist generation
-ROBOTSWORDLIST=true # Check historic disallow entries on waybackMachine
+ROBOTSWORDLIST=true # Check historic disallow entries on waybackMachine (DEEP mode only)
PASSWORD_DICT=true # Generate password dictionary
PASSWORD_DICT_ENGINE=cewler # cewler|pydictor
PASSWORD_DICT_MAX_TARGETS=50 # Max web targets processed by cewler when not DEEP
@@ -313,7 +313,6 @@ PROXY=false # Send to proxy the websites found
SENDZIPNOTIFY=false # Send to zip the results (over notify)
PRESERVE=true # set to true to avoid deleting the .called_fn files on really large scans
FFUF_FLAGS=" -mc all -fc 404 -sf -noninteractive -of json" # Ffuf flags
-HTTPX_FLAGS=" -follow-redirects -random-agent -status-code -silent -title -web-server -tech-detect -location -content-length" # Httpx flags for simple web probing
# HTTP options
HEADER="User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" # Default header
diff --git a/reconftw.sh b/reconftw.sh
index 2fb7b75..13c9ef1 100755
--- a/reconftw.sh
+++ b/reconftw.sh
@@ -78,6 +78,32 @@ source "${_INIT_SCRIPTPATH}/modules/vulns.sh"
source "${_INIT_SCRIPTPATH}/modules/axiom.sh"
source "${_INIT_SCRIPTPATH}/modules/modes.sh"
+# Normalize legacy-friendly AXIOM syntax:
+# -v 20 -> -v --vps-count 20
+function normalize_vps_count_args() {
+ local -a raw_args=("$@")
+ local -a normalized_args=()
+ local idx=0
+ local current next
+
+ while ((idx < ${#raw_args[@]})); do
+ current="${raw_args[idx]}"
+ if [[ "$current" == "-v" ]]; then
+ next="${raw_args[idx+1]:-}"
+ if validate_integer "$next" 1; then
+ normalized_args+=("-v" "--vps-count" "$next")
+ idx=$((idx + 2))
+ continue
+ fi
+ fi
+
+ normalized_args+=("$current")
+ idx=$((idx + 1))
+ done
+
+ printf '%s\0' "${normalized_args[@]}"
+}
+
# Allow sourcing functions without execution (for testing)
# Must be checked before argument parsing to avoid side effects
if [[ "${1:-}" == "--source-only" ]]; then
@@ -112,7 +138,9 @@ if [[ $OSTYPE == "darwin"* ]]; then
PATH="$(brew --prefix gnu-sed)/libexec/gnubin:$PATH"
fi
-PROGARGS=$(getopt -o 'd:m:l:x:i:o:f:q:c:zrspanwvyh' --long 'domain:,list:,recon,subdomains,passive,all,web,osint,zen,deep,help,vps,ai,check-tools,health-check,quick-rescan,incremental,adaptive-rate,dry-run,parallel,no-parallel,monitor,monitor-interval:,monitor-cycles:,refresh-cache,gen-resolvers,force,export:,report-only,no-report,parallel-log:,quiet,verbose,no-color,log-format:,show-cache,banner,no-banner,legal' -n 'reconFTW' -- "$@")
+CLI_ARGS=()
+mapfile -d '' -t CLI_ARGS < <(normalize_vps_count_args "$@")
+PROGARGS=$(getopt -o 'd:m:l:x:i:o:f:q:c:zrspanwvyh' --long 'domain:,list:,recon,subdomains,passive,all,web,osint,zen,deep,help,vps,vps-count:,ai,check-tools,health-check,quick-rescan,incremental,adaptive-rate,dry-run,parallel,no-parallel,monitor,monitor-interval:,monitor-cycles:,refresh-cache,gen-resolvers,force,export:,report-only,no-report,parallel-log:,quiet,verbose,no-color,log-format:,show-cache,banner,no-banner,legal' -n 'reconFTW' -- "${CLI_ARGS[@]}")
exit_status=$?
if [[ $exit_status -ne 0 ]]; then
@@ -124,6 +152,7 @@ fi
eval set -- "$PROGARGS"
unset PROGARGS
CLI_PARALLEL_MODE=""
+CLI_AXIOM_FLEET_COUNT=""
SHOW_CACHE=false
SHOW_BANNER=false
SHOW_LEGAL=false
@@ -278,6 +307,15 @@ while true; do
shift
continue
;;
+ '--vps-count')
+ if ! validate_integer "$2" 1; then
+ print_errorf "Invalid --vps-count value '%s' (must be an integer >= 1)" "$2"
+ exit 1
+ fi
+ CLI_AXIOM_FLEET_COUNT="$2"
+ shift 2
+ continue
+ ;;
'-f')
CUSTOM_CONFIG=$2
shift 2
@@ -495,6 +533,11 @@ fi
if [[ -n "${CLI_NO_COLOR:-}" ]]; then
NO_COLOR=1
fi
+if [[ -n "${CLI_AXIOM_FLEET_COUNT:-}" ]]; then
+ AXIOM=true
+ AXIOM_FLEET_LAUNCH=true
+ AXIOM_FLEET_COUNT="${CLI_AXIOM_FLEET_COUNT}"
+fi
if [[ "${LOG_FORMAT:-plain}" == "jsonl-strict" ]]; then
# Machine-only output mode: suppress human-oriented rendering.
OUTPUT_VERBOSITY=0
diff --git a/tests/fixtures/ui/full_v2.txt b/tests/fixtures/ui/full_v2.txt
index 11db5df..09b33c3 100644
--- a/tests/fixtures/ui/full_v2.txt
+++ b/tests/fixtures/ui/full_v2.txt
@@ -11,7 +11,7 @@ Started: <TS>
── SUBDOMAINS ───────────────────────────────────────────────────────────────
Started: <TS>
OK subdomains_full 0s
-[INFO] verbose_marker
+INFO verbose_marker
Output: subdomains/, webs/
Completed: <TS>
diff --git a/tests/fixtures/ui/subdomains_v2.txt b/tests/fixtures/ui/subdomains_v2.txt
index 8cb57b2..394e06a 100644
--- a/tests/fixtures/ui/subdomains_v2.txt
+++ b/tests/fixtures/ui/subdomains_v2.txt
@@ -11,7 +11,7 @@ Started: <TS>
── SUBDOMAINS ───────────────────────────────────────────────────────────────
Started: <TS>
OK subdomains_full 0s
-[INFO] verbose_marker
+INFO verbose_marker
Output: subdomains/, webs/
Completed: <TS>
diff --git a/tests/integration/test_checkpoint.bats b/tests/integration/test_checkpoint.bats
index 7e2a8e8..2982718 100644
--- a/tests/integration/test_checkpoint.bats
+++ b/tests/integration/test_checkpoint.bats
@@ -41,7 +41,7 @@ source_reconftw() {
}
@test "checkpoint: multiple function markers can coexist" {
- local funcs=("sub_passive" "sub_crt" "sub_active" "webprobe_simple")
+ local funcs=("sub_passive" "sub_crt" "sub_active" "webprobe_full")
for func in "${funcs[@]}"; do
touch "$called_fn_dir/.$func"
@@ -142,7 +142,7 @@ source_reconftw() {
@test "resume: can clear all checkpoints" {
touch "$called_fn_dir/.sub_passive"
touch "$called_fn_dir/.sub_crt"
- touch "$called_fn_dir/.webprobe_simple"
+ touch "$called_fn_dir/.webprobe_full"
# Clear all
rm -f "$called_fn_dir"/.??*
diff --git a/tests/integration/test_shell_syntax.bats b/tests/integration/test_shell_syntax.bats
new file mode 100644
index 0000000..0f20919
--- /dev/null
+++ b/tests/integration/test_shell_syntax.bats
@@ -0,0 +1,26 @@
+#!/usr/bin/env bats
+
+setup() {
+ local project_root
+ project_root="$(cd "$(dirname "$BATS_TEST_FILENAME")/../.." && pwd)"
+ export SCRIPTPATH="$project_root"
+}
+
+@test "reconftw.sh passes bash syntax check" {
+ run bash -n "$SCRIPTPATH/reconftw.sh"
+ [ "$status" -eq 0 ]
+}
+
+@test "critical modules pass bash syntax check" {
+ run bash -n \
+ "$SCRIPTPATH/lib/common.sh" \
+ "$SCRIPTPATH/modules/core.sh" \
+ "$SCRIPTPATH/modules/modes.sh" \
+ "$SCRIPTPATH/modules/web.sh" \
+ "$SCRIPTPATH/modules/subdomains.sh" \
+ "$SCRIPTPATH/modules/osint.sh" \
+ "$SCRIPTPATH/modules/utils.sh" \
+ "$SCRIPTPATH/modules/axiom.sh" \
+ "$SCRIPTPATH/modules/vulns.sh"
+ [ "$status" -eq 0 ]
+}
diff --git a/tests/integration/test_vps_count_cli.bats b/tests/integration/test_vps_count_cli.bats
new file mode 100644
index 0000000..850d099
--- /dev/null
+++ b/tests/integration/test_vps_count_cli.bats
@@ -0,0 +1,93 @@
+#!/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/vps_count_cli"
+ export MOCK_BIN="$TEST_DIR/mockbin"
+ export AXIOM_CALL_LOG="$TEST_DIR/axiom_calls.log"
+ export CUSTOM_CFG="$TEST_DIR/custom_axiom.cfg"
+ export TEST_DOMAIN="vpscount.example.com"
+ export TARGET_DIR="$SCRIPTPATH/Recon/$TEST_DOMAIN"
+
+ mkdir -p "$TEST_DIR" "$MOCK_BIN" "$TARGET_DIR/.log"
+ mkdir -p "$TARGET_DIR"/{subdomains,webs,hosts,nuclei_output,report}
+ : > "$AXIOM_CALL_LOG"
+
+ cat > "$MOCK_BIN/axiom-ls" <<'EOF'
+#!/usr/bin/env bash
+exit 0
+EOF
+ chmod +x "$MOCK_BIN/axiom-ls"
+
+ cat > "$MOCK_BIN/axiom-select" <<'EOF'
+#!/usr/bin/env bash
+exit 0
+EOF
+ chmod +x "$MOCK_BIN/axiom-select"
+
+ cat > "$MOCK_BIN/axiom-fleet2" <<'EOF'
+#!/usr/bin/env bash
+if [[ -n "${AXIOM_CALL_LOG:-}" ]]; then
+ printf 'axiom-fleet2:%s\n' "$*" >> "$AXIOM_CALL_LOG"
+fi
+exit 0
+EOF
+ chmod +x "$MOCK_BIN/axiom-fleet2"
+
+ cat > "$CUSTOM_CFG" <<'EOF'
+AXIOM_FLEET_LAUNCH=false
+AXIOM_FLEET_COUNT=3
+EOF
+
+ echo "a.$TEST_DOMAIN" > "$TARGET_DIR/subdomains/subdomains.txt"
+ echo "https://a.$TEST_DOMAIN" > "$TARGET_DIR/webs/webs_all.txt"
+ echo "1.1.1.1" > "$TARGET_DIR/hosts/ips.txt"
+}
+
+teardown() {
+ rm -rf "$TEST_DIR"
+ rm -rf "$TARGET_DIR"
+}
+
+@test "help advertises --vps-count" {
+ run timeout 20 bash "$SCRIPTPATH/reconftw.sh" -h
+ [ "$status" -eq 0 ]
+ [[ "$output" == *"--vps-count n"* ]]
+}
+
+@test "--vps-count rejects 0" {
+ run timeout 20 bash "$SCRIPTPATH/reconftw.sh" --vps-count 0 -h 2>&1
+ [ "$status" -ne 0 ]
+ [[ "$output" == *"Invalid --vps-count value"* ]]
+}
+
+@test "--vps-count rejects non-numeric values" {
+ run timeout 20 bash "$SCRIPTPATH/reconftw.sh" --vps-count abc -h 2>&1
+ [ "$status" -ne 0 ]
+ [[ "$output" == *"Invalid --vps-count value"* ]]
+}
+
+@test "--vps-count accepts valid value" {
+ run timeout 20 bash "$SCRIPTPATH/reconftw.sh" --vps-count 30 -h
+ [ "$status" -eq 0 ]
+}
+
+@test "--report-only accepts --vps-count override parsing" {
+ run env SKIP_CRITICAL_CHECK=true timeout 30 bash "$SCRIPTPATH/reconftw.sh" \
+ -d "$TEST_DOMAIN" --report-only --vps-count 20 --export all
+ [ "$status" -eq 0 ]
+}
+
+@test "--vps-count override forces fleet launch/count over custom config values" {
+ run env PATH="$MOCK_BIN:$PATH" SKIP_CRITICAL_CHECK=true timeout 30 bash "$SCRIPTPATH/reconftw.sh" \
+ -d "$TEST_DOMAIN" -c axiom_launch --vps-count 20 -f "$CUSTOM_CFG" --no-banner
+ [ "$status" -eq 0 ]
+ [[ "$output" == *"axiom_launch"* ]]
+ [[ -f "$AXIOM_CALL_LOG" ]]
+ run cat "$AXIOM_CALL_LOG"
+ [ "$status" -eq 0 ]
+ [[ "$output" == *"-i 20"* ]]
+}
diff --git a/tests/unit/test_cli_vps_count.bats b/tests/unit/test_cli_vps_count.bats
new file mode 100644
index 0000000..f9ca3b9
--- /dev/null
+++ b/tests/unit/test_cli_vps_count.bats
@@ -0,0 +1,38 @@
+#!/usr/bin/env bats
+
+setup() {
+ local project_root
+ project_root="$(cd "$(dirname "$BATS_TEST_FILENAME")/../.." && pwd)"
+ export tools="$HOME/Tools"
+ export LOGFILE="/dev/null"
+ export bred='' bblue='' bgreen='' byellow='' yellow='' reset=''
+ export NOTIFICATION=false
+ export AXIOM=false
+ source "$project_root/reconftw.cfg" 2>/dev/null || true
+ export SCRIPTPATH="$project_root"
+ source "$project_root/reconftw.sh" --source-only
+}
+
+normalize_to_lines() {
+ local -a normalized=()
+ mapfile -d '' -t normalized < <(normalize_vps_count_args "$@")
+ printf '%s\n' "${normalized[@]}"
+}
+
+@test "normalize_vps_count_args rewrites '-v 20 -r' to include --vps-count" {
+ run normalize_to_lines -v 20 -r
+ [ "$status" -eq 0 ]
+ [ "$output" = $'-v\n--vps-count\n20\n-r' ]
+}
+
+@test "normalize_vps_count_args keeps plain '-v -r' unchanged" {
+ run normalize_to_lines -v -r
+ [ "$status" -eq 0 ]
+ [ "$output" = $'-v\n-r' ]
+}
+
+@test "normalize_vps_count_args keeps '-v foo -r' unchanged" {
+ run normalize_to_lines -v foo -r
+ [ "$status" -eq 0 ]
+ [ "$output" = $'-v\nfoo\n-r' ]
+}
diff --git a/tests/unit/test_common.bats b/tests/unit/test_common.bats
index a4265d3..351a08b 100644
--- a/tests/unit/test_common.bats
+++ b/tests/unit/test_common.bats
@@ -186,6 +186,26 @@ EOF
[[ "$output" == *"SKIP"* ]]
}
+@test "skip_notification processed-visible renders SKIP with cache reason and cache marker" {
+ OUTPUT_VERBOSITY=1
+ SHOW_CACHE=false
+ mkdir -p "$called_fn_dir"
+
+ test_func() {
+ skip_notification "processed-visible"
+ }
+
+ run test_func
+ [ "$status" -eq 0 ]
+ [[ "$output" == *"SKIP"* ]]
+ [[ "$output" == *"reason: cache"* ]]
+ [[ "$output" != *"CACHE"* ]]
+ [ -f "$called_fn_dir/.cache_test_func" ]
+ [ ! -f "$called_fn_dir/.skip_test_func" ]
+ [ -f "$called_fn_dir/.status_reason_test_func" ]
+ [ "$(cat "$called_fn_dir/.status_reason_test_func")" = "cache" ]
+}
+
###############################################################################
# output formatting tests
###############################################################################
diff --git a/tests/unit/test_new_tool_integrations.bats b/tests/unit/test_new_tool_integrations.bats
index 4ea8e12..8f3e863 100644
--- a/tests/unit/test_new_tool_integrations.bats
+++ b/tests/unit/test_new_tool_integrations.bats
@@ -296,6 +296,100 @@ SH
! grep -Eq -- '(^| )-b( |$)' "$TEST_DIR/cloud_enum_args.txt"
}
+@test "s3buckets falls back to cloud_enum binary in PATH when local venv is missing" {
+ 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"
+ printf '%s\n' 'print("mock")' > "$tools/cloud_enum/cloud_enum.py"
+
+ 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 > "$MOCK_BIN/cloud_enum" <<'SH'
+#!/usr/bin/env bash
+printf '%s\n' "$*" > "$TEST_DIR/cloud_enum_path_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'
+{"platform":"aws","msg":"OPEN S3 BUCKET","target":"http://demo.s3.amazonaws.com","access":"public"}
+JSON
+exit 0
+SH
+ chmod +x "$MOCK_BIN/cloud_enum"
+
+ run s3buckets
+ [ "$status" -eq 0 ]
+ [[ "$output" != *"runtime missing"* ]]
+ [ -s "$TEST_DIR/cloud_enum_path_args.txt" ]
+ grep -Eq -- '(^| )-f json( |$)' "$TEST_DIR/cloud_enum_path_args.txt"
+ [ -s "subdomains/.cloud_enum_s3.jsonl" ]
+ grep -q 'demo.s3.amazonaws.com' "subdomains/.cloud_enum_s3.jsonl"
+}
+
@test "s3buckets exhaustive profile uses cloud_enum fuzz.txt mutations" {
mkdir -p subdomains .tmp
printf '%s\n' 'target.example.com' > subdomains/subdomains.txt
@@ -536,6 +630,68 @@ SH
! grep -Eq -- '(^| )-b( |$)' "$TEST_DIR/cloud_enum_scan_args.txt"
}
+@test "cloud_enum_scan falls back to cloud_enum binary in PATH when local venv is missing" {
+ mkdir -p osint
+ export OSINT=true
+ export CLOUD_ENUM=true
+ export ASSET_STORE=false
+ export tools="$TEST_DIR/tools"
+ mkdir -p "$tools/cloud_enum"
+ printf '%s\n' 'print("mock")' > "$tools/cloud_enum/cloud_enum.py"
+
+ 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/cloud_enum" <<'SH'
+#!/usr/bin/env bash
+printf '%s\n' "$*" > "$TEST_DIR/cloud_enum_scan_path_args.txt"
+printf '%s\n' 'OPEN S3 BUCKET: http://demo.s3.amazonaws.com'
+exit 0
+SH
+ chmod +x "$MOCK_BIN/cloud_enum"
+
+ run cloud_enum_scan
+ [ "$status" -eq 0 ]
+ [[ "$output" != *"runtime not found"* ]]
+ [ -s "osint/cloud_enum.txt" ]
+ grep -q 'OPEN S3 BUCKET' "osint/cloud_enum.txt"
+ [ -s "$TEST_DIR/cloud_enum_scan_path_args.txt" ]
+ grep -Eq -- '(^| )-qs( |$)' "$TEST_DIR/cloud_enum_scan_path_args.txt"
+}
+
@test "cloud_enum_scan exhaustive profile uses local fuzz mutations file" {
mkdir -p osint
export OSINT=true
@@ -1001,3 +1157,64 @@ SH
grep -q "PARAM: __VIEWSTATE" "webs/params_discovered.txt"
grep -q "PARAM: token" "webs/params_discovered.txt"
}
+
+@test "wordlist_gen_roboxtractor skips in non-DEEP mode with explicit mode reason" {
+ mkdir -p webs .tmp gf
+ printf '%s\n' 'https://target.example.com' > webs/webs_all.txt
+
+ export ROBOTSWORDLIST=true
+ export DEEP=false
+
+ run wordlist_gen_roboxtractor
+ [ "$status" -eq 0 ]
+ [[ "$output" == *"SKIP"* ]]
+ [[ "$output" == *"reason: mode"* ]]
+ [ -f "$called_fn_dir/.skip_wordlist_gen_roboxtractor" ]
+ [ -f "$called_fn_dir/.status_reason_wordlist_gen_roboxtractor" ]
+ [ "$(cat "$called_fn_dir/.status_reason_wordlist_gen_roboxtractor")" = "mode" ]
+}
+
+@test "wordlist_gen_roboxtractor runs in DEEP mode and writes robots wordlist" {
+ mkdir -p webs .tmp gf
+ printf '%s\n' 'https://target.example.com' > webs/webs_all.txt
+
+ cat > "$MOCK_BIN/roboxtractor" <<'SH'
+#!/usr/bin/env bash
+while IFS= read -r url; do
+ [[ -z "$url" ]] && continue
+ printf '%s/robots-path\n' "${url%/}"
+done
+SH
+ chmod +x "$MOCK_BIN/roboxtractor"
+
+ 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
+exit 0
+SH
+ chmod +x "$MOCK_BIN/anew"
+
+ export ROBOTSWORDLIST=true
+ export DEEP=true
+ export PROXY=false
+
+ run wordlist_gen_roboxtractor
+ [ "$status" -eq 0 ]
+ [ -s "webs/robots_wordlist.txt" ]
+ grep -q "https://target.example.com/robots-path" "webs/robots_wordlist.txt"
+}
diff --git a/tests/unit/test_utils.bats b/tests/unit/test_utils.bats
index 72f8ce6..d394e64 100644
--- a/tests/unit/test_utils.bats
+++ b/tests/unit/test_utils.bats
@@ -77,6 +77,13 @@ setup() {
[[ "$output" == *"ERROR"* ]]
}
+@test "validate_config fails on non-numeric AXIOM_FLEET_COUNT" {
+ export AXIOM_FLEET_COUNT="abc"
+ run validate_config
+ [ "$status" -ne 0 ]
+ [[ "$output" == *"AXIOM_FLEET_COUNT must be numeric"* ]]
+}
+
@test "validate_config accepts PERMUTATIONS_ENGINE=gotator without warning" {
export PERMUTATIONS_ENGINE="gotator"
run validate_config
@@ -348,3 +355,12 @@ EOF
[ -z "${WARN_ONCE_KEYS[missing-tool-dnstake]:-}" ]
}
+
+@test "format_pending_tools_message joins tools using comma regardless of IFS" {
+ local old_ifs="$IFS"
+ IFS=$'\n\t'
+ run format_pending_tools_message "cloud_enum" "dnstake"
+ IFS="$old_ifs"
+ [ "$status" -eq 0 ]
+ [ "$output" = "Pending tools: cloud_enum, dnstake" ]
+}
diff --git a/tests/unit/test_webprobe_full_formats.bats b/tests/unit/test_webprobe_full_formats.bats
index 4d3fe16..7770167 100644
--- a/tests/unit/test_webprobe_full_formats.bats
+++ b/tests/unit/test_webprobe_full_formats.bats
@@ -23,9 +23,10 @@ setup() {
export DIFF=false
export AXIOM=false
export WEBPROBEFULL=true
+ export WEBPROBE_PORTS="80,443,8080,8443"
export PROXY=false
- export UNCOMMON_PORTS_WEB="8080,8443"
export HTTPX_UNCOMMONPORTS_THREADS=10
+ export HTTPX_RATELIMIT=0
export HTTPX_UNCOMMONPORTS_TIMEOUT=10
}
@@ -33,11 +34,11 @@ teardown() {
[[ -d "$TEST_DIR" ]] && rm -rf "$TEST_DIR"
}
-@test "webprobe_full accepts URL-list output and updates uncommon/webs_all targets" {
+@test "webprobe_full splits common and uncommon JSON results and updates webs_all" {
mkdir -p .tmp webs subdomains
printf "a.example.com\n" > subdomains/subdomains.txt
- cat > "$MOCK_BIN/httpx" <<'SH'
+cat > "$MOCK_BIN/httpx" <<'SH'
#!/usr/bin/env bash
out=""
while [[ $# -gt 0 ]]; do
@@ -51,27 +52,47 @@ while [[ $# -gt 0 ]]; do
;;
esac
done
-printf '%s\n' "https://*.edge.example.com:8443" "https://api.example.com:8080" > "$out"
+cat > "$out" <<'JSON'
+{"url":"https://app.example.com","port":"443","status_code":200,"title":"ok","webserver":"nginx","tech":["nginx"]}
+{"url":"http://api.example.com","port":"80","status_code":200,"title":"ok","webserver":"nginx","tech":["nginx"]}
+{"url":"https://edge.example.com:8443","port":"8443","status_code":200,"title":"ok","webserver":"nginx","tech":["nginx"]}
+JSON
SH
chmod +x "$MOCK_BIN/httpx"
run webprobe_full
[ "$status" -eq 0 ]
+ [ -s "webs/webs.txt" ]
+ grep -q "https://app.example.com" "webs/webs.txt"
+ grep -q "http://api.example.com" "webs/webs.txt"
+ ! grep -q "edge.example.com:8443" "webs/webs.txt"
+
[ -s "webs/webs_uncommon_ports.txt" ]
grep -q "https://edge.example.com:8443" "webs/webs_uncommon_ports.txt"
- grep -q "https://api.example.com:8080" "webs/webs_uncommon_ports.txt"
+
+ [ -s "webs/web_full_info.txt" ]
+ grep -q "\"port\":\"443\"" "webs/web_full_info.txt"
+ grep -q "\"port\":\"80\"" "webs/web_full_info.txt"
+ ! grep -q "\"port\":\"8443\"" "webs/web_full_info.txt"
+
+ [ -s "webs/web_full_info_uncommon.txt" ]
+ grep -q "\"port\":\"8443\"" "webs/web_full_info_uncommon.txt"
+
[ -s "webs/webs_all.txt" ]
+ grep -q "https://app.example.com" "webs/webs_all.txt"
+ grep -q "http://api.example.com" "webs/webs_all.txt"
grep -q "https://edge.example.com:8443" "webs/webs_all.txt"
}
-@test "webprobe_full falls back to cached uncommon output when current extraction is empty" {
+@test "webprobe_full passes WEBPROBE_PORTS (including 80 and 443) to httpx command" {
mkdir -p .tmp webs subdomains
printf "a.example.com\n" > subdomains/subdomains.txt
- printf '%s\n' "https://cached.example.com:8443" > webs/web_full_info_uncommon.txt
+ export ARGS_LOG="$TEST_DIR/httpx.args"
cat > "$MOCK_BIN/httpx" <<'SH'
#!/usr/bin/env bash
out=""
+printf '%s\n' "$@" > "$ARGS_LOG"
while [[ $# -gt 0 ]]; do
case "$1" in
-o)
@@ -83,12 +104,40 @@ while [[ $# -gt 0 ]]; do
;;
esac
done
-printf '%s\n' "https://not-in-scope.invalid:8443" > "$out"
+printf '%s\n' '{"url":"https://app.example.com","port":"443","status_code":200,"title":"ok","webserver":"nginx","tech":["nginx"]}' > "$out"
SH
chmod +x "$MOCK_BIN/httpx"
run webprobe_full
[ "$status" -eq 0 ]
- [ -s "webs/webs_uncommon_ports.txt" ]
- grep -q "https://cached.example.com:8443" "webs/webs_uncommon_ports.txt"
+ grep -q "^-p$" "$ARGS_LOG"
+ grep -q "^80,443,8080,8443$" "$ARGS_LOG"
+}
+
+@test "webprobe_full fails when httpx output is not JSON" {
+ mkdir -p .tmp webs subdomains
+ printf "a.example.com\n" > subdomains/subdomains.txt
+
+ cat > "$MOCK_BIN/httpx" <<'SH'
+#!/usr/bin/env bash
+out=""
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -o)
+ out="$2"
+ shift 2
+ ;;
+ *)
+ shift
+ ;;
+ esac
+done
+printf '%s\n' "https://app.example.com" "https://edge.example.com:8443" > "$out"
+SH
+ chmod +x "$MOCK_BIN/httpx"
+
+ run webprobe_full
+ [ "$status" -eq 1 ]
+ [ -f "$called_fn_dir/.status_webprobe_full" ]
+ grep -q "^FAIL$" "$called_fn_dir/.status_webprobe_full"
}
diff --git a/tests/unit/test_webprobe_simple_merge.bats b/tests/unit/test_webprobe_simple_merge.bats
deleted file mode 100644
index b81b1c5..0000000
--- a/tests/unit/test_webprobe_simple_merge.bats
+++ /dev/null
@@ -1,225 +0,0 @@
-#!/usr/bin/env bats
-
-setup() {
- local project_root
- project_root="$(cd "$(dirname "$BATS_TEST_FILENAME")/../.." && pwd)"
- export SCRIPTPATH="$project_root"
- export LOGFILE="/dev/null"
- export bred='' bblue='' bgreen='' byellow='' yellow='' reset=''
-
- export TEST_DIR="$BATS_TEST_TMPDIR/reconftw_webprobe_merge"
- mkdir -p "$TEST_DIR"
- export dir="$TEST_DIR/example.com"
- export called_fn_dir="$dir/.called_fn"
- mkdir -p "$called_fn_dir" "$dir"
- cd "$dir"
-
- export MOCK_BIN="$TEST_DIR/mockbin"
- mkdir -p "$MOCK_BIN"
- export PATH="$MOCK_BIN:$PATH"
- export REAL_SED
- REAL_SED="$(command -v sed)"
-
- source "$project_root/reconftw.sh" --source-only
- export domain="example.com"
- export DIFF=false
- export AXIOM=false
- export WEBPROBESIMPLE=true
- export HTTPX_FLAGS=""
- export HTTPX_THREADS=10
- export HTTPX_RATELIMIT=0
- export HTTPX_TIMEOUT=10
-}
-
-teardown() {
- [[ -d "$TEST_DIR" ]] && rm -rf "$TEST_DIR"
-}
-
-@test "webprobe_simple merges current probe output with prior web_full_info cache" {
- mkdir -p .tmp webs subdomains
- printf "a.example.com\n" > subdomains/subdomains.txt
- printf '%s\n' '{"input":"old","url":"https://old.example.com"}' > .tmp/web_full_info.txt
-
- cat > "$MOCK_BIN/httpx" <<'SH'
-#!/usr/bin/env bash
-out=""
-while [[ $# -gt 0 ]]; do
- case "$1" in
- -o)
- out="$2"
- shift 2
- ;;
- *)
- shift
- ;;
- esac
-done
-printf '%s\n' '{"input":"new","url":"https://new.example.com"}' > "$out"
-SH
- chmod +x "$MOCK_BIN/httpx"
-
- run webprobe_simple
- [ "$status" -eq 0 ]
- [ -s "webs/web_full_info.txt" ]
- grep -q "old.example.com" "webs/web_full_info.txt"
- grep -q "new.example.com" "webs/web_full_info.txt"
-}
-
-@test "webprobe_simple works when prior web_full_info cache is missing" {
- mkdir -p .tmp webs subdomains
- rm -f .tmp/web_full_info.txt
- printf "a.example.com\n" > subdomains/subdomains.txt
-
- cat > "$MOCK_BIN/httpx" <<'SH'
-#!/usr/bin/env bash
-out=""
-while [[ $# -gt 0 ]]; do
- case "$1" in
- -o)
- out="$2"
- shift 2
- ;;
- *)
- shift
- ;;
- esac
-done
-printf '%s\n' '{"input":"new","url":"https://new.example.com"}' > "$out"
-SH
- chmod +x "$MOCK_BIN/httpx"
-
- run webprobe_simple
- [ "$status" -eq 0 ]
- [ -s "webs/web_full_info.txt" ]
- grep -q "new.example.com" "webs/web_full_info.txt"
-}
-
-@test "webprobe_simple falls back when cache contains non-JSON" {
- mkdir -p .tmp webs subdomains
- printf "a.example.com\n" > subdomains/subdomains.txt
- printf '%s\n' 'NOT_JSON' > .tmp/web_full_info.txt
-
- cat > "$MOCK_BIN/httpx" <<'SH'
-#!/usr/bin/env bash
-out=""
-while [[ $# -gt 0 ]]; do
- case "$1" in
- -o)
- out="$2"
- shift 2
- ;;
- *)
- shift
- ;;
- esac
-done
-printf '%s\n' '{"input":"new","url":"https://new.example.com"}' > "$out"
-SH
- chmod +x "$MOCK_BIN/httpx"
-
- run webprobe_simple
- [ "$status" -eq 0 ]
- [ -s "webs/web_full_info.txt" ]
- grep -q "new.example.com" "webs/web_full_info.txt"
- ! grep -q "NOT_JSON" ".tmp/web_full_info.txt"
-}
-
-@test "webprobe_simple promotes URL list output into webs/webs.txt and webs_all" {
- mkdir -p .tmp webs subdomains
- printf "a.example.com\n" > subdomains/subdomains.txt
-
- cat > "$MOCK_BIN/httpx" <<'SH'
-#!/usr/bin/env bash
-out=""
-while [[ $# -gt 0 ]]; do
- case "$1" in
- -o)
- out="$2"
- shift 2
- ;;
- *)
- shift
- ;;
- esac
-done
-printf '%s\n' "https://a.example.com" "https://b.example.com" > "$out"
-SH
- chmod +x "$MOCK_BIN/httpx"
-
- run webprobe_simple
- [ "$status" -eq 0 ]
- [ -s "webs/webs.txt" ]
- grep -q "https://a.example.com" "webs/webs.txt"
- grep -q "https://b.example.com" "webs/webs.txt"
- [ -s "webs/webs_all.txt" ]
- grep -q "https://a.example.com" "webs/webs_all.txt"
- grep -q "https://b.example.com" "webs/webs_all.txt"
-}
-
-@test "webprobe_simple normalizes wildcard hosts from URL-list output" {
- mkdir -p .tmp webs subdomains
- printf "a.example.com\n" > subdomains/subdomains.txt
-
- cat > "$MOCK_BIN/httpx" <<'SH'
-#!/usr/bin/env bash
-out=""
-while [[ $# -gt 0 ]]; do
- case "$1" in
- -o)
- out="$2"
- shift 2
- ;;
- *)
- shift
- ;;
- esac
-done
-printf '%s\n' "https://*.wild.example.com" "https://plain.example.com" > "$out"
-SH
- chmod +x "$MOCK_BIN/httpx"
-
- run webprobe_simple
- [ "$status" -eq 0 ]
- [ -s "webs/webs.txt" ]
- grep -q "https://wild.example.com" "webs/webs.txt"
- grep -q "https://plain.example.com" "webs/webs.txt"
- ! grep -q "https://\\*\\.wild.example.com" "webs/webs.txt"
-}
-
-@test "webprobe_simple remains functional when sed rejects legacy s/*.// pattern" {
- mkdir -p .tmp webs subdomains
- printf "a.example.com\n" > subdomains/subdomains.txt
-
- cat > "$MOCK_BIN/sed" <<SH
-#!/usr/bin/env bash
-if [[ "\$*" == *"s/*.//"* ]]; then
- echo "invalid regex" >&2
- exit 1
-fi
-exec "$REAL_SED" "\$@"
-SH
- chmod +x "$MOCK_BIN/sed"
-
- cat > "$MOCK_BIN/httpx" <<'SH'
-#!/usr/bin/env bash
-out=""
-while [[ $# -gt 0 ]]; do
- case "$1" in
- -o)
- out="$2"
- shift 2
- ;;
- *)
- shift
- ;;
- esac
-done
-printf '%s\n' "https://*.safe.example.com" > "$out"
-SH
- chmod +x "$MOCK_BIN/httpx"
-
- run webprobe_simple
- [ "$status" -eq 0 ]
- [ -s "webs/webs.txt" ]
- grep -q "https://safe.example.com" "webs/webs.txt"
-}