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
Shell bug-bountybugbountybugbounty-tooldnshackingnucleiosintpenetration-testingpentestpentest-toolpentestingreconreconnaissancescannersecuritysecurity-toolssubdomainsubdomain-enumerationvulnerabilities
Fix DNS bf
six2dezec9595ab6ece
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 5730fcb..7aefd8d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Adaptive permutation wordlist: `PERMUTATIONS_WORDLIST_MODE=auto|full|short` with `PERMUTATIONS_SHORT_THRESHOLD=100`. Uses a curated 162-word list for large targets (>100 subs) and the full 849-word list for small targets or DEEP mode.- Auto-detection of DNS resolver: `DNS_RESOLVER=auto|puredns|dnsx`. Two-step heuristic: (1) public local IP → puredns, (2) cloud metadata endpoint (169.254.169.254) → puredns, otherwise → dnsx. Handles cloud VPS with private IPs (AWS, GCP, DO, etc.) correctly. Configurable with `DNSX_THREADS` and `DNSX_RATE_LIMIT`.- Global DNS resolution wrappers `_resolve_domains()` and `_bruteforce_domains()` in `modules/utils.sh` — all 16 puredns call sites now use these wrappers for consistent resolver selection.+- Resolver hardening for subdomain brute/resolve: fail-fast when required resolver files are missing, stricter resolver downloads (`RESOLVER_DOWNLOAD_*`), and optional DNS hard-timeouts (`DNS_BRUTE_TIMEOUT`, `DNS_RESOLVE_TIMEOUT`, where `0` disables timeout) with heartbeat progress (`DNS_HEARTBEAT_INTERVAL_SECONDS`).- Cross-platform local IP detection via `_get_local_ip()` using default route (works on any macOS/Linux interface naming).- DNS permutation benchmark script `benchmark_dns_permutations.sh` for comparing gotator, alterx, and ripgen.- Built-in wordlists and patterns are now vendored in-repo under `data/` (wordlists: `data/wordlists/`, patterns: `data/patterns/`). Config exposes `DATA_DIR`, `WORDLISTS_DIR`, and `PATTERNS_DIR`.diff --git a/README.md b/README.mdindex 47710f5..579956b 100644--- a/README.md+++ b/README.md@@ -433,6 +433,7 @@ The `reconftw.cfg` file controls the entire execution of reconFTW. It allows fin- **Automation & Data**: Control quick rescan heuristics, asset logging, chunk sizes, hotlists, and debug tracing (`QUICK_RESCAN`, `ASSET_STORE`, `CHUNK_LIMIT`, `HOTLIST_TOP`, `SHOW_COMMANDS`).- **Disk & Logging**: Pre-flight disk check (`MIN_DISK_SPACE_GB`), log rotation (`MAX_LOG_FILES`, `MAX_LOG_AGE_DAYS`), structured JSON logging (`STRUCTURED_LOGGING`).- **Caching**: Configure cache expiry for wordlists and resolvers (`CACHE_MAX_AGE_DAYS`).+- **DNS Resolver Safety**: Missing resolver files fail fast, resolver downloads use configurable retry/timeout knobs (`RESOLVER_DOWNLOAD_*`), and DNS brute/resolve timeout defaults to disabled (`DNS_*_TIMEOUT=0`) with heartbeat progress.- **Secrets**: Use `secrets.cfg` for local overrides or environment variables for CI/Docker (see [SECURITY.md](SECURITY.md)).**Example Configuration**:@@ -465,6 +466,10 @@ generate_resolvers=false # Generate custom resolvers with dnsvalidatorupdate_resolvers=true # Fetch and rewrite resolvers from trickest/resolvers before DNS resolutionresolvers_url="https://raw.githubusercontent.com/trickest/resolvers/main/resolvers.txt"resolvers_trusted_url="https://gist.githubusercontent.com/six2dez/ae9ed7e5c786461868abd3f2344401b6/raw/trusted_resolvers.txt"+RESOLVER_DOWNLOAD_CONNECT_TIMEOUT=10 # Seconds to wait for resolver download TCP connection+RESOLVER_DOWNLOAD_MAX_TIME=120 # Hard cap in seconds for resolver downloads+RESOLVER_DOWNLOAD_RETRY=2 # Retry count for resolver downloads+RESOLVER_DOWNLOAD_RETRY_DELAY=2 # Delay in seconds between resolver download retriesfuzzing_remote_list="https://raw.githubusercontent.com/six2dez/OneListForAll/main/onelistforallmicro.txt" # Used to send to axiom(if used) on fuzzingproxy_url="http://127.0.0.1:8080/" # Proxy urlinstall_golang=true # Set it to false if you already have Golang configured and ready@@ -727,6 +732,9 @@ FFUF_MAXTIME=900 # SecondsHTTPX_TIMEOUT=10 # SecondsHTTPX_UNCOMMONPORTS_TIMEOUT=10 # SecondsPERMUTATIONS_LIMIT=21474836480 # Bytes, default is 20 GB+DNS_BRUTE_TIMEOUT=0 # timeout/gtimeout duration for DNS bruteforce (0 disables hard-timeout, e.g. 4h)+DNS_RESOLVE_TIMEOUT=0 # timeout/gtimeout duration for DNS resolve (0 disables hard-timeout, e.g. 6h)+DNS_HEARTBEAT_INTERVAL_SECONDS=20 # Progress heartbeat interval for long DNS jobs# listsfuzz_wordlist=${WORDLISTS_DIR}/fuzz_wordlist.txt@@ -816,10 +824,23 @@ byellow='\033[1;33m'red='\033[0;31m'blue='\033[0;34m'green='\033[0;32m'+cyan='\033[0;36m'yellow='\033[0;33m'reset='\033[0m'```+**DNS resolver guardrails**:++- Missing/empty resolver files now fail fast before DNS brute/resolve starts.+- Resolver downloads are configurable with `RESOLVER_DOWNLOAD_CONNECT_TIMEOUT`, `RESOLVER_DOWNLOAD_MAX_TIME`, `RESOLVER_DOWNLOAD_RETRY`, and `RESOLVER_DOWNLOAD_RETRY_DELAY`.+- `DNS_BRUTE_TIMEOUT=0` and `DNS_RESOLVE_TIMEOUT=0` disable hard-timeout by default (recommended for very large target sets). Heartbeat progress still prints every `DNS_HEARTBEAT_INTERVAL_SECONDS`.++```bash+DNS_BRUTE_TIMEOUT=4h+DNS_RESOLVE_TIMEOUT=6h+DNS_HEARTBEAT_INTERVAL_SECONDS=20+```+**Full Details**: See the [Configuration Guide](https://github.com/six2dez/reconftw/wiki/3.-Configuration-file).---diff --git a/Terraform/files/reconftw.cfg b/Terraform/files/reconftw.cfgindex c1c8d01..4f46ad4 100644--- a/Terraform/files/reconftw.cfg+++ b/Terraform/files/reconftw.cfg@@ -20,6 +20,10 @@ generate_resolvers=false # Generate custom resolvers with dnsvalidatorupdate_resolvers=true # Fetch and rewrite resolvers from trickest/resolvers before DNS resolutionresolvers_url="https://raw.githubusercontent.com/trickest/resolvers/main/resolvers.txt"resolvers_trusted_url="https://gist.githubusercontent.com/six2dez/ae9ed7e5c786461868abd3f2344401b6/raw/trusted_resolvers.txt"+RESOLVER_DOWNLOAD_CONNECT_TIMEOUT=10 # Seconds to wait for resolver download TCP connection+RESOLVER_DOWNLOAD_MAX_TIME=120 # Hard cap in seconds for resolver downloads+RESOLVER_DOWNLOAD_RETRY=2 # Retry count for resolver downloads+RESOLVER_DOWNLOAD_RETRY_DELAY=2 # Delay in seconds between resolver download retriesfuzzing_remote_list="https://raw.githubusercontent.com/six2dez/OneListForAll/main/onelistforallmicro.txt" # Used to send to axiom(if used) on fuzzingproxy_url="http://127.0.0.1:8080/" # Proxy urlinstall_golang=true # Set it to false if you already have Golang configured and ready@@ -196,6 +200,9 @@ HTTPX_TIMEOUT=10 # SecondsHTTPX_UNCOMMONPORTS_TIMEOUT=10 # SecondsPERMUTATIONS_LIMIT=21474836480 # Bytes, default is 20 GBGOWITNESS_TIMEOUT_PER_SITE=20 # Seconds+DNS_BRUTE_TIMEOUT=0 # timeout/gtimeout duration for DNS bruteforce (0 disables hard-timeout, e.g. 4h)+DNS_RESOLVE_TIMEOUT=0 # timeout/gtimeout duration for DNS resolve (0 disables hard-timeout, e.g. 6h)+DNS_HEARTBEAT_INTERVAL_SECONDS=20 # Progress heartbeat interval for long DNS jobs# listsfuzz_wordlist=${WORDLISTS_DIR}/fuzz_wordlist.txtdiff --git a/lib/common.sh b/lib/common.shindex 8917d99..1de3f83 100644--- a/lib/common.sh+++ b/lib/common.sh@@ -295,7 +295,8 @@ print_artifacts() {fireturn 0fi- printf "[INFO] Artifacts: %s\n" "$items"+ _ui_live_break_if_needed+ printf "%bINFO%b Artifacts: %s\n" "${bblue:-}" "${reset:-}" "$items"}# Print a notice line without affecting countersdiff --git a/lib/ui.sh b/lib/ui.shindex 4f3d282..f360125 100644--- a/lib/ui.sh+++ b/lib/ui.sh@@ -324,7 +324,7 @@ ui_module_end() {ui_log_jsonl "INFO" "$module" "Module completed" "artifacts=${files_list}"ui_human_output_enabled || return 0if [[ $# -gt 0 ]]; then- printf " %bOutput:%b %s\n\n" "${bblue:-}" "${reset:-}" "$files_list"+ printf " %bOutput: %s%b\n\n" "${bblue:-}" "$files_list" "${reset:-}"fi_print_module_end "$module"}diff --git a/modules/axiom.sh b/modules/axiom.shindex 8f7f080..0ac153e 100644--- a/modules/axiom.sh+++ b/modules/axiom.sh@@ -14,36 +14,63 @@}function resolvers_update() {+ local need_refresh=false+ local resolvers_stale=false+ local resolvers_trusted_stale=false++ if [[ -s "$resolvers" ]] && [[ -n "$(find "$resolvers" -mtime +1 -print 2>/dev/null)" ]]; then+ resolvers_stale=true+ fi+ if [[ -s "$resolvers_trusted" ]] && [[ -n "$(find "$resolvers_trusted" -mtime +1 -print 2>/dev/null)" ]]; then+ resolvers_trusted_stale=true+ fi+ if [[ ! -s "$resolvers" ]] || [[ ! -s "$resolvers_trusted" ]] || [[ "$resolvers_stale" == true ]] || [[ "$resolvers_trusted_stale" == true ]]; then+ need_refresh=true+ fiif [[ $generate_resolvers == true ]]; thenif [[ $AXIOM != true ]]; then- if [[ ! -s $resolvers ]] || [[ $(find "$resolvers" -mtime +1 -print) ]]; then+ if [[ "$need_refresh" == true ]]; then_print_msg WARN "Resolvers seem older than 1 day. Generating custom resolvers..."{rm -f -- "$resolvers"- run_command dnsvalidator -tL https://public-dns.info/nameservers.txt -threads "$DNSVALIDATOR_THREADS" -o "$resolvers" >/dev/null+ run_command dnsvalidator -tL https://public-dns.info/nameservers.txt -threads "$DNSVALIDATOR_THREADS" -o "$resolvers" >/dev/null || return 1run_command dnsvalidator -tL https://raw.githubusercontent.com/blechschmidt/massdns/master/lists/resolvers.txt -threads "$DNSVALIDATOR_THREADS" -o tmp_resolvers >/dev/null} 2>>"$LOGFILE"[ -s "tmp_resolvers" ] && cat tmp_resolvers | anew -q "$resolvers"[ -s "tmp_resolvers" ] && rm -f tmp_resolvers 2>>"$LOGFILE" >/dev/null- [ ! -s "$resolvers" ] && run_command wget -q -O - "${resolvers_url}" >"$resolvers"- [ ! -s "$resolvers_trusted" ] && run_command wget -q -O - "${resolvers_trusted_url}" >"$resolvers_trusted"+ if [[ ! -s "$resolvers" ]] && ! run_command wget -q -O - "${resolvers_url}" >"$resolvers"; then+ _print_msg WARN "Unable to download resolvers from ${resolvers_url}"+ return 1+ fi+ if [[ ! -s "$resolvers_trusted" ]] && ! run_command wget -q -O - "${resolvers_trusted_url}" >"$resolvers_trusted"; then+ _print_msg WARN "Unable to download trusted resolvers from ${resolvers_trusted_url}"+ return 1+ fi+ if [[ ! -s "$resolvers" ]] || [[ ! -s "$resolvers_trusted" ]]; then+ _print_msg WARN "Resolver files are missing or empty after update"+ return 1+ fi_print_msg OK "Updated resolvers"fielse_print_msg WARN "Checking resolvers lists. Accurate resolvers are key to good results. This may take around 10 minutes if outdated."- run_command axiom-exec "([[ \$(find \"${AXIOM_RESOLVERS_PATH}\" -mtime +1 -print) ]] || [[ \$(wc -l < \"${AXIOM_RESOLVERS_PATH}\") -le 40 ]]) && dnsvalidator -tL https://public-dns.info/nameservers.txt -threads 200 -o ${AXIOM_RESOLVERS_PATH}" &>/dev/null- run_command axiom-exec "wget -q -O - ${resolvers_url} > ${AXIOM_RESOLVERS_PATH}" 2>>"$LOGFILE" >/dev/null- run_command axiom-exec "wget -q -O - ${resolvers_trusted_url} > ${AXIOM_RESOLVERS_TRUSTED_PATH}" 2>>"$LOGFILE" >/dev/null+ run_command axiom-exec "([[ \$(find \"${AXIOM_RESOLVERS_PATH}\" -mtime +1 -print) ]] || [[ \$(wc -l < \"${AXIOM_RESOLVERS_PATH}\") -le 40 ]]) && dnsvalidator -tL https://public-dns.info/nameservers.txt -threads 200 -o ${AXIOM_RESOLVERS_PATH}" &>/dev/null || return 1+ run_command axiom-exec "wget -q -O - ${resolvers_url} > ${AXIOM_RESOLVERS_PATH}" 2>>"$LOGFILE" >/dev/null || return 1+ run_command axiom-exec "wget -q -O - ${resolvers_trusted_url} > ${AXIOM_RESOLVERS_TRUSTED_PATH}" 2>>"$LOGFILE" >/dev/null || return 1_print_msg OK "Updated resolvers"figenerate_resolvers=falseelse- if [[ ! -s $resolvers ]] || [[ $(find "$resolvers" -mtime +1 -print) ]]; then+ if [[ "$need_refresh" == true ]]; then_print_msg WARN "Resolvers seem older than 1 day. Downloading new resolvers..."- cached_download_typed "${resolvers_url}" "$resolvers" "resolvers.txt" "resolvers"- cached_download_typed "${resolvers_trusted_url}" "$resolvers_trusted" "resolvers_trusted.txt" "resolvers"+ cached_download_typed "${resolvers_url}" "$resolvers" "resolvers.txt" "resolvers" || return 1+ cached_download_typed "${resolvers_trusted_url}" "$resolvers_trusted" "resolvers_trusted.txt" "resolvers" || return 1+ if [[ ! -s "$resolvers" ]] || [[ ! -s "$resolvers_trusted" ]]; then+ _print_msg WARN "Resolver files are missing or empty after update"+ return 1+ fi_print_msg OK "Resolvers updated"fifidiff --git a/modules/utils.sh b/modules/utils.shindex ce27ccd..d7d4aed 100644--- a/modules/utils.sh+++ b/modules/utils.sh@@ -853,6 +853,7 @@ function cached_download_typed() {local cache_name="${3:-$(basename "$url")}"local cache_type="${4:-tools}"local cache_file="$CACHE_DIR/$cache_type/$cache_name"+ local -a curl_cmdcache_init@@ -867,7 +868,20 @@ function cached_download_typed() {printf "%b[%s] Downloading: %s%b\n" \"$bblue" "$(date +'%Y-%m-%d %H:%M:%S')" "$(basename "$url")" "$reset"- if run_command curl -sL "$url" -o "$destination"; then+ curl_cmd=(curl -sL "$url" -o "$destination")+ if [[ "$cache_type" == "resolvers" ]]; then+ curl_cmd=(+ curl -fsSL+ --connect-timeout "${RESOLVER_DOWNLOAD_CONNECT_TIMEOUT:-10}"+ --max-time "${RESOLVER_DOWNLOAD_MAX_TIME:-120}"+ --retry "${RESOLVER_DOWNLOAD_RETRY:-2}"+ --retry-delay "${RESOLVER_DOWNLOAD_RETRY_DELAY:-2}"+ --retry-connrefused+ "$url" -o "$destination"+ )+ fi++ if run_command "${curl_cmd[@]}"; then# Save to cache for future usecp "$destination" "$cache_file"printf "%b[%s] Cached for future use: %s%b\n" \@@ -1255,6 +1269,68 @@ _select_dns_resolver() {esac}+# Return 0 when timeout should be enforced, 1 when disabled.+# Usage: _dns_timeout_enabled <timeout_value>+_dns_timeout_enabled() {+ case "${1:-0}" in+ "" | 0 | 0s | 0m | 0h | 0d) return 1 ;;+ *) return 0 ;;+ esac+}++# Ensure resolver files required by the selected resolver mode are present.+# Usage: _ensure_dns_resolver_files <dnsx|puredns>+_ensure_dns_resolver_files() {+ local resolver_mode="$1"++ case "$resolver_mode" in+ dnsx)+ if [[ ! -s "$resolvers_trusted" ]]; then+ print_errorf "Missing required trusted resolvers file for dnsx: %s" "$resolvers_trusted"+ return 1+ fi+ ;;+ puredns)+ if [[ ! -s "$resolvers" ]]; then+ print_errorf "Missing required resolvers file for puredns: %s" "$resolvers"+ return 1+ fi+ if [[ ! -s "$resolvers_trusted" ]]; then+ print_errorf "Missing required trusted resolvers file for puredns: %s" "$resolvers_trusted"+ return 1+ fi+ ;;+ *)+ print_errorf "Unsupported DNS resolver mode: %s" "$resolver_mode"+ return 1+ ;;+ esac++ return 0+}++# Execute DNS command with heartbeat and optional hard-timeout.+# Usage: _run_dns_with_heartbeat <label> <timeout_value> <command...>+_run_dns_with_heartbeat() {+ local label="$1"+ local timeout_value="$2"+ shift 2++ local heartbeat_interval="${DNS_HEARTBEAT_INTERVAL_SECONDS:-20}"+ [[ "$heartbeat_interval" =~ ^[0-9]+$ ]] || heartbeat_interval=20++ if _dns_timeout_enabled "$timeout_value"; then+ if [[ -n "${TIMEOUT_CMD:-}" ]]; then+ run_with_heartbeat "$label" "$heartbeat_interval" "$TIMEOUT_CMD" -k 10s "$timeout_value" "$@"+ else+ warn_once "dns-timeout-command-missing" "DNS timeout requested but timeout command is unavailable; continuing without hard timeout."+ run_with_heartbeat "$label" "$heartbeat_interval" "$@"+ fi+ else+ run_with_heartbeat "$label" "$heartbeat_interval" "$@"+ fi+}+# Resolve a list of domains using the auto-selected resolver.# Usage: _resolve_domains <input_file> <output_file># Replaces all direct puredns resolve calls for consistent NAT-safe behavior.@@ -1264,18 +1340,31 @@ _resolve_domains() {local resolverresolver=$(_select_dns_resolver)+ _ensure_dns_resolver_files "$resolver" || return 1+if [[ "$resolver" == "dnsx" ]]; then- run_command dnsx -l "$input_file" -silent -retry 2 \+ local raw_output_file="${output_file}.dnsx.raw"+ if ! _run_dns_with_heartbeat "dns resolve (${resolver})" "${DNS_RESOLVE_TIMEOUT:-0}" \+ dnsx -l "$input_file" -silent -retry 2 \-t "${DNSX_THREADS:-25}" -rl "${DNSX_RATE_LIMIT:-100}" \- -r "$resolvers_trusted" -wt 5 2>>"$LOGFILE" \- | cut -d' ' -f1 | sort -u > "$output_file"+ -r "$resolvers_trusted" -wt 5 -o "$raw_output_file"; then+ rm -f "$raw_output_file" 2>/dev/null || true+ return 1+ fi+ if [[ -s "$raw_output_file" ]]; then+ cut -d' ' -f1 "$raw_output_file" | sort -u >"$output_file"+ else+ : >"$output_file"+ fi+ rm -f "$raw_output_file" 2>/dev/null || trueelse- run_command puredns resolve "$input_file" -w "$output_file" \+ _run_dns_with_heartbeat "dns resolve (${resolver})" "${DNS_RESOLVE_TIMEOUT:-0}" \+ puredns resolve "$input_file" -w "$output_file" \-r "$resolvers" --resolvers-trusted "$resolvers_trusted" \-l "$PUREDNS_PUBLIC_LIMIT" --rate-limit-trusted "$PUREDNS_TRUSTED_LIMIT" \--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" \--wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \- 2>>"$LOGFILE" >/dev/null+ || return 1fi}@@ -1295,17 +1384,30 @@ _bruteforce_domains() {local resolverresolver=$(_select_dns_resolver)+ _ensure_dns_resolver_files "$resolver" || return 1+if [[ "$resolver" == "dnsx" ]]; then- run_command dnsx -d "$target_domain" -w "$wordlist" -silent -retry 2 \+ local raw_output_file="${output_file}.dnsx.raw"+ if ! _run_dns_with_heartbeat "dns bruteforce (${resolver})" "${DNS_BRUTE_TIMEOUT:-0}" \+ dnsx -d "$target_domain" -w "$wordlist" -silent -retry 2 \-t "${DNSX_THREADS:-25}" -rl "${DNSX_RATE_LIMIT:-100}" \- -r "$resolvers_trusted" -wt 5 2>>"$LOGFILE" \- | cut -d' ' -f1 | sort -u > "$output_file"+ -r "$resolvers_trusted" -wt 5 -o "$raw_output_file"; then+ rm -f "$raw_output_file" 2>/dev/null || true+ return 1+ fi+ if [[ -s "$raw_output_file" ]]; then+ cut -d' ' -f1 "$raw_output_file" | sort -u >"$output_file"+ else+ : >"$output_file"+ fi+ rm -f "$raw_output_file" 2>/dev/null || trueelse- run_command puredns bruteforce "$wordlist" "$target_domain" \+ _run_dns_with_heartbeat "dns bruteforce (${resolver})" "${DNS_BRUTE_TIMEOUT:-0}" \+ puredns bruteforce "$wordlist" "$target_domain" \-w "$output_file" -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \-l "$PUREDNS_PUBLIC_LIMIT" --rate-limit-trusted "$PUREDNS_TRUSTED_LIMIT" \--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" \--wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \- 2>>"$LOGFILE" >/dev/null+ || return 1fi}diff --git a/reconftw.cfg b/reconftw.cfgindex 3284a2f..3b4357f 100644--- a/reconftw.cfg+++ b/reconftw.cfg@@ -25,6 +25,10 @@ generate_resolvers=false # Generate custom resolvers with dnsvalidatorupdate_resolvers=true # Fetch and rewrite resolvers from trickest/resolvers before DNS resolutionresolvers_url="https://raw.githubusercontent.com/trickest/resolvers/main/resolvers.txt"resolvers_trusted_url="https://gist.githubusercontent.com/six2dez/ae9ed7e5c786461868abd3f2344401b6/raw/trusted_resolvers.txt"+RESOLVER_DOWNLOAD_CONNECT_TIMEOUT=10 # Seconds to wait for resolver download TCP connection+RESOLVER_DOWNLOAD_MAX_TIME=120 # Hard cap in seconds for resolver downloads+RESOLVER_DOWNLOAD_RETRY=2 # Retry count for resolver downloads+RESOLVER_DOWNLOAD_RETRY_DELAY=2 # Delay in seconds between resolver download retriesfuzzing_remote_list="https://raw.githubusercontent.com/six2dez/OneListForAll/main/onelistforallmicro.txt" # Used to send to axiom(if used) on fuzzingproxy_url="http://127.0.0.1:8080/" # Proxy urlinstall_golang=true # Set it to false if you already have Golang configured and ready@@ -347,6 +351,9 @@ FFUF_MAXTIME=900 # SecondsHTTPX_TIMEOUT=10 # SecondsHTTPX_UNCOMMONPORTS_TIMEOUT=10 # SecondsPERMUTATIONS_LIMIT=21474836480 # Bytes, default is 20 GB+DNS_BRUTE_TIMEOUT=0 # timeout/gtimeout duration for DNS bruteforce (0 disables hard-timeout, e.g. 4h)+DNS_RESOLVE_TIMEOUT=0 # timeout/gtimeout duration for DNS resolve (0 disables hard-timeout, e.g. 6h)+DNS_HEARTBEAT_INTERVAL_SECONDS=20 # Progress heartbeat interval for long DNS jobs# listsfuzz_wordlist=${WORDLISTS_DIR}/fuzz_wordlist.txt@@ -435,5 +442,6 @@ byellow='\033[1;33m'red='\033[0;31m'blue='\033[0;34m'green='\033[0;32m'+cyan='\033[0;36m'yellow='\033[0;33m'reset='\033[0m'diff --git a/tests/unit/test_common.bats b/tests/unit/test_common.batsindex 31d2eb8..a4265d3 100644--- a/tests/unit/test_common.bats+++ b/tests/unit/test_common.bats@@ -186,6 +186,33 @@ EOF[[ "$output" == *"SKIP"* ]]}+###############################################################################+# output formatting tests+###############################################################################++@test "print_artifacts uses INFO Artifacts format without brackets" {+ OUTPUT_VERBOSITY=1+ bblue="<BLUE>"+ reset="<RESET>"++ run print_artifacts "osint/, subdomains/"+ [ "$status" -eq 0 ]+ [[ "$output" == *"<BLUE>INFO<RESET> Artifacts: osint/, subdomains/"* ]]+ [[ "$output" != *"[INFO] Artifacts"* ]]+}++@test "print_notice RUN uses cyan color for state" {+ OUTPUT_VERBOSITY=1+ cyan="<CYAN>"+ reset="<RESET>"++ run print_notice RUN "sub_brute" "bruteforcing subdomains"+ [ "$status" -eq 0 ]+ [[ "$output" == *"<CYAN>RUN <RESET>"* ]]+ [[ "$output" == *"sub_brute"* ]]+ [[ "$output" == *"(bruteforcing subdomains)"* ]]+}+################################################################################ run_tool tests###############################################################################diff --git a/tests/unit/test_resolvers_hardening.bats b/tests/unit/test_resolvers_hardening.batsnew file mode 100644index 0000000..dad3cad--- /dev/null+++ b/tests/unit/test_resolvers_hardening.bats@@ -0,0 +1,198 @@+#!/usr/bin/env bats++setup() {+ local project_root+ project_root="$(cd "$(dirname "$BATS_TEST_FILENAME")/../.." && pwd)"++ TEST_DIR="$(mktemp -d)"+ export TEST_DIR+ MOCK_BIN="${TEST_DIR}/mockbin"+ ORIG_PATH="$PATH"+ mkdir -p "$MOCK_BIN"++ export PATH="${MOCK_BIN}:$ORIG_PATH"+ export SCRIPTPATH="$project_root"+ export LOGFILE="${TEST_DIR}/test.log"+ export bred='' bblue='' bgreen='' byellow='' yellow='' reset=''+ export NOTIFICATION=false+ export OUTPUT_VERBOSITY=1+ export AXIOM=false+ export generate_resolvers=false+ export update_resolvers=true+ export DNS_RESOLVER_SELECTED=""+ export CACHE_DIR="${TEST_DIR}/cache"+ export tools="${TEST_DIR}/tools"+ export resolvers="${TEST_DIR}/resolvers.txt"+ export resolvers_trusted="${TEST_DIR}/resolvers_trusted.txt"+ export DNS_HEARTBEAT_INTERVAL_SECONDS=20+ export DNS_BRUTE_TIMEOUT=0+ export DNS_RESOLVE_TIMEOUT=0+ export TIMEOUT_CMD="timeout"++ mkdir -p "$tools"+ : >"$LOGFILE"++ # shellcheck source=/dev/null+ source "$project_root/reconftw.cfg" 2>/dev/null || true+ # shellcheck source=/dev/null+ source "$project_root/reconftw.sh" --source-only+}++teardown() {+ PATH="$ORIG_PATH"+ cd /+ rm -rf "$TEST_DIR"+}++@test "resolvers_update refreshes when resolvers_trusted is missing" {+ printf '1.1.1.1\n' >"$resolvers"+ rm -f "$resolvers_trusted"++ cached_download_typed() {+ printf '%s -> %s\n' "$1" "$2" >>"${TEST_DIR}/download_calls.log"+ printf '1.1.1.1\n' >"$2"+ return 0+ }++ run resolvers_update++ [ "$status" -eq 0 ]+ [ -s "$resolvers_trusted" ]+ grep -Fq "$resolvers_trusted_url" "${TEST_DIR}/download_calls.log"+}++@test "resolvers_update fails fast when resolver download fails" {+ rm -f "$resolvers" "$resolvers_trusted"++ cached_download_typed() {+ return 1+ }++ run resolvers_update++ [ "$status" -ne 0 ]+ [[ "$output" != *"Resolvers updated"* ]]+}++@test "cached_download_typed uses strict curl flags for resolvers cache type" {+ cat >"${MOCK_BIN}/curl" <<'EOF'+#!/usr/bin/env bash+set -euo pipefail+printf '%s\n' "$*" > "${TEST_DIR}/curl_args.log"+output_file=""+while [[ $# -gt 0 ]]; do+ case "$1" in+ -o)+ output_file="$2"+ shift 2+ ;;+ *)+ shift+ ;;+ esac+done+printf '8.8.8.8\n' > "$output_file"+EOF+ chmod +x "${MOCK_BIN}/curl"++ run cached_download_typed "https://example.com/resolvers.txt" "${TEST_DIR}/out_resolvers.txt" "resolvers.txt" "resolvers"++ [ "$status" -eq 0 ]+ [ -s "${TEST_DIR}/out_resolvers.txt" ]+ grep -q -- "--connect-timeout 10" "${TEST_DIR}/curl_args.log"+ grep -q -- "--max-time 120" "${TEST_DIR}/curl_args.log"+ grep -q -- "--retry 2" "${TEST_DIR}/curl_args.log"+ grep -q -- "--retry-delay 2" "${TEST_DIR}/curl_args.log"+ grep -q -- "--retry-connrefused" "${TEST_DIR}/curl_args.log"+}++@test "_bruteforce_domains fails fast when required resolver files are missing" {+ export DNS_RESOLVER="puredns"+ rm -f "$resolvers" "$resolvers_trusted"+ printf 'www\napi\n' > "${TEST_DIR}/words.txt"++ cat >"${MOCK_BIN}/puredns" <<'EOF'+#!/usr/bin/env bash+touch "${TEST_DIR}/puredns_called"+exit 0+EOF+ chmod +x "${MOCK_BIN}/puredns"++ run _bruteforce_domains "${TEST_DIR}/words.txt" "example.com" "${TEST_DIR}/brute_out.txt"++ [ "$status" -ne 0 ]+ [ ! -f "${TEST_DIR}/puredns_called" ]+}++@test "_resolve_domains fails fast for dnsx when trusted resolvers file is missing" {+ export DNS_RESOLVER="dnsx"+ printf '1.1.1.1\n' > "$resolvers"+ rm -f "$resolvers_trusted"+ printf 'example.com\n' > "${TEST_DIR}/resolve_in.txt"++ cat >"${MOCK_BIN}/dnsx" <<'EOF'+#!/usr/bin/env bash+touch "${TEST_DIR}/dnsx_called"+exit 0+EOF+ chmod +x "${MOCK_BIN}/dnsx"++ run _resolve_domains "${TEST_DIR}/resolve_in.txt" "${TEST_DIR}/resolve_out.txt"++ [ "$status" -ne 0 ]+ [ ! -f "${TEST_DIR}/dnsx_called" ]+}++@test "_bruteforce_domains uses heartbeat path and skips timeout wrapper when DNS_BRUTE_TIMEOUT=0" {+ export DNS_RESOLVER="puredns"+ export DNS_BRUTE_TIMEOUT=0+ export DNS_HEARTBEAT_INTERVAL_SECONDS=17+ printf '1.1.1.1\n' > "$resolvers"+ printf '1.1.1.1\n' > "$resolvers_trusted"+ printf 'www\n' > "${TEST_DIR}/words.txt"++ run_with_heartbeat() {+ local label="$1"+ shift+ printf '%s\n' "$label" > "${TEST_DIR}/heartbeat_label.log"+ if [[ "${1:-}" =~ ^[0-9]+$ ]]; then+ printf '%s\n' "$1" > "${TEST_DIR}/heartbeat_interval.log"+ shift+ fi+ "$@"+ }++ cat >"${MOCK_BIN}/timeout" <<'EOF'+#!/usr/bin/env bash+touch "${TEST_DIR}/timeout_called"+exit 0+EOF+ chmod +x "${MOCK_BIN}/timeout"++ cat >"${MOCK_BIN}/puredns" <<'EOF'+#!/usr/bin/env bash+set -euo pipefail+output_file=""+while [[ $# -gt 0 ]]; do+ case "$1" in+ -w)+ output_file="$2"+ shift 2+ ;;+ *)+ shift+ ;;+ esac+done+printf 'dev.example.com\n' > "$output_file"+EOF+ chmod +x "${MOCK_BIN}/puredns"++ run _bruteforce_domains "${TEST_DIR}/words.txt" "example.com" "${TEST_DIR}/brute_out.txt"++ [ "$status" -eq 0 ]+ [ -f "${TEST_DIR}/heartbeat_label.log" ]+ [ -f "${TEST_DIR}/heartbeat_interval.log" ]+ [ "$(cat "${TEST_DIR}/heartbeat_interval.log")" = "17" ]+ [ ! -f "${TEST_DIR}/timeout_called" ]+}