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

Improved dry-run mode

six2dez8253ffb77b7e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0129a4e..69175e9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -128,6 +128,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Passive mode no longer runs `webprobe_simple`/`webprobe_full`.
- Missing `webs/webs_new.txt` now handled safely.
+**Dry-Run Mode**
+- Wrapped 83 unwrapped command executions across all modules to respect `DRY_RUN` flag:
+ - `osint.sh`: 24 commands (whois, dig, curl APIs, gitdorks_go, enumerepo, porch-pirate, misconfig-mapper, exiftool, interlace git clone, Python tools: dorks_hunter, metagoofil, SwaggerSpy, EmailHarvester, LeakSearch, msftrecon, Scopify, Spoofy)
+ - `subdomains.sh`: 15 commands (asnmap, dig zone transfer, curl APIs, hakip2host, csprecon, regulator, cloud enumeration)
+ - `web.sh`: 20 commands (fav-up, grpcurl, CMSeeK, JSA, getjswords, jsluice, wget, interlace/ffuf, curl WebSocket, pydictor)
+ - `vulns.sh`: 5 commands (Corsy, Oralyzer, interlace/ffuf LFI, interlace/ffuf SSTI, interlace/ghauri SQLi)
+ - `core.sh`: 8 commands (tar/curl uploads, Telegram/Discord/Slack notifications, connectivity checks)
+ - `modes.sh`: 8 commands (faraday-cli reporting)
+ - `axiom.sh`: 3 commands (hakip2host, mapcidr)
+- Added module-level dry-run command tracking and summaries in `lib/ui.sh`:
+ - `ui_dryrun_track()`: Records commands during dry-run execution
+ - `ui_dryrun_summary()`: Displays count + unique tool names at module completion
+ - `ui_dryrun_reset()`: Clears tracking at module boundaries
+- Dry-run summaries now show:
+ - Normal mode: `[DRY-RUN] Would execute N commands: tool1, tool2, ...`
+ - Verbose mode: Full command list with normalized single-line formatting
+ - Quiet mode: No dry-run output
+- Module lifecycle hooks (`_print_module_start()`, `_print_module_end()`) now reset and display dry-run summaries automatically
+- Command normalization removes newlines/extra whitespace from multi-line command strings for cleaner display
+- Dry-run command previews now redact sensitive CLI values (for example `-token-string`, API keys, and bearer tokens).
+- Dry-run in parallel mode now aggregates commands emitted from child subshells, so module summaries reflect full command volume.
+- Dry-run no longer produces noisy parser/file errors in guarded paths (`apileaks`, `sub_crt`, `prototype_pollution`, `fuzzparams`, `sub_tls`, `sub_permut`, `urlchecks`).
+- `test_ssl` now respects `run_command`, preventing real execution during dry-run.
+- `sub_asn` now applies timeout fencing with kill semantics (`-k`) when timeout tooling is available and reports non-OK outcomes correctly.
+- `subdomains` finalization now safely creates missing incremental files before counting to avoid stderr noise.
+
+**Parallel Execution and Status Reporting**
+- Parallel aggregation now preserves per-function final badges (`OK/WARN/FAIL/SKIP/CACHE`) from module functions/subfunctions instead of inferring only from process exit code.
+- Parallel batch summary lines now expose real counters for `ok/warn/fail/skip/cache`.
+- Cache/skip messaging was normalized to avoid unformatted "already processed" lines and keep status output consistent.
+
### Added
- `--no-banner` to disable banner output (banner is on by default).
diff --git a/lib/common.sh b/lib/common.sh
index 42242f9..6780dbc 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -254,6 +254,12 @@ _print_module_start() {
local title="${1^^}"
local ts
ts=$(date +'%Y-%m-%d %H:%M:%S')
+
+ # Reset dry-run tracking for new module
+ if declare -F ui_dryrun_reset >/dev/null 2>&1; then
+ ui_dryrun_reset
+ fi
+
printf "\n%b── %s ───────────────────────────────────────────────────────────────%b\n" \
"${bgreen:-}" "$title" "${reset:-}"
printf "Started: %s\n" "$ts"
@@ -266,6 +272,12 @@ _print_module_end() {
local title="${1^^}"
local ts
ts=$(date +'%Y-%m-%d %H:%M:%S')
+
+ # Show dry-run summary before completion timestamp
+ if declare -F ui_dryrun_summary >/dev/null 2>&1; then
+ ui_dryrun_summary
+ fi
+
printf "Completed: %s\n" "$ts"
}
@@ -357,9 +369,10 @@ skip_notification() {
if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
_print_status "$badge" "$func_name" "0s"
if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
- printf " %s\n" "$reason"
- if [[ "$reason" == "already processed" ]]; then
- printf " To force re-run, delete: %s/.%s\n" "${called_fn_dir:-.}" "$func_name"
+ if [[ "$badge" == "CACHE" ]]; then
+ _print_msg INFO "${func_name} already processed. To force re-run, delete: ${called_fn_dir:-.}/.${func_name}"
+ else
+ _print_msg INFO "${func_name} skipped: ${reason}"
fi
fi
fi
@@ -415,17 +428,25 @@ skip_if_processed() {
run_tool() {
local name="$1"
shift
-
+
if [[ ${DRY_RUN:-false} == true ]]; then
- printf "%b[DRY-RUN] Would execute: %s %s%b\n" "${cyan:-}" "$name" "$*" "${reset:-}"
+ local full_cmd="$name $*"
+
+ # Track command for module summary
+ if declare -F ui_dryrun_track >/dev/null 2>&1; then
+ ui_dryrun_track "$name" "$full_cmd"
+ else
+ # Fallback to old behavior if ui_dryrun_track not available
+ printf "%b[DRY-RUN] Would execute: %s %s%b\n" "${cyan:-}" "$name" "$*" "${reset:-}"
+ fi
return 0
fi
-
+
# Log the command if LOGFILE is set
if [[ -n "${LOGFILE:-}" ]]; then
echo "[$(date +'%Y-%m-%d %H:%M:%S')] Running: $name $*" >> "$LOGFILE"
fi
-
+
"$@"
}
diff --git a/lib/parallel.sh b/lib/parallel.sh
index c8906ea..b57284e 100644
--- a/lib/parallel.sh
+++ b/lib/parallel.sh
@@ -15,6 +15,7 @@ PARALLEL_MAX_JOBS="${PARALLEL_MAX_JOBS:-4}"
# Track running PIDs for cleanup
declare -a _PARALLEL_PIDS=()
+_PARALLEL_LAST_BADGE=""
_parallel_effective_max_jobs() {
local requested="${1:-$PARALLEL_MAX_JOBS}"
@@ -77,9 +78,11 @@ _parallel_emit_job_output() {
local skip_marker=""
local cache_marker=""
+ local status_marker=""
if [[ -n "${called_fn_dir:-}" ]]; then
skip_marker="${called_fn_dir}/.skip_${func_name}"
cache_marker="${called_fn_dir}/.cache_${func_name}"
+ status_marker="${called_fn_dir}/.status_${func_name}"
fi
local badge=""
@@ -89,12 +92,22 @@ _parallel_emit_job_output() {
elif [[ -n "$skip_marker" && -f "$skip_marker" ]]; then
badge="SKIP"
rm -f "$skip_marker" 2>/dev/null || true
+ elif [[ -n "$status_marker" && -f "$status_marker" ]]; then
+ badge=$(head -n 1 "$status_marker" 2>/dev/null | tr -d '\r\n' | tr '[:lower:]' '[:upper:]')
+ case "$badge" in
+ OK|WARN|FAIL|SKIP|CACHE|INFO) ;;
+ *) badge="" ;;
+ esac
+ rm -f "$status_marker" 2>/dev/null || true
elif [[ "$rc" -eq 0 ]]; then
badge="OK"
else
badge="FAIL"
fi
+ [[ -z "$badge" ]] && badge=$([[ "$rc" -eq 0 ]] && echo "OK" || echo "FAIL")
+ _PARALLEL_LAST_BADGE="$badge"
+
# In quiet mode (OUTPUT_VERBOSITY==0), only show failures
if [[ "${OUTPUT_VERBOSITY:-1}" -eq 0 ]] && [[ "$badge" != "FAIL" ]]; then
return 0
@@ -154,9 +167,12 @@ _parallel_emit_job_output() {
# Print a summary line for a completed batch
# Usage: _parallel_batch_summary total_jobs failed_count batch_start_ts
_parallel_batch_summary() {
- local total="$1"
- local failed="$2"
- local batch_start="$3"
+ local ok="$1"
+ local warn="$2"
+ local fail="$3"
+ local skip="$4"
+ local cache="$5"
+ local batch_start="$6"
local batch_end
batch_end=$(date +%s)
local elapsed=$((batch_end - batch_start))
@@ -167,10 +183,10 @@ _parallel_batch_summary() {
[[ "${PARALLEL_LOG_MODE:-summary}" == "summary" ]] && [[ "${OUTPUT_VERBOSITY:-1}" -lt 2 ]] && return 0
if declare -F ui_batch_end >/dev/null 2>&1; then
- local ok_count=$((total - failed))
- ui_batch_end "$ok_count" 0 "$failed" "$elapsed"
+ ui_batch_end "$ok" "$warn" "$fail" "$elapsed" "$skip" "$cache"
else
- printf " --- batch: %d jobs, %d failed, %ds elapsed ---\n" "$total" "$failed" "$elapsed"
+ printf " --- batch: ok:%d warn:%d fail:%d skip:%d cache:%d, %ds elapsed ---\n" \
+ "$ok" "$warn" "$fail" "$skip" "$cache" "$elapsed"
fi
}
@@ -281,7 +297,8 @@ parallel_funcs() {
local queue_count=$((total_funcs - queued_count))
_parallel_snapshot "$active_list" "$done_list" "$queue_count"
fi
- local idx rc batch_failed=0
+ local idx rc
+ local batch_ok=0 batch_warn=0 batch_fail=0 batch_skip=0 batch_cache=0
for idx in "${!batch_pids[@]}"; do
if wait "${batch_pids[$idx]}" 2>/dev/null; then
rc=0
@@ -291,6 +308,14 @@ parallel_funcs() {
local job_end_ts
job_end_ts=$(date +%s)
_parallel_emit_job_output "${batch_funcs[$idx]}" "${batch_logs[$idx]}" "$rc" "${batch_starts[$idx]}" "$job_end_ts"
+ case "${_PARALLEL_LAST_BADGE:-OK}" in
+ OK) ((batch_ok++)) ;;
+ WARN) ((batch_warn++)) ;;
+ FAIL) ((batch_fail++)); ((failed++)) ;;
+ SKIP) ((batch_skip++)) ;;
+ CACHE) ((batch_cache++)) ;;
+ *) ((batch_ok++)) ;;
+ esac
local job_dur=$((job_end_ts - batch_starts[$idx]))
local dur_fmt
dur_fmt=$(format_duration "$job_dur")
@@ -300,13 +325,9 @@ parallel_funcs() {
done_list="${done_list}, ${batch_funcs[$idx]} ${dur_fmt}"
fi
[[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%b[*] Finished %s (PID: %s, rc=%s)%b\n" "${cyan:-}" "${batch_funcs[$idx]}" "${batch_pids[$idx]}" "$rc" "${reset:-}"
- if [[ $rc -ne 0 ]]; then
- ((failed++))
- ((batch_failed++))
- fi
rm -f "${batch_logs[$idx]}" 2>/dev/null || true
done
- _parallel_batch_summary "${#batch_pids[@]}" "$batch_failed" "$batch_start_ts"
+ _parallel_batch_summary "$batch_ok" "$batch_warn" "$batch_fail" "$batch_skip" "$batch_cache" "$batch_start_ts"
if [[ "${PARALLEL_MODE:-true}" == "true" ]]; then
local queue_count=$((total_funcs - queued_count))
_parallel_snapshot "none" "$done_list" "$queue_count"
@@ -330,7 +351,8 @@ parallel_funcs() {
local queue_count=$((total_funcs - queued_count))
_parallel_snapshot "$active_list" "$done_list" "$queue_count"
fi
- local idx rc batch_failed=0
+ local idx rc
+ local batch_ok=0 batch_warn=0 batch_fail=0 batch_skip=0 batch_cache=0
for idx in "${!batch_pids[@]}"; do
if wait "${batch_pids[$idx]}" 2>/dev/null; then
rc=0
@@ -340,6 +362,14 @@ parallel_funcs() {
local job_end_ts
job_end_ts=$(date +%s)
_parallel_emit_job_output "${batch_funcs[$idx]}" "${batch_logs[$idx]}" "$rc" "${batch_starts[$idx]}" "$job_end_ts"
+ case "${_PARALLEL_LAST_BADGE:-OK}" in
+ OK) ((batch_ok++)) ;;
+ WARN) ((batch_warn++)) ;;
+ FAIL) ((batch_fail++)); ((failed++)) ;;
+ SKIP) ((batch_skip++)) ;;
+ CACHE) ((batch_cache++)) ;;
+ *) ((batch_ok++)) ;;
+ esac
local job_dur=$((job_end_ts - batch_starts[$idx]))
local dur_fmt
dur_fmt=$(format_duration "$job_dur")
@@ -349,13 +379,9 @@ parallel_funcs() {
done_list="${done_list}, ${batch_funcs[$idx]} ${dur_fmt}"
fi
[[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%b[*] Finished %s (PID: %s, rc=%s)%b\n" "${cyan:-}" "${batch_funcs[$idx]}" "${batch_pids[$idx]}" "$rc" "${reset:-}"
- if [[ $rc -ne 0 ]]; then
- ((failed++))
- ((batch_failed++))
- fi
rm -f "${batch_logs[$idx]}" 2>/dev/null || true
done
- _parallel_batch_summary "${#batch_pids[@]}" "$batch_failed" "$batch_start_ts"
+ _parallel_batch_summary "$batch_ok" "$batch_warn" "$batch_fail" "$batch_skip" "$batch_cache" "$batch_start_ts"
if [[ "${PARALLEL_MODE:-true}" == "true" ]]; then
_parallel_snapshot "none" "$done_list" "0"
fi
diff --git a/lib/ui.sh b/lib/ui.sh
index 5066015..d5ba27a 100644
--- a/lib/ui.sh
+++ b/lib/ui.sh
@@ -16,6 +16,12 @@ _UI_FAIL_COUNT=0
_UI_SKIP_COUNT=0
_UI_CACHE_COUNT=0
+# Dry-run tracking
+_UI_DRYRUN_COUNT=0
+_UI_DRYRUN_COMMANDS=()
+_UI_DRYRUN_FULL_COMMANDS=()
+_UI_DRYRUN_SHARED_FILE=""
+
ui_init() {
# TTY detection
if [[ -t 1 ]]; then
@@ -151,8 +157,9 @@ ui_batch_row() {
ui_batch_end() {
local ok="$1" warn="$2" fail="$3" elapsed="$4"
- printf " %b── ok:%d warn:%d fail:%d │ %ds elapsed ──%b\n" \
- "${bgreen:-}" "$ok" "$warn" "$fail" "$elapsed" "${reset:-}"
+ local skip="${5:-0}" cache="${6:-0}"
+ printf " %b── ok:%d warn:%d fail:%d skip:%d cache:%d │ %ds elapsed ──%b\n" \
+ "${bgreen:-}" "$ok" "$warn" "$fail" "$skip" "$cache" "$elapsed" "${reset:-}"
}
ui_summary() {
@@ -224,3 +231,100 @@ ui_log_jsonl() {
printf '{"ts":"%s","level":"%s","module":"%s","msg":"%s","domain":"%s"%s}\n' \
"$ts" "$lvl" "$mod" "$msg" "$dom" "$extra"
}
+
+# Track dry-run commands for module-level summaries
+# Usage: ui_dryrun_track "tool_name" "full command string"
+ui_dryrun_track() {
+ local tool_name="$1"
+ local full_command="$2"
+ local redacted_command
+
+ # Normalize whitespace: replace newlines with spaces, squeeze multiple spaces
+ local normalized_command
+ normalized_command=$(echo "$full_command" | tr '\n' ' ' | tr -s ' ')
+ redacted_command="$normalized_command"
+
+ # Use centralized redaction when available.
+ if declare -F redact_secrets >/dev/null 2>&1; then
+ redacted_command=$(redact_secrets "$redacted_command")
+ fi
+ # Fallback masking for common inline secrets shown in command args.
+ redacted_command=$(echo "$redacted_command" \
+ | sed -E 's/(-token-string[[:space:]]+)[^[:space:]]+/\1[REDACTED]/g' \
+ | sed -E 's/([?&]apiKey=)[^&[:space:]]+/\1[REDACTED]/g' \
+ | sed -E 's/(Authorization:[[:space:]]*Bearer[[:space:]])[^[:space:]]+/\1[REDACTED]/g')
+
+ ((_UI_DRYRUN_COUNT++)) || true
+ _UI_DRYRUN_COMMANDS+=("$tool_name")
+ _UI_DRYRUN_FULL_COMMANDS+=("$redacted_command")
+
+ # Shared module-local dry-run log (visible from parallel subshells)
+ if [[ -n "${_UI_DRYRUN_SHARED_FILE:-}" ]]; then
+ printf "%s\t%s\n" "$tool_name" "$redacted_command" >>"${_UI_DRYRUN_SHARED_FILE}" 2>/dev/null || true
+ fi
+
+ # Immediate output only if verbose (OUTPUT_VERBOSITY >= 2)
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
+ printf "%b[DRY-RUN]%b %s\n" "${yellow:-}" "${reset:-}" "$redacted_command"
+ fi
+}
+
+# Show dry-run summary at end of module
+# Usage: ui_dryrun_summary
+ui_dryrun_summary() {
+ [[ "${DRY_RUN:-false}" != "true" ]] && return 0
+ [[ "$_UI_DRYRUN_COUNT" -eq 0 ]] && return 0
+ [[ "${OUTPUT_VERBOSITY:-1}" -lt 1 ]] && return 0
+
+ local -a summary_tools=()
+ local -a summary_cmds=()
+ local unique_tools
+
+ if [[ -n "${_UI_DRYRUN_SHARED_FILE:-}" ]] && [[ -f "${_UI_DRYRUN_SHARED_FILE}" ]]; then
+ while IFS=$'\t' read -r t c; do
+ [[ -n "$t" ]] && summary_tools+=("$t")
+ [[ -n "$c" ]] && summary_cmds+=("$c")
+ done <"${_UI_DRYRUN_SHARED_FILE}"
+ fi
+
+ # Fallback when shared file isn't available
+ if [[ ${#summary_tools[@]} -eq 0 ]]; then
+ summary_tools=("${_UI_DRYRUN_COMMANDS[@]}")
+ summary_cmds=("${_UI_DRYRUN_FULL_COMMANDS[@]}")
+ fi
+
+ _UI_DRYRUN_COUNT=${#summary_cmds[@]}
+ [[ "$_UI_DRYRUN_COUNT" -eq 0 ]] && return 0
+
+ # Deduplicate and sort tool names
+ unique_tools=$(printf "%s\n" "${summary_tools[@]}" 2>/dev/null | sed '/^$/d' | sort -u | tr '\n' ', ' | sed 's/,$//' | sed 's/,/, /g')
+
+ # Truncate if too long (> 100 chars)
+ if [[ ${#unique_tools} -gt 100 ]]; then
+ unique_tools="${unique_tools:0:97}..."
+ fi
+
+ printf " %b[DRY-RUN]%b Would execute %d commands: %s\n" \
+ "${byellow:-}" "${reset:-}" "$_UI_DRYRUN_COUNT" "$unique_tools"
+
+ # Verbose: show individual commands
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
+ printf " Full command list:\n"
+ local cmd
+ for cmd in "${summary_cmds[@]}"; do
+ printf " - %s\n" "$cmd"
+ done
+ fi
+}
+
+# Reset dry-run tracking (called at module start)
+# Usage: ui_dryrun_reset
+ui_dryrun_reset() {
+ _UI_DRYRUN_COUNT=0
+ _UI_DRYRUN_COMMANDS=()
+ _UI_DRYRUN_FULL_COMMANDS=()
+ _UI_DRYRUN_SHARED_FILE="${dir:-/tmp}/.tmp/.dryrun_commands.${PPID:-$$}.${RANDOM}.log"
+ mkdir -p "$(dirname "$_UI_DRYRUN_SHARED_FILE")" 2>/dev/null || true
+ : >"$_UI_DRYRUN_SHARED_FILE" 2>/dev/null || true
+ export _UI_DRYRUN_SHARED_FILE
+}
diff --git a/modules/axiom.sh b/modules/axiom.sh
index fd11077..b2730c2 100644
--- a/modules/axiom.sh
+++ b/modules/axiom.sh
@@ -18,33 +18,33 @@ function resolvers_update() {
if [[ $generate_resolvers == true ]]; then
if [[ $AXIOM != true ]]; then
if [[ ! -s $resolvers ]] || [[ $(find "$resolvers" -mtime +1 -print) ]]; then
- notification "Resolvers seem older than 1 day. Generating custom resolvers..." warn
+ _print_msg WARN "Resolvers seem older than 1 day. Generating custom resolvers..."
{
rm -f -- "$resolvers"
- dnsvalidator -tL https://public-dns.info/nameservers.txt -threads "$DNSVALIDATOR_THREADS" -o "$resolvers" >/dev/null
- dnsvalidator -tL https://raw.githubusercontent.com/blechschmidt/massdns/master/lists/resolvers.txt -threads "$DNSVALIDATOR_THREADS" -o tmp_resolvers >/dev/null
+ run_command dnsvalidator -tL https://public-dns.info/nameservers.txt -threads "$DNSVALIDATOR_THREADS" -o "$resolvers" >/dev/null
+ run_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" ] && wget -q -O - "${resolvers_url}" >"$resolvers"
- [ ! -s "$resolvers_trusted" ] && wget -q -O - "${resolvers_trusted_url}" >"$resolvers_trusted"
- notification "Updated\n" good
+ [ ! -s "$resolvers" ] && run_command wget -q -O - "${resolvers_url}" >"$resolvers"
+ [ ! -s "$resolvers_trusted" ] && run_command wget -q -O - "${resolvers_trusted_url}" >"$resolvers_trusted"
+ _print_msg OK "Updated resolvers"
fi
else
- notification "Checking resolvers lists. Accurate resolvers are key to good results. This may take around 10 minutes if outdated." warn
- 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
- axiom-exec "wget -q -O - ${resolvers_url} > ${AXIOM_RESOLVERS_PATH}" 2>>"$LOGFILE" >/dev/null
- axiom-exec "wget -q -O - ${resolvers_trusted_url} > ${AXIOM_RESOLVERS_TRUSTED_PATH}" 2>>"$LOGFILE" >/dev/null
- notification "Updated\n" good
+ _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
+ _print_msg OK "Updated resolvers"
fi
generate_resolvers=false
else
if [[ ! -s $resolvers ]] || [[ $(find "$resolvers" -mtime +1 -print) ]]; then
- notification "Resolvers seem older than 1 day. Downloading new resolvers..." warn
+ _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"
- notification "Resolvers updated\n" good
+ _print_msg OK "Resolvers updated"
fi
fi
@@ -58,8 +58,8 @@ function resolvers_update_quick_local() {
}
function resolvers_update_quick_axiom() {
- axiom-exec "wget -q -O - ${resolvers_url} > ${AXIOM_RESOLVERS_PATH}" 2>>"$LOGFILE" >/dev/null
- axiom-exec "wget -q -O - ${resolvers_trusted_url} > ${AXIOM_RESOLVERS_TRUSTED_PATH}" 2>>"$LOGFILE" >/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
}
function resolvers_optimize_local() {
@@ -73,9 +73,9 @@ function ipcidr_target() {
local expanded_list="${PWD}/target_reconftw_ipcidr.txt"
IP_CIDR_REGEX='(((25[0-5]|2[0-4][0-9]|1?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9][0-9]?))(\/([8-9]|[1-2][0-9]|3[0-2]))([^0-9.]|$)|(((25[0-5]|2[0-4][0-9]|1?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9][0-9]?)$)'
if [[ $1 =~ ^$IP_CIDR_REGEX ]]; then
- echo "$1" | mapcidr -silent | anew -q "$expanded_list"
+ echo "$1" | run_command mapcidr -silent | anew -q "$expanded_list"
if [[ -s "$expanded_list" ]]; then
- [ "$REVERSE_IP" = true ] && cat "$expanded_list" | hakip2host | cut -d' ' -f 3 | unfurl -u domains 2>/dev/null | sed -e 's/*\.//' -e 's/\.$//' -e '/\./!d' | anew -q "$expanded_list"
+ [ "$REVERSE_IP" = true ] && cat "$expanded_list" | run_command hakip2host | cut -d' ' -f 3 | unfurl -u domains 2>/dev/null | sed -e 's/*\.//' -e 's/\.$//' -e '/\./!d' | anew -q "$expanded_list"
if [[ -z "$caller_list" ]]; then
if [[ $(wc -l <"$expanded_list") -eq 1 ]]; then
domain=$(cat "$expanded_list")
diff --git a/modules/core.sh b/modules/core.sh
index a25e964..adaf3e2 100644
--- a/modules/core.sh
+++ b/modules/core.sh
@@ -1046,10 +1046,10 @@ function transfer {
echo "$file: No such file or directory" >&2
return 1
fi
- tar -czvf /tmp/$file_name $file >/dev/null 2>&1 && curl -s https://bashupload.com/$file.tgz --data-binary @/tmp/$file_name | grep wget
+ run_command tar -czvf /tmp/$file_name $file >/dev/null 2>&1 && run_command curl -s https://bashupload.com/$file.tgz --data-binary @/tmp/$file_name | grep wget
else
file_name=$1
- tar -czvf /tmp/$file_name $file >/dev/null 2>&1 && curl -s https://bashupload.com/$file.tgz --data-binary @/tmp/$file_name | grep wget
+ run_command tar -czvf /tmp/$file_name $file >/dev/null 2>&1 && run_command curl -s https://bashupload.com/$file.tgz --data-binary @/tmp/$file_name | grep wget
fi
}
@@ -1069,16 +1069,16 @@ function sendToNotify {
notification "Sending ${domain} data over Telegram" info
telegram_chat_id=$(sed -n '/^telegram:/,/^[^ ]/p' ${NOTIFY_CONFIG} | sed -n 's/^[ ]*telegram_chat_id:[ ]*"\([^"]*\)".*/\1/p')
telegram_key=$(sed -n '/^telegram:/,/^[^ ]/p' ${NOTIFY_CONFIG} | sed -n 's/^[ ]*telegram_api_key:[ ]*"\([^"]*\)".*/\1/p')
- curl -F "chat_id=${telegram_chat_id}" -F "document=@${1}" https://api.telegram.org/bot${telegram_key}/sendDocument 2>>"$LOGFILE" >/dev/null
+ run_command curl -F "chat_id=${telegram_chat_id}" -F "document=@${1}" https://api.telegram.org/bot${telegram_key}/sendDocument 2>>"$LOGFILE" >/dev/null
fi
if grep -q '^ discord\|^discord\|^ discord' $NOTIFY_CONFIG; then
notification "Sending ${domain} data over Discord" info
discord_url=$(sed -n '/^discord:/,/^[^ ]/p' ${NOTIFY_CONFIG} | sed -n 's/^[ ]*discord_webhook_url:[ ]*"\([^"]*\)".*/\1/p')
- curl -v -i -H "Accept: application/json" -H "Content-Type: multipart/form-data" -X POST -F 'payload_json={"username": "test", "content": "hello"}' -F file1=@${1} $discord_url 2>>"$LOGFILE" >/dev/null
+ run_command curl -v -i -H "Accept: application/json" -H "Content-Type: multipart/form-data" -X POST -F 'payload_json={"username": "test", "content": "hello"}' -F file1=@${1} $discord_url 2>>"$LOGFILE" >/dev/null
fi
if [[ -n $slack_channel ]] && [[ -n $slack_auth ]]; then
notification "Sending ${domain} data over Slack" info
- curl -F file=@${1} -F "initial_comment=reconftw zip file" -F channels=${slack_channel} -H "Authorization: Bearer ${slack_auth}" https://slack.com/api/files.upload 2>>"$LOGFILE" >/dev/null
+ run_command curl -F file=@${1} -F "initial_comment=reconftw zip file" -F channels=${slack_channel} -H "Authorization: Bearer ${slack_auth}" https://slack.com/api/files.upload 2>>"$LOGFILE" >/dev/null
fi
fi
}
@@ -1130,15 +1130,21 @@ function end_func() {
record_func_timing "${fn}" "$((end - start))"
local duration=$((end - start))
echo "[$current_date] End function: ${fn} " >>"${LOGFILE}"
+ local badge="OK"
+ case "$status" in
+ info|INFO) badge="INFO" ;;
+ warn|WARN) badge="WARN" ;;
+ error|ERROR) badge="FAIL" ;;
+ good|SUCCESS) badge="OK" ;;
+ OK|WARN|FAIL|SKIP|CACHE) badge="$status" ;;
+ esac
+
+ # Persist per-function final status for parallel aggregator.
+ if [[ -n "${called_fn_dir:-}" ]]; then
+ printf "%s\n" "$badge" >"${called_fn_dir}/.status_${fn}" 2>/dev/null || true
+ fi
+
if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
- local badge="OK"
- case "$status" in
- info|INFO) badge="INFO" ;;
- warn|WARN) badge="WARN" ;;
- error|ERROR) badge="FAIL" ;;
- good|SUCCESS) badge="OK" ;;
- OK|WARN|FAIL|SKIP) badge="$status" ;;
- esac
_print_status "$badge" "${fn}" "${duration}s"
# Show detail line for non-OK statuses when message is present
if [[ -n "$message" ]] && [[ "$badge" != "OK" && "$badge" != "INFO" ]]; then
@@ -1174,8 +1180,14 @@ function end_subfunc() {
end_sub=$(date +%s)
getElapsedTime "$start_sub" "$end_sub"
local duration=$((end_sub - start_sub))
+ local status="${3:-OK}"
+
+ # Persist per-subfunction final status for parallel aggregator.
+ if [[ -n "${called_fn_dir:-}" ]]; then
+ printf "%s\n" "$status" >"${called_fn_dir}/.status_${2}" 2>/dev/null || true
+ fi
+
if [[ "${OUTPUT_VERBOSITY:-1}" -ge 1 ]]; then
- local status="${3:-OK}"
_print_status "$status" " ${2}" "${duration}s"
fi
echo "[$current_date] End subfunction: ${1} " >>"${LOGFILE}"
@@ -1196,9 +1208,9 @@ function maybe_update_nuclei() {
local stamp_file=".tmp/.nuclei_updated"
if [[ ! -f $stamp_file ]]; then
if [[ -n ${NUCLEI_TEMPLATES_PATH-} ]]; then
- nuclei -update-templates -update-template-dir "${NUCLEI_TEMPLATES_PATH}" 2>>"$LOGFILE" >/dev/null || true # non-fatal: template update failure shouldn't block scan
+ run_command nuclei -update-templates -update-template-dir "${NUCLEI_TEMPLATES_PATH}" 2>>"$LOGFILE" >/dev/null || true # non-fatal: template update failure shouldn't block scan
else
- nuclei -update 2>>"$LOGFILE" >/dev/null || true # non-fatal: template update failure shouldn't block scan
+ run_command nuclei -update 2>>"$LOGFILE" >/dev/null || true # non-fatal: template update failure shouldn't block scan
fi
touch "$stamp_file"
fi
@@ -1868,7 +1880,7 @@ function health_check() {
# 3. Check network connectivity
_print_status INFO "Checking network connectivity..."
- if curl -s --connect-timeout 5 -o /dev/null -w "%{http_code}" "https://www.google.com" | grep -q "200\|301\|302"; then
+ if run_command curl -s --connect-timeout 5 -o /dev/null -w "%{http_code}" "https://www.google.com" | grep -q "200\|301\|302"; then
_print_status OK "Internet connectivity"
else
_print_status WARN "No internet connectivity"
diff --git a/modules/modes.sh b/modules/modes.sh
index 413bb87..3f51041 100644
--- a/modules/modes.sh
+++ b/modules/modes.sh
@@ -13,6 +13,7 @@
function start() {
global_start=$(date +%s)
+ set +m 2>/dev/null || true
# Validate configuration before starting
validate_config || exit $?
@@ -237,28 +238,28 @@ function end() {
_print_error "Faraday server is not running. Skipping Faraday integration"
else
if [[ -s ".tmp/tko_json.txt" ]]; then
- faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei .tmp/tko_json.txt 2>>"$LOGFILE" >/dev/null
+ run_command faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei .tmp/tko_json.txt 2>>"$LOGFILE" >/dev/null
fi
if [[ -s "hosts/portscan_active.xml" ]]; then
- faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nmap hosts/portscan_active.xml 2>>"$LOGFILE" >/dev/null
+ run_command faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nmap hosts/portscan_active.xml 2>>"$LOGFILE" >/dev/null
fi
if [[ -s ".tmp/fuzzparams_json.txt" ]]; then
- faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei .tmp/fuzzparams_json.txt 2>>"$LOGFILE" >/dev/null
+ run_command faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei .tmp/fuzzparams_json.txt 2>>"$LOGFILE" >/dev/null
fi
if [[ -s "nuclei_output/info_json.txt" ]]; then
- faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/info_json.txt 2>>"$LOGFILE" >/dev/null
+ run_command faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/info_json.txt 2>>"$LOGFILE" >/dev/null
fi
if [[ -s "nuclei_output/low_json.txt" ]]; then
- faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/low_json.txt 2>>"$LOGFILE" >/dev/null
+ run_command faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/low_json.txt 2>>"$LOGFILE" >/dev/null
fi
if [[ -s "nuclei_output/medium_json.txt" ]]; then
- faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/medium_json.txt 2>>"$LOGFILE" >/dev/null
+ run_command faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/medium_json.txt 2>>"$LOGFILE" >/dev/null
fi
if [[ -s "nuclei_output/high_json.txt" ]]; then
- faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/high_json.txt 2>>"$LOGFILE" >/dev/null
+ run_command faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/high_json.txt 2>>"$LOGFILE" >/dev/null
fi
if [[ -s "nuclei_output/critical_json.txt" ]]; then
- faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/critical_json.txt 2>>"$LOGFILE" >/dev/null
+ run_command faraday-cli tool report -w "$FARADAY_WORKSPACE" --plugin-id nuclei nuclei_output/critical_json.txt 2>>"$LOGFILE" >/dev/null
fi
notification "Information sent to Faraday" "good"
fi
diff --git a/modules/osint.sh b/modules/osint.sh
index 98a4df2..e0e66a7 100644
--- a/modules/osint.sh
+++ b/modules/osint.sh
@@ -20,7 +20,7 @@ function google_dorks() {
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $GOOGLE_DORKS == true ]] && [[ $OSINT == true ]]; then
start_func "${FUNCNAME[0]}" "Running: Google Dorks in process"
- if ! "${tools}/dorks_hunter/venv/bin/python3" "${tools}/dorks_hunter/dorks_hunter.py" -d "$domain" -o "osint/dorks.txt" 2>>"$LOGFILE" >/dev/null; then
+ if ! run_command "${tools}/dorks_hunter/venv/bin/python3" "${tools}/dorks_hunter/dorks_hunter.py" -d "$domain" -o "osint/dorks.txt" 2>>"$LOGFILE" >/dev/null; then
_print_error "dorks_hunter command failed"
fi
end_func "Results are saved in $domain/osint/dorks.txt" "${FUNCNAME[0]}"
@@ -41,12 +41,12 @@ function github_dorks() {
if [[ -s $GITHUB_TOKENS ]]; then
if [[ $DEEP == true ]]; then
- if ! gitdorks_go -gd "${tools}/gitdorks_go/Dorks/medium_dorks.txt" -nws 20 -target "$domain" -tf "$GITHUB_TOKENS" -ew 3 | anew -q osint/gitdorks.txt; then
+ if ! run_command gitdorks_go -gd "${tools}/gitdorks_go/Dorks/medium_dorks.txt" -nws 20 -target "$domain" -tf "$GITHUB_TOKENS" -ew 3 | anew -q osint/gitdorks.txt; then
_print_error "gitdorks_go command failed"
return 1
fi
else
- if ! gitdorks_go -gd "${tools}/gitdorks_go/Dorks/smalldorks.txt" -nws 20 -target "$domain" -tf "$GITHUB_TOKENS" -ew 3 | anew -q osint/gitdorks.txt; then
+ if ! run_command gitdorks_go -gd "${tools}/gitdorks_go/Dorks/smalldorks.txt" -nws 20 -target "$domain" -tf "$GITHUB_TOKENS" -ew 3 | anew -q osint/gitdorks.txt; then
_print_error "gitdorks_go command failed"
return 1
fi
@@ -75,7 +75,7 @@ function github_repos() {
GH_TOKEN=$(head -n 1 "$GITHUB_TOKENS")
echo "$domain" | unfurl format %r >.tmp/company_name.txt
- if ! enumerepo -token-string "$GH_TOKEN" -usernames .tmp/company_name.txt -o .tmp/company_repos.txt 2>>"$LOGFILE" >/dev/null; then
+ if ! run_command enumerepo -token-string "$GH_TOKEN" -usernames .tmp/company_name.txt -o .tmp/company_repos.txt 2>>"$LOGFILE" >/dev/null; then
_print_error "enumerepo command failed"
fi
@@ -88,7 +88,7 @@ function github_repos() {
ensure_dirs .tmp/github_repos .tmp/github
if [[ -s ".tmp/company_repos_url.txt" ]]; then
- if ! interlace -tL .tmp/company_repos_url.txt -threads "$INTERLACE_THREADS" -c "git clone _target_ .tmp/github_repos/_cleantarget_" 2>>"$LOGFILE" >/dev/null; then
+ if ! run_command interlace -tL .tmp/company_repos_url.txt -threads "$INTERLACE_THREADS" -c "git clone _target_ .tmp/github_repos/_cleantarget_" 2>>"$LOGFILE" >/dev/null; then
_print_error "interlace git clone command failed"
return 1
fi
@@ -162,7 +162,7 @@ function metadata() {
_print_error "Failed to change directory to ${tools}/metagoofil in ${FUNCNAME[0]} at line ${LINENO}"
return 1
}
- if ! "${tools}/metagoofil/venv/bin/python3" "${tools}/metagoofil/metagoofil.py" -d "${domain}" -t pdf,docx,xlsx -l 10 -w -o "${dir}/.tmp/metagoofil_${domain}/" 2>>"${LOGFILE}" >/dev/null; then
+ if ! run_command "${tools}/metagoofil/venv/bin/python3" "${tools}/metagoofil/metagoofil.py" -d "${domain}" -t pdf,docx,xlsx -l 10 -w -o "${dir}/.tmp/metagoofil_${domain}/" 2>>"${LOGFILE}" >/dev/null; then
log_note "metadata: metagoofil failed; skipping metadata extraction" "${FUNCNAME[0]}" "${LINENO}"
fi
popd >/dev/null || {
@@ -173,7 +173,7 @@ function metadata() {
# Check if exiftool is installed before running
if command -v exiftool &>/dev/null; then
if find ".tmp/metagoofil_${domain}" -type f -print -quit 2>/dev/null | grep -q .; then
- exiftool -r ".tmp/metagoofil_${domain}" 2>>"${LOGFILE}" \
+ run_command exiftool -r ".tmp/metagoofil_${domain}" 2>>"${LOGFILE}" \
| tee /dev/null \
| egrep -i "Author|Creator|Email|Producer|Template" \
| sort -u \
@@ -209,9 +209,9 @@ function apileaks() {
start_func "${FUNCNAME[0]}" "Scanning for leaks in public API directories"
# Run porch-pirate (full dump); fallback to light mode if dump fails
- if ! porch-pirate -s "$domain" -l 25 --dump 2>>"$LOGFILE" >"${dir}/osint/postman_leaks.txt"; then
+ if ! run_command porch-pirate -s "$domain" -l 25 --dump 2>>"$LOGFILE" >"${dir}/osint/postman_leaks.txt"; then
log_note "porch-pirate --dump failed; retrying without --dump" "${FUNCNAME[0]}" "${LINENO}"
- if ! porch-pirate -s "$domain" -l 25 2>>"$LOGFILE" >"${dir}/osint/postman_leaks.txt"; then
+ if ! run_command porch-pirate -s "$domain" -l 25 2>>"$LOGFILE" >"${dir}/osint/postman_leaks.txt"; then
log_note "porch-pirate failed even without --dump" "${FUNCNAME[0]}" "${LINENO}"
fi
fi
@@ -231,7 +231,7 @@ function apileaks() {
[[ -n ${TIMEOUT_CMD:-} ]] && swag_cmd=("$TIMEOUT_CMD" "$swag_timeout" "${swag_cmd[@]}")
local swagger_rc=0
{
- "${swag_cmd[@]}" 2>>"$LOGFILE" | grep -i "[*]\|URL" >"${dir}/osint/swagger_leaks.txt"
+ run_command "${swag_cmd[@]}" 2>>"$LOGFILE" | grep -i "[*]\|URL" >"${dir}/osint/swagger_leaks.txt"
swagger_rc=${PIPESTATUS[0]:-0} # ignore grep exit code (no matches is fine)
} || true
if ((swagger_rc != 0)); then
@@ -245,6 +245,11 @@ function apileaks() {
return 1
fi
+ if [[ "${DRY_RUN:-false}" == "true" ]]; then
+ end_func "Dry-run: apileaks commands recorded" "${FUNCNAME[0]}" "SKIP"
+ return
+ fi
+
# Analyze leaks with trufflehog
if [[ -s "${dir}/osint/postman_leaks.txt" ]]; then
run_command trufflehog filesystem "${dir}/osint/postman_leaks.txt" -j 2>/dev/null | jq -c | anew -q "${dir}/osint/postman_leaks_trufflehog.json"
@@ -275,7 +280,7 @@ function emails() {
start_func "${FUNCNAME[0]}" "Searching for emails/users/passwords leaks"
- PYTHONWARNINGS=ignore "${tools}/EmailHarvester/venv/bin/python3" "${tools}/EmailHarvester/EmailHarvester.py" -d ${domain} -e all -l 20 2>>"$LOGFILE" | anew -q .tmp/EmailHarvester.txt || true
+ run_command env PYTHONWARNINGS=ignore "${tools}/EmailHarvester/venv/bin/python3" "${tools}/EmailHarvester/EmailHarvester.py" -d ${domain} -e all -l 20 2>>"$LOGFILE" | anew -q .tmp/EmailHarvester.txt || true
# Process emailfinder results
if [[ -s ".tmp/EmailHarvester.txt" ]]; then
@@ -289,7 +294,7 @@ function emails() {
fi
# Run LeakSearch.py and handle errors
- "${tools}/LeakSearch/venv/bin/python3" LeakSearch.py -k "$domain" -o "${dir}/.tmp/passwords.txt" 1>>"$LOGFILE"
+ run_command "${tools}/LeakSearch/venv/bin/python3" LeakSearch.py -k "$domain" -o "${dir}/.tmp/passwords.txt" 1>>"$LOGFILE"
# Return to the previous directory
if ! popd >/dev/null; then
@@ -326,11 +331,11 @@ function domain_info() {
start_func "${FUNCNAME[0]}" "Searching domain info (whois, registrant name/email domains)"
# Run whois command and check for errors
- whois "$domain" >"osint/domain_info_general.txt"
- "${tools}/msftrecon/venv/bin/python3" "${tools}/msftrecon/msftrecon/msftrecon.py" -d ${domain} 2>>"$LOGFILE" >osint/azure_tenant_domains.txt || true
+ run_command whois "$domain" >"osint/domain_info_general.txt"
+ run_command "${tools}/msftrecon/venv/bin/python3" "${tools}/msftrecon/msftrecon/msftrecon.py" -d ${domain} 2>>"$LOGFILE" >osint/azure_tenant_domains.txt || true
company_name=$(unfurl format %r <<<"$domain")
- "${tools}/Scopify/venv/bin/python3" "${tools}/Scopify/scopify.py" -c ${company_name} >osint/scopify.txt
+ run_command "${tools}/Scopify/venv/bin/python3" "${tools}/Scopify/scopify.py" -c ${company_name} >osint/scopify.txt
end_func "Results are saved in ${domain}/osint/domain_info_[general/azure_tenant_domains].txt" "${FUNCNAME[0]}"
@@ -365,10 +370,10 @@ function third_party_misconfigs() {
return 1
fi
- misconfig-mapper -update-templates 1>>"$LOGFILE"
- misconfig-mapper -target visma.com -as-domain true -permutations false -skip-ssl \
+ run_command misconfig-mapper -update-templates 1>>"$LOGFILE"
+ run_command misconfig-mapper -target visma.com -as-domain true -permutations false -skip-ssl \
-service "*" -verbose 0 | anew -q "${dir}/osint/3rdparts_misconfigurations.txt"
- misconfig-mapper -target "$company_name" -skip-ssl -verbose 0 -service "*" \
+ run_command misconfig-mapper -target "$company_name" -skip-ssl -verbose 0 -service "*" \
| anew -q "${dir}/osint/3rdparts_misconfigurations.txt"
# Return to the previous directory
@@ -409,7 +414,7 @@ function spoof() {
fi
# Run spoofy.py and handle errors
- "${tools}/Spoofy/venv/bin/python3" spoofy.py -d "$domain" >"${dir}/osint/spoof.txt"
+ run_command "${tools}/Spoofy/venv/bin/python3" spoofy.py -d "$domain" >"${dir}/osint/spoof.txt"
# Return to the previous directory
if ! popd >/dev/null; then
@@ -442,9 +447,9 @@ function mail_hygiene() {
{
printf "Domain: %s\n" "$domain"
printf "\nTXT records:\n"
- dig +short TXT "$domain" | sed 's/^/ /'
+ run_command dig +short TXT "$domain" | sed 's/^/ /'
printf "\nDMARC record:\n"
- dig +short TXT "_dmarc.$domain" | sed 's/^/ /'
+ run_command dig +short TXT "_dmarc.$domain" | sed 's/^/ /'
} >"osint/mail_hygiene.txt" 2>>"$LOGFILE"
end_func "Results are saved in $domain/osint/mail_hygiene.txt" "${FUNCNAME[0]}"
else
@@ -467,7 +472,7 @@ function cloud_enum_scan() {
start_func "${FUNCNAME[0]}" "Cloud storage enumeration"
company_name=$(unfurl format %r <<<"$domain")
- cloud_enum -k "$company_name" -k "$domain" -k "${domain%%.*}" 2>>"$LOGFILE" | anew -q osint/cloud_enum.txt
+ run_command cloud_enum -k "$company_name" -k "$domain" -k "${domain%%.*}" 2>>"$LOGFILE" | anew -q osint/cloud_enum.txt
end_func "Results are saved in $domain/osint/cloud_enum.txt" "${FUNCNAME[0]}"
else
if [[ $CLOUD_ENUM == false ]] || [[ $OSINT == false ]]; then
@@ -494,18 +499,18 @@ function ip_info() {
if [[ -n $WHOISXML_API ]]; then
# Reverse IP lookup
- curl -s "https://reverse-ip.whoisxmlapi.com/api/v1?apiKey=${WHOISXML_API}&ip=${domain}" \
+ run_command curl -s "https://reverse-ip.whoisxmlapi.com/api/v1?apiKey=${WHOISXML_API}&ip=${domain}" \
| jq -r '.result[].name' 2>>"$LOGFILE" \
| sed -e "s/$/ ${domain}/" \
| anew -q "osint/ip_${domain}_relations.txt"
# WHOIS lookup
- curl -s "https://www.whoisxmlapi.com/whoisserver/WhoisService?apiKey=${WHOISXML_API}&domainName=${domain}&outputFormat=json&da=2&registryRawText=1&registrarRawText=1&ignoreRawTexts=1" \
+ run_command curl -s "https://www.whoisxmlapi.com/whoisserver/WhoisService?apiKey=${WHOISXML_API}&domainName=${domain}&outputFormat=json&da=2&registryRawText=1&registrarRawText=1&ignoreRawTexts=1" \
| jq 2>>"$LOGFILE" \
| anew -q "osint/ip_${domain}_whois.txt"
# IP Geolocation
- curl -s "https://ip-geolocation.whoisxmlapi.com/api/v1?apiKey=${WHOISXML_API}&ipAddress=${domain}" \
+ run_command curl -s "https://ip-geolocation.whoisxmlapi.com/api/v1?apiKey=${WHOISXML_API}&ipAddress=${domain}" \
| jq -r '.ip,.location' 2>>"$LOGFILE" \
| anew -q "osint/ip_${domain}_location.txt"
diff --git a/modules/subdomains.sh b/modules/subdomains.sh
index 8ce0e8f..5d31ec1 100644
--- a/modules/subdomains.sh
+++ b/modules/subdomains.sh
@@ -89,7 +89,7 @@ deep_wildcard_filter() {
# Test which random probes resolve (indicating wildcard)
if [[ -s ".tmp/dwf_probes.txt" ]]; then
- dnsx -silent -retry 2 -r "$resolvers_trusted" < ".tmp/dwf_probes.txt" > ".tmp/dwf_resolved_probes.txt" 2>/dev/null || true
+ run_command dnsx -silent -retry 2 -r "$resolvers_trusted" < ".tmp/dwf_probes.txt" > ".tmp/dwf_resolved_probes.txt" 2>/dev/null || true
# Extract parent domains that are wildcards
if [[ -s ".tmp/dwf_resolved_probes.txt" ]]; then
@@ -388,6 +388,7 @@ _subdomains_finalize() {
fi
# Persist counts
+ [[ -f "subdomains/subdomains_new.txt" ]] || : > "subdomains/subdomains_new.txt"
wc -l < "subdomains/subdomains_new.txt" 2>/dev/null > .tmp/subs_new_count
[[ -f "webs/webs_new.txt" ]] || : > "webs/webs_new.txt"
wc -l < "webs/webs_new.txt" 2>/dev/null > .tmp/webs_new_count
@@ -442,13 +443,19 @@ function sub_asn() {
log_note "ASN_ENUM enabled but PDCP_API_KEY is not set. Skipping asnmap ASN enumeration." "${FUNCNAME[0]}" "${LINENO}"
asn_status="WARN"
else
- if asnmap -d "$domain" -silent -j 2>>"$LOGFILE" >"$asn_json"; then
+ if [[ -n ${TIMEOUT_CMD:-} ]]; then
+ run_command "$TIMEOUT_CMD" -k 10s 120s asnmap -d "$domain" -silent -j 2>>"$LOGFILE" >"$asn_json"
+ asn_rc=$?
+ elif run_command asnmap -d "$domain" -silent -j 2>>"$LOGFILE" >"$asn_json"; then
asn_rc=0
else
asn_rc=$?
fi
- if [[ $asn_rc -eq 0 && -s "$asn_json" ]]; then
+ if [[ "${DRY_RUN:-false}" == "true" ]]; then
+ _print_msg INFO "Dry-run: asnmap execution recorded, ASN parsing skipped."
+ asn_status="SKIP"
+ elif [[ $asn_rc -eq 0 && -s "$asn_json" ]]; then
jq -r '.cidr // empty' "$asn_json" | sed '/^$/d' | sort -u >.tmp/asn_cidrs.txt
jq -r '.as_number // empty' "$asn_json" | sed '/^$/d' | sort -u >.tmp/asn_numbers.txt
@@ -510,20 +517,20 @@ function sub_passive() {
# Run subfinder and check for errors
run_command subfinder -all -d "$domain" -max-time "$SUBFINDER_ENUM_TIMEOUT" -silent -o .tmp/subfinder_psub.txt 2>>"$LOGFILE" >/dev/null
- curl -s https://ip.thc.org/sb/$domain | grep -v ";;" | anew -q .tmp/subfinder_psub.txt 2>>"$LOGFILE" >/dev/null
+ run_command curl -s https://ip.thc.org/sb/$domain | grep -v ";;" | anew -q .tmp/subfinder_psub.txt 2>>"$LOGFILE" >/dev/null
# Run github-subdomains if GITHUB_TOKENS is set and file is not empty
if [[ -s $GITHUB_TOKENS ]]; then
if [[ $DEEP == true ]]; then
- github-subdomains -d "$domain" -t "$GITHUB_TOKENS" -o .tmp/github_subdomains_psub.txt 2>>"$LOGFILE" >/dev/null
+ run_command github-subdomains -d "$domain" -t "$GITHUB_TOKENS" -o .tmp/github_subdomains_psub.txt 2>>"$LOGFILE" >/dev/null
else
- github-subdomains -d "$domain" -k -q -t "$GITHUB_TOKENS" -o .tmp/github_subdomains_psub.txt 2>>"$LOGFILE" >/dev/null
+ run_command github-subdomains -d "$domain" -k -q -t "$GITHUB_TOKENS" -o .tmp/github_subdomains_psub.txt 2>>"$LOGFILE" >/dev/null
fi
fi
# Run gitlab-subdomains if GITLAB_TOKENS is set and file is not empty
if [[ -s $GITLAB_TOKENS ]]; then
- gitlab-subdomains -d "$domain" -t "$GITLAB_TOKENS" 2>>"$LOGFILE" | tee .tmp/gitlab_subdomains_psub.txt >/dev/null
+ run_command gitlab-subdomains -d "$domain" -t "$GITLAB_TOKENS" 2>>"$LOGFILE" | tee .tmp/gitlab_subdomains_psub.txt >/dev/null
fi
# Check if INSCOPE is true and run check_inscope
@@ -559,6 +566,13 @@ function sub_crt() {
: >.tmp/crtsh_subdomains.txt
: >.tmp/crtsh_subs_tmp.txt
+ if [[ "${DRY_RUN:-false}" == "true" ]]; then
+ run_command crt -s -json -l "${CTR_LIMIT}" "$domain" >/dev/null
+ run_command curl -s "https://bgp.he.net/certs/api/list?domain=$domain" >/dev/null
+ end_subfunc "0 new subs (cert transparency)" "${FUNCNAME[0]}" "SKIP"
+ return
+ fi
+
# Run crt command and check for errors
# Apply time fencing if DNS_TIME_FENCE_DAYS is set and > 0
if [[ ${DNS_TIME_FENCE_DAYS:-0} -gt 0 ]]; then
@@ -648,7 +662,7 @@ function sub_active() {
# Resolve subdomains using puredns
if [[ -s ".tmp/subs_no_resolved.txt" ]]; then
- puredns resolve .tmp/subs_no_resolved.txt -w .tmp/subdomains_tmp.txt \
+ run_command puredns resolve .tmp/subs_no_resolved.txt -w .tmp/subdomains_tmp.txt \
-r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
-l "$PUREDNS_PUBLIC_LIMIT" --rate-limit-trusted "$PUREDNS_TRUSTED_LIMIT" \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" \
@@ -660,7 +674,7 @@ function sub_active() {
# Resolve subdomains using axiom-scan
if [[ -s ".tmp/subs_no_resolved.txt" ]]; then
- axiom-scan .tmp/subs_no_resolved.txt -m puredns-resolve \
+ run_command axiom-scan .tmp/subs_no_resolved.txt -m puredns-resolve \
-r ${AXIOM_RESOLVERS_PATH} \
--resolvers-trusted ${AXIOM_RESOLVERS_TRUSTED_PATH} \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" \
@@ -675,19 +689,23 @@ function sub_active() {
2>>"$LOGFILE" | anew -q .tmp/subdomains_tmp.txt
# If INSCOPE is true, check inscope
- if [[ $INSCOPE == true ]]; then
+ if [[ $INSCOPE == true ]] && [[ -s ".tmp/subdomains_tmp.txt" ]]; then
if ! check_inscope .tmp/subdomains_tmp.txt 2>>"$LOGFILE" >/dev/null; then
print_warnf "check_inscope command failed."
- return 1
fi
fi
# Process subdomains and append new ones to subdomains.txt, count new lines
- if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/subdomains_tmp.txt 2>>"$LOGFILE" \
- | grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
- | anew subdomains/subdomains.txt | sed '/^$/d' | wc -l); then
- print_warnf "Failed to process subdomains."
- return 1
+ if [[ -s ".tmp/subdomains_tmp.txt" ]]; then
+ if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/subdomains_tmp.txt 2>>"$LOGFILE" \
+ | grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
+ | anew subdomains/subdomains.txt | sed '/^$/d' | wc -l); then
+ print_warnf "Failed to process subdomains."
+ NUMOFLINES=0
+ fi
+ else
+ NUMOFLINES=0
+ _print_msg WARN "No candidate subdomains produced by sub_active; continuing."
fi
end_subfunc "${NUMOFLINES} subs DNS resolved from passive" "${FUNCNAME[0]}"
@@ -702,12 +720,18 @@ function sub_tls() {
if [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; then
start_subfunc "${FUNCNAME[0]}" "Running: TLS Active Subdomain Enumeration"
+ if [[ ! -s "subdomains/subdomains.txt" ]]; then
+ _print_msg WARN "No subdomains available for TLS enumeration; skipping."
+ end_subfunc "0 new subs (tls active enum)" "${FUNCNAME[0]}" "SKIP"
+ return
+ fi
+
if [[ $DEEP == true ]]; then
if [[ $AXIOM != true ]]; then
cat subdomains/subdomains.txt | tlsx -san -cn -silent -ro -c "$TLSX_THREADS" \
-p "$TLS_PORTS" -o .tmp/subdomains_tlsx.txt 2>>"$LOGFILE" >/dev/null
else
- axiom-scan subdomains/subdomains.txt -m tlsx \
+ run_command axiom-scan subdomains/subdomains.txt -m tlsx \
-san -cn -silent -ro -c "$TLSX_THREADS" -p "$TLS_PORTS" \
-o .tmp/subdomains_tlsx.txt $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
fi
@@ -715,7 +739,7 @@ function sub_tls() {
if [[ $AXIOM != true ]]; then
cat subdomains/subdomains.txt | tlsx -san -cn -silent -ro -c "$TLSX_THREADS" >.tmp/subdomains_tlsx.txt 2>>"$LOGFILE"
else
- axiom-scan subdomains/subdomains.txt -m tlsx \
+ run_command axiom-scan subdomains/subdomains.txt -m tlsx \
-san -cn -silent -ro -c "$TLSX_THREADS" \
-o .tmp/subdomains_tlsx.txt $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
fi
@@ -730,7 +754,7 @@ function sub_tls() {
if [[ $AXIOM != true ]]; then
[[ $RESOLVER_IQ == true ]] && resolvers_optimize_local
if [[ -s ".tmp/subdomains_tlsx_clean.txt" ]]; then
- puredns resolve .tmp/subdomains_tlsx_clean.txt -w .tmp/subdomains_tlsx_resolved.txt \
+ run_command puredns resolve .tmp/subdomains_tlsx_clean.txt -w .tmp/subdomains_tlsx_resolved.txt \
-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" \
@@ -738,7 +762,7 @@ function sub_tls() {
fi
else
if [[ -s ".tmp/subdomains_tlsx_clean.txt" ]]; then
- axiom-scan .tmp/subdomains_tlsx_clean.txt -m puredns-resolve \
+ run_command axiom-scan .tmp/subdomains_tlsx_clean.txt -m puredns-resolve \
-r ${AXIOM_RESOLVERS_PATH} --resolvers-trusted ${AXIOM_RESOLVERS_TRUSTED_PATH} \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-o .tmp/subdomains_tlsx_resolved.txt $AXIOM_EXTRA_ARGS \
@@ -775,7 +799,7 @@ function sub_noerror() {
# Check for DNSSEC black lies
random_subdomain="${RANDOM}thistotallynotexist${RANDOM}.$domain"
- dns_response=$(echo "$random_subdomain" | dnsx -r "$resolvers" -rcode noerror,nxdomain -retry 3 -silent | cut -d' ' -f2)
+ dns_response=$(echo "$random_subdomain" | dnsx -r "$resolvers" -rcode noerror,nxdomain -retry 3 -silent 2>>"$LOGFILE" | cut -d' ' -f2)
if [[ $dns_response == "[NXDOMAIN]" ]]; then
@@ -787,7 +811,7 @@ function sub_noerror() {
fi
# Run dnsx and check for errors
- dnsx -d "$domain" -r "$resolvers" -silent \
+ run_command dnsx -d "$domain" -r "$resolvers" -silent \
-rcode noerror -w "$wordlist" \
2>>"$LOGFILE" | cut -d' ' -f1 | anew -q .tmp/subs_noerror.txt >/dev/null
@@ -830,7 +854,7 @@ function sub_dns() {
start_subfunc "${FUNCNAME[0]}" "Running: DNS Subdomain Enumeration and PTR search"
if [[ -s "subdomains/subdomains.txt" ]]; then
- dnsx -r "$resolvers_trusted" -recon -silent -retry 3 -json \
+ run_command dnsx -r "$resolvers_trusted" -recon -silent -retry 3 -json \
-o "subdomains/subdomains_dnsregs.json" <"subdomains/subdomains.txt" 2>>"$LOGFILE" >/dev/null
fi
if [[ -s "subdomains/subdomains_dnsregs.json" ]]; then
@@ -840,7 +864,7 @@ function sub_dns() {
| sort -u | anew -q .tmp/subdomains_dns.txt
jq -r '.. | strings | select(test("^(\\d{1,3}\\.){3}\\d{1,3}$|^[0-9a-fA-F:]+$"))' <"subdomains/subdomains_dnsregs.json" \
- | sort -u | hakip2host | awk '{print $3}' | unfurl -u domains \
+ | sort -u | run_command hakip2host | awk '{print $3}' | unfurl -u domains \
| sed -e 's/^\*\.//' -e 's/\.$//' -e '/\./!d' | grep "\.${DOMAIN_ESCAPED}$" \
| grep -E '^([a-zA-Z0-9][-a-zA-Z0-9]*\.)+[a-zA-Z]{2,}$' | sort -u \
| anew -q .tmp/subdomains_dns.txt
@@ -849,7 +873,7 @@ function sub_dns() {
| sort -u \
| while IFS= read -r ip; do
[[ -z "$ip" ]] && continue
- curl -s "https://ip.thc.org/$ip" 2>>"$LOGFILE" \
+ run_command curl -s "https://ip.thc.org/$ip" 2>>"$LOGFILE" \
| grep "\.${DOMAIN_ESCAPED}$" \
| grep -E '^([a-zA-Z0-9][-a-zA-Z0-9]*\.)+[a-zA-Z]{2,}$' \
| sort -u \
@@ -862,7 +886,7 @@ function sub_dns() {
if [[ $AXIOM != true ]]; then
if [[ -s ".tmp/subdomains_dns.txt" ]]; then
- puredns resolve .tmp/subdomains_dns.txt -w .tmp/subdomains_dns_resolved.txt \
+ run_command puredns resolve .tmp/subdomains_dns.txt -w .tmp/subdomains_dns_resolved.txt \
-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" \
@@ -871,7 +895,7 @@ function sub_dns() {
else
if [[ -s ".tmp/subdomains_dns.txt" ]]; then
- axiom-scan .tmp/subdomains_dns.txt -m puredns-resolve \
+ run_command axiom-scan .tmp/subdomains_dns.txt -m puredns-resolve \
-r "${AXIOM_RESOLVERS_PATH}" --resolvers-trusted "${AXIOM_RESOLVERS_TRUSTED_PATH}" \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-o .tmp/subdomains_dns_resolved.txt "$AXIOM_EXTRA_ARGS" \
@@ -926,14 +950,14 @@ function sub_brute() {
[[ $DEEP == true ]] && wordlist="$subs_wordlist_big"
# Run puredns bruteforce
- puredns bruteforce "$wordlist" "$domain" -w .tmp/subs_brute.txt -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
+ run_command puredns bruteforce "$wordlist" "$domain" -w .tmp/subs_brute.txt -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
# Resolve the subdomains
if [[ -s ".tmp/subs_brute.txt" ]]; then
- puredns resolve .tmp/subs_brute.txt -w .tmp/subs_brute_valid.txt -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
+ run_command puredns resolve .tmp/subs_brute.txt -w .tmp/subs_brute_valid.txt -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
@@ -945,14 +969,14 @@ function sub_brute() {
[[ $DEEP == true ]] && wordlist="$subs_wordlist_big"
# Run axiom-scan with puredns-single
- axiom-scan "$wordlist" -m puredns-single "$domain" -r ${AXIOM_RESOLVERS_PATH} \
+ run_command axiom-scan "$wordlist" -m puredns-single "$domain" -r ${AXIOM_RESOLVERS_PATH} \
--resolvers-trusted ${AXIOM_RESOLVERS_TRUSTED_PATH} \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-o .tmp/subs_brute.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
# Resolve the subdomains using axiom-scan
if [[ -s ".tmp/subs_brute.txt" ]]; then
- axiom-scan .tmp/subs_brute.txt -m puredns-resolve -r "${AXIOM_RESOLVERS_PATH}" \
+ run_command axiom-scan .tmp/subs_brute.txt -m puredns-resolve -r "${AXIOM_RESOLVERS_PATH}" \
--resolvers-trusted "${AXIOM_RESOLVERS_TRUSTED_PATH}" \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-o .tmp/subs_brute_valid.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
@@ -960,19 +984,23 @@ function sub_brute() {
fi
# Check inscope if INSCOPE is true
- if [[ $INSCOPE == true ]]; then
+ if [[ $INSCOPE == true ]] && [[ -s ".tmp/subs_brute_valid.txt" ]]; then
if ! check_inscope .tmp/subs_brute_valid.txt 2>>"$LOGFILE" >/dev/null; then
print_warnf "check_inscope command failed."
- return 1
fi
fi
# Process subdomains and append new ones to subdomains.txt, count new lines
- if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/subs_brute_valid.txt 2>>"$LOGFILE" \
- | grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
- | sed 's/^\*\.//' | anew subdomains/subdomains.txt | sed '/^$/d' | wc -l); then
- print_warnf "Failed to process subdomains."
- return 1
+ if [[ -s ".tmp/subs_brute_valid.txt" ]]; then
+ if ! NUMOFLINES=$(grep "\.${DOMAIN_ESCAPED}$\|^${DOMAIN_ESCAPED}$" .tmp/subs_brute_valid.txt 2>>"$LOGFILE" \
+ | grep -E '^([a-zA-Z0-9\.\-]+\.)+[a-zA-Z]{1,}$' \
+ | sed 's/^\*\.//' | anew subdomains/subdomains.txt | sed '/^$/d' | wc -l); then
+ print_warnf "Failed to process subdomains."
+ NUMOFLINES=0
+ fi
+ else
+ NUMOFLINES=0
+ _print_msg WARN "No candidate subdomains produced by sub_brute; continuing."
fi
end_subfunc "${NUMOFLINES} new subs (bruteforce)" "${FUNCNAME[0]}"
@@ -1058,14 +1086,14 @@ function sub_scraping() {
fi
if [[ -s ".tmp/probed_tmp_scrap.txt" ]]; then
- cat .tmp/probed_tmp_scrap.txt | csprecon -s | grep -a "$domain" | sed "s/^\*\.//" | sort -u \
+ cat .tmp/probed_tmp_scrap.txt | run_command csprecon -s | grep -a "$domain" | sed "s/^\*\.//" | sort -u \
| unfurl -u domains 2>>"$LOGFILE" | anew -q .tmp/scrap_subs.txt || true
fi
else
# AXIOM mode
- axiom-scan subdomains/subdomains.txt -m httpx -follow-host-redirects -random-agent -status-code \
+ run_command axiom-scan subdomains/subdomains.txt -m httpx -follow-host-redirects -random-agent -status-code \
-threads "$HTTPX_THREADS" -rl "$HTTPX_RATELIMIT" -timeout "$HTTPX_TIMEOUT" -silent -retries 2 \
-title -web-server -tech-detect -location -no-color -json -o .tmp/web_full_info1.txt \
$AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
@@ -1081,14 +1109,14 @@ function sub_scraping() {
fi
if [[ -s ".tmp/probed_tmp_scrap.txt" ]]; then
- cat .tmp/probed_tmp_scrap.txt | csprecon -s | grep -a "$domain" | sed "s/^\*\.//" | sort -u \
+ cat .tmp/probed_tmp_scrap.txt | run_command csprecon -s | grep -a "$domain" | sed "s/^\*\.//" | sort -u \
| unfurl -u domains 2>>"$LOGFILE" | anew -q .tmp/scrap_subs.txt || true
fi
fi
if [[ -s ".tmp/scrap_subs.txt" ]]; then
- puredns resolve .tmp/scrap_subs.txt -w .tmp/scrap_subs_resolved.txt -r "$resolvers" \
+ run_command puredns resolve .tmp/scrap_subs.txt -w .tmp/scrap_subs_resolved.txt -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
@@ -1114,7 +1142,7 @@ function sub_scraping() {
fi
if [[ -s ".tmp/diff_scrap.txt" ]]; then
- httpx -follow-host-redirects -random-agent -status-code -threads "$HTTPX_THREADS" \
+ run_command httpx -follow-host-redirects -random-agent -status-code -threads "$HTTPX_THREADS" \
-rl "$HTTPX_RATELIMIT" -timeout "$HTTPX_TIMEOUT" -silent -retries 2 -title -web-server \
-tech-detect -location -no-color -json -o .tmp/web_full_info3.txt \
<.tmp/diff_scrap.txt 2>>"$LOGFILE" >/dev/null
@@ -1191,7 +1219,7 @@ function sub_analytics() {
if [[ $AXIOM != true ]]; then
if [[ -s ".tmp/analytics_subs_clean.txt" ]]; then
- puredns resolve .tmp/analytics_subs_clean.txt -w .tmp/analytics_subs_resolved.txt \
+ run_command puredns resolve .tmp/analytics_subs_clean.txt -w .tmp/analytics_subs_resolved.txt \
-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" \
@@ -1200,7 +1228,7 @@ function sub_analytics() {
else
if [[ -s ".tmp/analytics_subs_clean.txt" ]]; then
- axiom-scan .tmp/analytics_subs_clean.txt -m puredns-resolve \
+ run_command axiom-scan .tmp/analytics_subs_clean.txt -m puredns-resolve \
-r ${AXIOM_RESOLVERS_PATH} --resolvers-trusted ${AXIOM_RESOLVERS_TRUSTED_PATH} \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-o .tmp/analytics_subs_resolved.txt $AXIOM_EXTRA_ARGS \
@@ -1243,8 +1271,18 @@ function sub_permut() {
echo "$domain" >"$dir/subdomains/subdomains.txt"
fi
- # Determine the number of subdomains
- subdomain_count=$(wc -l <subdomains/subdomains.txt)
+ # Determine the number of subdomains safely (avoid noisy stderr on dry-run)
+ local subdomain_count subs_no_resolved_count
+ subdomain_count=0
+ subs_no_resolved_count=0
+ [[ -s "subdomains/subdomains.txt" ]] && subdomain_count=$(wc -l <subdomains/subdomains.txt 2>/dev/null || echo 0)
+ [[ -s ".tmp/subs_no_resolved.txt" ]] && subs_no_resolved_count=$(wc -l <.tmp/subs_no_resolved.txt 2>/dev/null || echo 0)
+
+ if [[ "$subdomain_count" -eq 0 && "$subs_no_resolved_count" -eq 0 ]]; then
+ _print_msg WARN "No candidate subdomains available for permutations; skipping."
+ end_subfunc "0 new subs (permutations)" "${FUNCNAME[0]}" "SKIP"
+ return 0
+ fi
# Check if DEEP mode is enabled or subdomains are within DEEP_LIMIT
if [[ $DEEP == true ]] || [[ $subdomain_count -le $DEEP_LIMIT ]]; then
@@ -1252,26 +1290,26 @@ function sub_permut() {
# Select the permutations tool
if [[ $PERMUTATIONS_OPTION == "gotator" ]]; then
if [[ -s "subdomains/subdomains.txt" ]]; then
- gotator -sub subdomains/subdomains.txt -perm "${tools}/permutations_list.txt" $GOTATOR_FLAGS \
+ run_command gotator -sub subdomains/subdomains.txt -perm "${tools}/permutations_list.txt" $GOTATOR_FLAGS \
-silent 2>>"$LOGFILE" | head -c "$PERMUTATIONS_LIMIT" >.tmp/gotator1.txt
fi
else
if [[ -s "subdomains/subdomains.txt" ]]; then
- ripgen -d subdomains/subdomains.txt -w "${tools}/permutations_list.txt" \
+ run_command ripgen -d subdomains/subdomains.txt -w "${tools}/permutations_list.txt" \
2>>"$LOGFILE" | head -c "$PERMUTATIONS_LIMIT" >.tmp/gotator1.txt
fi
fi
- elif [[ "$(wc -l <.tmp/subs_no_resolved.txt)" -le $DEEP_LIMIT2 ]]; then
+ elif [[ "$subs_no_resolved_count" -le $DEEP_LIMIT2 ]]; then
if [[ $PERMUTATIONS_OPTION == "gotator" ]]; then
if [[ -s ".tmp/subs_no_resolved.txt" ]]; then
- gotator -sub .tmp/subs_no_resolved.txt -perm "${tools}/permutations_list.txt" $GOTATOR_FLAGS \
+ run_command gotator -sub .tmp/subs_no_resolved.txt -perm "${tools}/permutations_list.txt" $GOTATOR_FLAGS \
-silent 2>>"$LOGFILE" | head -c "$PERMUTATIONS_LIMIT" >.tmp/gotator1.txt
fi
else
if [[ -s ".tmp/subs_no_resolved.txt" ]]; then
- ripgen -d .tmp/subs_no_resolved.txt -w "${tools}/permutations_list.txt" \
+ run_command ripgen -d .tmp/subs_no_resolved.txt -w "${tools}/permutations_list.txt" \
2>>"$LOGFILE" | head -c "$PERMUTATIONS_LIMIT" >.tmp/gotator1.txt
fi
fi
@@ -1284,14 +1322,14 @@ function sub_permut() {
# Resolve the permutations
if [[ $AXIOM != true ]]; then
if [[ -s ".tmp/gotator1.txt" ]]; then
- puredns resolve .tmp/gotator1.txt -w .tmp/permute1.txt -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
+ run_command puredns resolve .tmp/gotator1.txt -w .tmp/permute1.txt -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
-l "$PUREDNS_PUBLIC_LIMIT" --rate-limit-trusted "$PUREDNS_TRUSTED_LIMIT" \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
2>>"$LOGFILE" >/dev/null
fi
else
if [[ -s ".tmp/gotator1.txt" ]]; then
- axiom-scan .tmp/gotator1.txt -m puredns-resolve -r "${AXIOM_RESOLVERS_PATH}" \
+ run_command axiom-scan .tmp/gotator1.txt -m puredns-resolve -r "${AXIOM_RESOLVERS_PATH}" \
--resolvers-trusted "${AXIOM_RESOLVERS_TRUSTED_PATH}" \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-o .tmp/permute1.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
@@ -1301,12 +1339,12 @@ function sub_permut() {
# Generate second round of permutations
if [[ $PERMUTATIONS_OPTION == "gotator" ]]; then
if [[ -s ".tmp/permute1.txt" ]]; then
- gotator -sub .tmp/permute1.txt -perm "${tools}/permutations_list.txt" \
+ run_command gotator -sub .tmp/permute1.txt -perm "${tools}/permutations_list.txt" \
$GOTATOR_FLAGS -silent 2>>"$LOGFILE" | head -c "$PERMUTATIONS_LIMIT" >.tmp/gotator2.txt
fi
else
if [[ -s ".tmp/permute1.txt" ]]; then
- ripgen -d .tmp/permute1.txt -w "${tools}/permutations_list.txt" \
+ run_command ripgen -d .tmp/permute1.txt -w "${tools}/permutations_list.txt" \
2>>"$LOGFILE" | head -c "$PERMUTATIONS_LIMIT" >.tmp/gotator2.txt
fi
fi
@@ -1314,14 +1352,14 @@ function sub_permut() {
# Resolve the second round of permutations
if [[ $AXIOM != true ]]; then
if [[ -s ".tmp/gotator2.txt" ]]; then
- puredns resolve .tmp/gotator2.txt -w .tmp/permute2.txt -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
+ run_command puredns resolve .tmp/gotator2.txt -w .tmp/permute2.txt -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
fi
else
if [[ -s ".tmp/gotator2.txt" ]]; then
- axiom-scan .tmp/gotator2.txt -m puredns-resolve -r "${AXIOM_RESOLVERS_PATH}" \
+ run_command axiom-scan .tmp/gotator2.txt -m puredns-resolve -r "${AXIOM_RESOLVERS_PATH}" \
--resolvers-trusted "${AXIOM_RESOLVERS_TRUSTED_PATH}" \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-o .tmp/permute2.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
@@ -1393,7 +1431,7 @@ function sub_regex_permut() {
fi
# Run the main.py script
- "${tools}/regulator/venv/bin/python3" main.py -t "$domain" -f "${dir}/subdomains/subdomains.txt" -o "${dir}/.tmp/${domain}.brute" \
+ run_command "${tools}/regulator/venv/bin/python3" main.py -t "$domain" -f "${dir}/subdomains/subdomains.txt" -o "${dir}/.tmp/${domain}.brute" \
2>>"$LOGFILE" >/dev/null
# Return to the previous directory
@@ -1406,7 +1444,7 @@ function sub_regex_permut() {
if [[ $AXIOM != true ]]; then
if [[ -s ".tmp/${domain}.brute" ]]; then
- puredns resolve ".tmp/${domain}.brute" -w .tmp/regulator.txt -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
+ run_command puredns resolve ".tmp/${domain}.brute" -w .tmp/regulator.txt -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
@@ -1414,7 +1452,7 @@ function sub_regex_permut() {
else
if [[ -s ".tmp/${domain}.brute" ]]; then
- axiom-scan ".tmp/${domain}.brute" -m puredns-resolve \
+ run_command axiom-scan ".tmp/${domain}.brute" -m puredns-resolve \
-r ${AXIOM_RESOLVERS_PATH} --resolvers-trusted ${AXIOM_RESOLVERS_TRUSTED_PATH} \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-o .tmp/regulator.txt $AXIOM_EXTRA_ARGS \
@@ -1477,7 +1515,7 @@ function sub_ia_permut() {
if [[ $AXIOM != true ]]; then
if [[ -s ".tmp/subwiz.txt" ]]; then
- puredns resolve ".tmp/subwiz.txt" -w .tmp/subwiz_resolved.txt -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
+ run_command puredns resolve ".tmp/subwiz.txt" -w .tmp/subwiz_resolved.txt -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
@@ -1485,7 +1523,7 @@ function sub_ia_permut() {
else
if [[ -s ".tmp/subwiz.txt" ]]; then
- axiom-scan ".tmp/subwiz.txt" -m puredns-resolve \
+ run_command axiom-scan ".tmp/subwiz.txt" -m puredns-resolve \
-r ${AXIOM_RESOLVERS_PATH} --resolvers-trusted ${AXIOM_RESOLVERS_TRUSTED_PATH} \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-o .tmp/subwiz_resolved.txt $AXIOM_EXTRA_ARGS \
@@ -1555,7 +1593,7 @@ function sub_recursive_passive() {
if [[ $AXIOM != true ]]; then
if [[ -s ".tmp/subdomains_recurs_top.txt" ]]; then
- subfinder -all -dL .tmp/subdomains_recurs_top.txt -max-time "${SUBFINDER_ENUM_TIMEOUT}" \
+ run_command subfinder -all -dL .tmp/subdomains_recurs_top.txt -max-time "${SUBFINDER_ENUM_TIMEOUT}" \
-silent -o .tmp/passive_recursive_tmp.txt 2>>"$LOGFILE"
else
return 1
@@ -1566,7 +1604,7 @@ function sub_recursive_passive() {
fi
if [[ -s ".tmp/passive_recursive.txt" ]]; then
- puredns resolve .tmp/passive_recursive.txt -w .tmp/passive_recurs_tmp.txt -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
+ run_command puredns resolve .tmp/passive_recursive.txt -w .tmp/passive_recurs_tmp.txt -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
@@ -1575,7 +1613,7 @@ function sub_recursive_passive() {
else
if [[ -s ".tmp/subdomains_recurs_top.txt" ]]; then
- axiom-scan .tmp/subdomains_recurs_top.txt -m subfinder -all -o .tmp/subfinder_prec.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
+ run_command axiom-scan .tmp/subdomains_recurs_top.txt -m subfinder -all -o .tmp/subfinder_prec.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
else
return 1
fi
@@ -1585,7 +1623,7 @@ function sub_recursive_passive() {
fi
if [[ -s ".tmp/passive_recursive.txt" ]]; then
- axiom-scan .tmp/passive_recursive.txt -m puredns-resolve \
+ run_command axiom-scan .tmp/passive_recursive.txt -m puredns-resolve \
-r ${AXIOM_RESOLVERS_PATH} --resolvers-trusted ${AXIOM_RESOLVERS_TRUSTED_PATH} \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-o .tmp/passive_recurs_tmp.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
@@ -1650,13 +1688,13 @@ function sub_recursive_brute() {
for subdomain_top in $(cat .tmp/subdomains_recurs_top.txt); do
if [[ $AXIOM != true ]]; then
- puredns bruteforce "$subs_wordlist" "$subdomain_top" -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
+ run_command puredns bruteforce "$subs_wordlist" "$subdomain_top" -r "$resolvers" --resolvers-trusted "$resolvers_trusted" \
-l "$PUREDNS_PUBLIC_LIMIT" --rate-limit-trusted "$PUREDNS_TRUSTED_LIMIT" \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-w .tmp/brute_recursive_result_part.txt 2>>"$LOGFILE" >/dev/null
cat .tmp/brute_recursive_result_part.txt | anew -q .tmp/brute_recursive.txt
else
- axiom-scan "$subs_wordlist" -m puredns-single "$subdomain_top" \
+ run_command axiom-scan "$subs_wordlist" -m puredns-single "$subdomain_top" \
-r ${AXIOM_RESOLVERS_PATH} --resolvers-trusted ${AXIOM_RESOLVERS_TRUSTED_PATH} \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-o .tmp/brute_recursive_result_part.txt $AXIOM_EXTRA_ARGS \
@@ -1668,12 +1706,12 @@ function sub_recursive_brute() {
# Generate permutations
if [[ $PERMUTATIONS_OPTION == "gotator" ]]; then
if [[ -s ".tmp/brute_recursive.txt" ]]; then
- gotator -sub .tmp/brute_recursive.txt -perm "${tools}/permutations_list.txt" $GOTATOR_FLAGS -silent \
+ run_command gotator -sub .tmp/brute_recursive.txt -perm "${tools}/permutations_list.txt" $GOTATOR_FLAGS -silent \
2>>"$LOGFILE" | head -c "$PERMUTATIONS_LIMIT" >.tmp/gotator1_recursive.txt
fi
else
if [[ -s ".tmp/brute_recursive.txt" ]]; then
- ripgen -d .tmp/brute_recursive.txt -w "${tools}/permutations_list.txt" \
+ run_command ripgen -d .tmp/brute_recursive.txt -w "${tools}/permutations_list.txt" \
2>>"$LOGFILE" | head -c "$PERMUTATIONS_LIMIT" >.tmp/gotator1_recursive.txt
fi
fi
@@ -1681,7 +1719,7 @@ function sub_recursive_brute() {
# Resolve permutations
if [[ $AXIOM != true ]]; then
if [[ -s ".tmp/gotator1_recursive.txt" ]]; then
- puredns resolve .tmp/gotator1_recursive.txt -w .tmp/permute1_recursive.txt \
+ run_command puredns resolve .tmp/gotator1_recursive.txt -w .tmp/permute1_recursive.txt \
-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" \
@@ -1689,7 +1727,7 @@ function sub_recursive_brute() {
fi
else
if [[ -s ".tmp/gotator1_recursive.txt" ]]; then
- axiom-scan .tmp/gotator1_recursive.txt -m puredns-resolve \
+ run_command axiom-scan .tmp/gotator1_recursive.txt -m puredns-resolve \
-r ${AXIOM_RESOLVERS_PATH} --resolvers-trusted ${AXIOM_RESOLVERS_TRUSTED_PATH} \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-o .tmp/permute1_recursive.txt $AXIOM_EXTRA_ARGS \
@@ -1700,12 +1738,12 @@ function sub_recursive_brute() {
# Second round of permutations
if [[ $PERMUTATIONS_OPTION == "gotator" ]]; then
if [[ -s ".tmp/permute1_recursive.txt" ]]; then
- gotator -sub .tmp/permute1_recursive.txt -perm "${tools}/permutations_list.txt" $GOTATOR_FLAGS -silent \
+ run_command gotator -sub .tmp/permute1_recursive.txt -perm "${tools}/permutations_list.txt" $GOTATOR_FLAGS -silent \
2>>"$LOGFILE" | head -c "$PERMUTATIONS_LIMIT" >.tmp/gotator2_recursive.txt
fi
else
if [[ -s ".tmp/permute1_recursive.txt" ]]; then
- ripgen -d .tmp/permute1_recursive.txt -w "${tools}/permutations_list.txt" \
+ run_command ripgen -d .tmp/permute1_recursive.txt -w "${tools}/permutations_list.txt" \
2>>"$LOGFILE" | head -c "$PERMUTATIONS_LIMIT" >.tmp/gotator2_recursive.txt
fi
fi
@@ -1713,7 +1751,7 @@ function sub_recursive_brute() {
# Resolve second round of permutations
if [[ $AXIOM != true ]]; then
if [[ -s ".tmp/gotator2_recursive.txt" ]]; then
- puredns resolve .tmp/gotator2_recursive.txt -w .tmp/permute2_recursive.txt \
+ run_command puredns resolve .tmp/gotator2_recursive.txt -w .tmp/permute2_recursive.txt \
-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" \
@@ -1721,7 +1759,7 @@ function sub_recursive_brute() {
fi
else
if [[ -s ".tmp/gotator2_recursive.txt" ]]; then
- axiom-scan .tmp/gotator2_recursive.txt -m puredns-resolve \
+ run_command axiom-scan .tmp/gotator2_recursive.txt -m puredns-resolve \
-r ${AXIOM_RESOLVERS_PATH} --resolvers-trusted ${AXIOM_RESOLVERS_TRUSTED_PATH} \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-o .tmp/permute2_recursive.txt $AXIOM_EXTRA_ARGS \
@@ -1763,7 +1801,7 @@ function sub_recursive_brute() {
# Final resolve
if [[ $AXIOM != true ]]; then
if [[ -s ".tmp/brute_perm_recursive.txt" ]]; then
- puredns resolve .tmp/brute_perm_recursive.txt -w .tmp/brute_perm_recursive_final.txt \
+ run_command puredns resolve .tmp/brute_perm_recursive.txt -w .tmp/brute_perm_recursive_final.txt \
-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" \
@@ -1771,7 +1809,7 @@ function sub_recursive_brute() {
fi
else
if [[ -s ".tmp/brute_perm_recursive.txt" ]]; then
- axiom-scan .tmp/brute_perm_recursive.txt -m puredns-resolve \
+ run_command axiom-scan .tmp/brute_perm_recursive.txt -m puredns-resolve \
-r ${AXIOM_RESOLVERS_PATH} --resolvers-trusted ${AXIOM_RESOLVERS_TRUSTED_PATH} \
--wildcard-tests "$PUREDNS_WILDCARDTEST_LIMIT" --wildcard-batch "$PUREDNS_WILDCARDBATCH_LIMIT" \
-o .tmp/brute_perm_recursive_final.txt $AXIOM_EXTRA_ARGS \
@@ -1913,8 +1951,8 @@ function zonetransfer() {
fi
# Perform zone transfer check
- for ns in $(dig +short ns "$domain" 2>/dev/null); do
- dig axfr "${domain}" @"$ns" 2>>"$LOGFILE" | tee -a "subdomains/zonetransfer.txt" >/dev/null
+ for ns in $(run_command dig +short ns "$domain" 2>/dev/null); do
+ run_command dig axfr "${domain}" @"$ns" 2>>"$LOGFILE" | tee -a "subdomains/zonetransfer.txt" >/dev/null
done
# Check if zone transfer was successful
@@ -1964,10 +2002,10 @@ function s3buckets() {
# S3Scanner
if [[ $AXIOM != true ]]; then
if [[ -s "subdomains/subdomains.txt" ]]; then
- s3scanner -bucket-file subdomains/subdomains.txt 2>>"$LOGFILE" | anew -q .tmp/s3buckets.txt
+ run_command s3scanner -bucket-file subdomains/subdomains.txt 2>>"$LOGFILE" | anew -q .tmp/s3buckets.txt
fi
else
- axiom-scan subdomains/subdomains.txt -m s3scanner -o .tmp/s3buckets_tmp.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
+ run_command axiom-scan subdomains/subdomains.txt -m s3scanner -o .tmp/s3buckets_tmp.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
if [[ -s ".tmp/s3buckets_tmp.txt" ]]; then
if ! cat .tmp/s3buckets_tmp.txt .tmp/s3buckets_tmp2.txt 2>>"$LOGFILE" | anew -q .tmp/s3buckets.txt; then
@@ -2045,10 +2083,10 @@ function s3buckets() {
return 1
fi
if [[ -n "$permutation_file" ]]; then
- if ! PYTHONWARNINGS=ignore "${tools}/CloudHunter/venv/bin/python3" -W ignore ./cloudhunter.py "$PERMUTATION_FLAG" "$permutation_file" -r ./resolvers.txt -t 50 "$domain"; then
+ if ! run_command env PYTHONWARNINGS=ignore "${tools}/CloudHunter/venv/bin/python3" -W ignore ./cloudhunter.py "$PERMUTATION_FLAG" "$permutation_file" -r ./resolvers.txt -t 50 "$domain"; then
print_warnf "CloudHunter command failed for domain %s." "$domain"
fi
- elif ! PYTHONWARNINGS=ignore "${tools}/CloudHunter/venv/bin/python3" -W ignore ./cloudhunter.py -r ./resolvers.txt -t 50 "$domain"; then
+ elif ! run_command env PYTHONWARNINGS=ignore "${tools}/CloudHunter/venv/bin/python3" -W ignore ./cloudhunter.py -r ./resolvers.txt -t 50 "$domain"; then
print_warnf "CloudHunter command failed for domain %s." "$domain"
fi
) >>"$dir/subdomains/cloudhunter_open_buckets.txt" 2>>"$LOGFILE"
@@ -2082,7 +2120,7 @@ function s3buckets() {
# Run trufflehog for S3 buckets
if [[ -s "subdomains/s3buckets.txt" ]]; then
while IFS= read -r bucket; do
- trufflehog s3 --bucket="$bucket" -j 2>/dev/null | jq -c | anew -q subdomains/s3buckets_trufflehog.txt
+ run_command trufflehog s3 --bucket="$bucket" -j 2>/dev/null | jq -c | anew -q subdomains/s3buckets_trufflehog.txt
done <subdomains/s3buckets.txt
fi
@@ -2092,11 +2130,11 @@ function s3buckets() {
if echo "$line" | grep -q "Aws Cloud"; then
# AWS S3 Bucket
bucket_name=$(echo "$line" | awk '{print $3}')
- trufflehog s3 --bucket="$bucket_name" -j 2>/dev/null | jq -c | anew -q subdomains/cloudhunter_buckets_trufflehog.txt
+ run_command trufflehog s3 --bucket="$bucket_name" -j 2>/dev/null | jq -c | anew -q subdomains/cloudhunter_buckets_trufflehog.txt
elif echo "$line" | grep -q "Google Cloud"; then
# Google Cloud Storage
bucket_name=$(echo "$line" | awk '{print $3}')
- trufflehog gcs --project-id="$bucket_name" -j 2>/dev/null | jq -c | anew -q subdomains/cloudhunter_buckets_trufflehog.txt
+ run_command trufflehog gcs --project-id="$bucket_name" -j 2>/dev/null | jq -c | anew -q subdomains/cloudhunter_buckets_trufflehog.txt
fi
done <subdomains/cloudhunter_open_buckets.txt
fi
@@ -2141,27 +2179,27 @@ function cloud_extra_providers() {
for u in \
"https://storage.googleapis.com/$name/" \
"https://$name.storage.googleapis.com/"; do
- code=$(curl -sk -o /dev/null -w '%{http_code}' "$u" || true)
+ code=$(run_command curl -sk -o /dev/null -w '%{http_code}' "$u" || true)
if [[ $code =~ ^20|403$ ]]; then printf "GCS %s %s\n" "$name" "$u" | anew -q subdomains/cloud_extra.txt; fi
done
# Azure Blob (requires container; try a few)
while IFS= read -r c; do
u="https://$name.blob.core.windows.net/$c?restype=container&comp=list"
- code=$(curl -sk -o /dev/null -w '%{http_code}' "$u" || true)
+ code=$(run_command curl -sk -o /dev/null -w '%{http_code}' "$u" || true)
if [[ $code =~ ^20|403$ ]]; then printf "AZURE %s %s\n" "$name/$c" "$u" | anew -q subdomains/cloud_extra.txt; fi
done <.tmp/azcontainers.txt
# DigitalOcean Spaces (regional)
for r in ams3 nyc3 sfo3 sgp1 fra1 blr1; do
u="https://$name.$r.digitaloceanspaces.com/"
- code=$(curl -sk -o /dev/null -w '%{http_code}' "$u" || true)
+ code=$(run_command curl -sk -o /dev/null -w '%{http_code}' "$u" || true)
if [[ $code =~ ^20|403$ ]]; then printf "DOSPACE %s %s\n" "$name.$r" "$u" | anew -q subdomains/cloud_extra.txt; fi
done
# Backblaze B2 (best-effort listing)
u="https://f000.backblazeb2.com/file/$name/"
- code=$(curl -sk -o /dev/null -w '%{http_code}' "$u" || true)
+ code=$(run_command curl -sk -o /dev/null -w '%{http_code}' "$u" || true)
if [[ $code =~ ^20|403$ ]]; then printf "B2 %s %s\n" "$name" "$u" | anew -q subdomains/cloud_extra.txt; fi
done <.tmp/cloudnames.txt
@@ -2220,7 +2258,7 @@ function geo_info() {
fi
while IFS= read -r ip; do
- curl -s "https://ipinfo.io/widget/demo/$ip" >>"${dir}/hosts/ipinfo.txt"
+ run_command curl -s "https://ipinfo.io/widget/demo/$ip" >>"${dir}/hosts/ipinfo.txt"
done <"$ips_file"
fi
diff --git a/modules/utils.sh b/modules/utils.sh
index d9cb114..ffc481f 100644
--- a/modules/utils.sh
+++ b/modules/utils.sh
@@ -342,7 +342,26 @@ function progress_bar() {
# Usage: run_command <command> [args...]
function run_command() {
if [[ "${DRY_RUN:-false}" == "true" ]]; then
- printf "%b[DRY-RUN] Would execute: %s%b\n" "$yellow" "$*" "$reset"
+ # Extract tool name (first word, strip path)
+ local tool_name="${1##*/}"
+ local full_cmd="$*"
+ local redacted_cmd="$full_cmd"
+
+ if declare -F redact_secrets >/dev/null 2>&1; then
+ redacted_cmd=$(redact_secrets "$redacted_cmd")
+ fi
+ redacted_cmd=$(echo "$redacted_cmd" \
+ | sed -E 's/(-token-string[[:space:]]+)[^[:space:]]+/\1[REDACTED]/g' \
+ | sed -E 's/([?&]apiKey=)[^&[:space:]]+/\1[REDACTED]/g' \
+ | sed -E 's/(Authorization:[[:space:]]*Bearer[[:space:]])[^[:space:]]+/\1[REDACTED]/g')
+
+ # Track command for module summary
+ if declare -F ui_dryrun_track >/dev/null 2>&1; then
+ ui_dryrun_track "$tool_name" "$redacted_cmd"
+ else
+ # Fallback to old behavior if ui_dryrun_track not available
+ printf "%b[DRY-RUN] Would execute: %s%b\n" "$yellow" "$redacted_cmd" "$reset"
+ fi
return 0
fi
@@ -705,7 +724,7 @@ function cached_download_typed() {
printf "%b[%s] Downloading: %s%b\n" \
"$bblue" "$(date +'%Y-%m-%d %H:%M:%S')" "$(basename "$url")" "$reset"
- if curl -sL "$url" -o "$destination"; then
+ if run_command curl -sL "$url" -o "$destination"; then
# Save to cache for future use
cp "$destination" "$cache_file"
printf "%b[%s] Cached for future use: %s%b\n" \
diff --git a/modules/vulns.sh b/modules/vulns.sh
index 479f3b3..06b8eb9 100644
--- a/modules/vulns.sh
+++ b/modules/vulns.sh
@@ -24,7 +24,7 @@ function xss() {
# Process gf/xss.txt with qsreplace and Gxss
if [[ -s "gf/xss.txt" ]]; then
_print_msg INFO "Running: XSS Payload Generation"
- qsreplace FUZZ <"gf/xss.txt" | sed '/FUZZ/!d' | Gxss -c 100 -p Xss | qsreplace FUZZ | sed '/FUZZ/!d' \
+ run_command qsreplace FUZZ <"gf/xss.txt" | sed '/FUZZ/!d' | Gxss -c 100 -p Xss | qsreplace FUZZ | sed '/FUZZ/!d' \
| anew -q ".tmp/xss_reflected.txt"
fi
@@ -72,7 +72,7 @@ function xss() {
# Run Dalfox with Axiom-scan output
if [[ -s ".tmp/xss_reflected.txt" ]]; then
_print_msg INFO "Running: Dalfox with Axiom"
- axiom-scan ".tmp/xss_reflected.txt" -m dalfox --skip-bav $OPTIONS -d "$DEPTH" -o "vulns/xss.txt" $AXIOM_ARGS 2>>"$LOGFILE" >/dev/null
+ run_command axiom-scan ".tmp/xss_reflected.txt" -m dalfox --skip-bav $OPTIONS -d "$DEPTH" -o "vulns/xss.txt" $AXIOM_ARGS 2>>"$LOGFILE" >/dev/null
fi
fi
@@ -109,7 +109,7 @@ function cors() {
# Proceed only if webs_all.txt exists and is non-empty
if [[ -s "webs/webs_all.txt" ]]; then
_print_msg INFO "Running: Corsy for CORS Scan"
- "${tools}/Corsy/venv/bin/python3" "${tools}/Corsy/corsy.py" -i "webs/webs_all.txt" -o "vulns/cors.txt" 2>>"$LOGFILE" >/dev/null
+ run_command "${tools}/Corsy/venv/bin/python3" "${tools}/Corsy/corsy.py" -i "webs/webs_all.txt" -o "vulns/cors.txt" 2>>"$LOGFILE" >/dev/null
else
end_func "No webs/webs_all.txt file found, CORS Scan skipped." "${FUNCNAME[0]}"
return
@@ -148,10 +148,10 @@ function open_redirect() {
_print_msg INFO "Running: Open Redirects Payload Generation"
# Process redirect.txt with qsreplace and filter lines containing 'FUZZ'
- qsreplace FUZZ <"gf/redirect.txt" | sed '/FUZZ/!d' | anew -q ".tmp/tmp_redirect.txt"
+ run_command qsreplace FUZZ <"gf/redirect.txt" | sed '/FUZZ/!d' | anew -q ".tmp/tmp_redirect.txt"
# Run Oralyzer with the generated payloads
- "${tools}/Oralyzer/venv/bin/python3" "${tools}/Oralyzer/oralyzer.py" -l ".tmp/tmp_redirect.txt" -p "${tools}/Oralyzer/payloads.txt" >"vulns/redirect.txt" 2>>"$LOGFILE"
+ run_command "${tools}/Oralyzer/venv/bin/python3" "${tools}/Oralyzer/oralyzer.py" -l ".tmp/tmp_redirect.txt" -p "${tools}/Oralyzer/payloads.txt" >"vulns/redirect.txt" 2>>"$LOGFILE"
# Remove ANSI color codes from the output
sed -r -i "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" "vulns/redirect.txt"
@@ -207,9 +207,9 @@ function ssrf_checks() {
_print_msg INFO "Running: SSRF Payload Generation"
# Generate temporary SSRF payloads
- qsreplace "$COLLAB_SERVER_FIX" <"gf/ssrf.txt" | anew -q ".tmp/tmp_ssrf.txt"
+ run_command qsreplace "$COLLAB_SERVER_FIX" <"gf/ssrf.txt" | anew -q ".tmp/tmp_ssrf.txt"
- qsreplace "$COLLAB_SERVER_URL" <"gf/ssrf.txt" | anew -q ".tmp/tmp_ssrf.txt"
+ run_command qsreplace "$COLLAB_SERVER_URL" <"gf/ssrf.txt" | anew -q ".tmp/tmp_ssrf.txt"
# Run FFUF to find requested URLs
_print_msg INFO "Running: FFUF for SSRF Requested URLs"
@@ -285,7 +285,7 @@ function crlf_checks() {
_print_msg INFO "Running: CRLF Fuzzing"
# Run CRLFuzz
- crlfuzz -l "webs/webs_all.txt" -o "vulns/crlf.txt" 2>>"$LOGFILE" >/dev/null
+ run_command crlfuzz -l "webs/webs_all.txt" -o "vulns/crlf.txt" 2>>"$LOGFILE" >/dev/null
end_func "Results are saved in vulns/crlf.txt" "${FUNCNAME[0]}"
else
@@ -320,7 +320,7 @@ function lfi() {
_print_msg INFO "Running: LFI Payload Generation"
# Process lfi.txt with qsreplace and filter lines containing 'FUZZ'
- qsreplace "FUZZ" <"gf/lfi.txt" | sed '/FUZZ/!d' | anew -q ".tmp/tmp_lfi.txt"
+ run_command qsreplace "FUZZ" <"gf/lfi.txt" | sed '/FUZZ/!d' | anew -q ".tmp/tmp_lfi.txt"
# Determine whether to proceed based on DEEP flag or number of URLs
URL_COUNT=$(wc -l <".tmp/tmp_lfi.txt")
@@ -329,7 +329,7 @@ function lfi() {
_print_msg INFO "Running: LFI Fuzzing with FFUF"
# Use Interlace to parallelize FFUF scanning
- interlace -tL ".tmp/tmp_lfi.txt" -threads "$INTERLACE_THREADS" -c "ffuf -v -r -t ${FFUF_THREADS} -rate ${FFUF_RATELIMIT} -H \"${HEADER}\" -w \"${lfi_wordlist}\" -u \"_target_\" -mr \"root:\" " 2>>"$LOGFILE" \
+ run_command interlace -tL ".tmp/tmp_lfi.txt" -threads "$INTERLACE_THREADS" -c "ffuf -v -r -t ${FFUF_THREADS} -rate ${FFUF_RATELIMIT} -H \"${HEADER}\" -w \"${lfi_wordlist}\" -u \"_target_\" -mr \"root:\" " 2>>"$LOGFILE" \
| grep "URL" | sed 's/| URL | //' | anew -q "vulns/lfi.txt"
end_func "Results are saved in vulns/lfi.txt" "${FUNCNAME[0]}"
@@ -369,7 +369,7 @@ function ssti() {
_print_msg INFO "Running: SSTI Payload Generation"
# Process ssti.txt with qsreplace and filter lines containing 'FUZZ'
- qsreplace "FUZZ" <"gf/ssti.txt" | sed '/FUZZ/!d' | anew -q ".tmp/tmp_ssti.txt"
+ run_command qsreplace "FUZZ" <"gf/ssti.txt" | sed '/FUZZ/!d' | anew -q ".tmp/tmp_ssti.txt"
# Determine whether to proceed based on DEEP flag or number of URLs
URL_COUNT=$(wc -l <".tmp/tmp_ssti.txt")
@@ -378,7 +378,7 @@ function ssti() {
_print_msg INFO "Running: SSTI Fuzzing with FFUF"
# Use Interlace to parallelize FFUF scanning
- interlace -tL ".tmp/tmp_ssti.txt" -threads "$INTERLACE_THREADS" -c "ffuf -v -r -t ${FFUF_THREADS} -rate ${FFUF_RATELIMIT} -H \"${HEADER}\" -w \"${ssti_wordlist}\" -u \"_target_\" -mr \"ssti49\"" 2>>"$LOGFILE" \
+ run_command interlace -tL ".tmp/tmp_ssti.txt" -threads "$INTERLACE_THREADS" -c "ffuf -v -r -t ${FFUF_THREADS} -rate ${FFUF_RATELIMIT} -H \"${HEADER}\" -w \"${ssti_wordlist}\" -u \"_target_\" -mr \"ssti49\"" 2>>"$LOGFILE" \
| grep "URL" | sed 's/| URL | //' | anew -q "vulns/ssti.txt"
end_func "Results are saved in vulns/ssti.txt" "${FUNCNAME[0]}"
@@ -418,7 +418,7 @@ function sqli() {
_print_msg INFO "Running: SQLi Payload Generation"
# Process sqli.txt with qsreplace and filter lines containing 'FUZZ'
- qsreplace "FUZZ" <"gf/sqli.txt" | sed '/FUZZ/!d' | anew -q ".tmp/tmp_sqli.txt"
+ run_command qsreplace "FUZZ" <"gf/sqli.txt" | sed '/FUZZ/!d' | anew -q ".tmp/tmp_sqli.txt"
# Determine whether to proceed based on DEEP flag or number of URLs
URL_COUNT=$(wc -l <".tmp/tmp_sqli.txt")
@@ -433,7 +433,7 @@ function sqli() {
# Check if GHAURI is enabled and run Ghauri
if [[ $GHAURI == true ]]; then
_print_msg INFO "Running: Ghauri for SQLi Checks"
- interlace -tL ".tmp/tmp_sqli.txt" -threads "$INTERLACE_THREADS" -c "ghauri -u _target_ --batch -H \"${HEADER}\" --force-ssl >> vulns/ghauri_log.txt" 2>>"$LOGFILE" >/dev/null
+ run_command interlace -tL ".tmp/tmp_sqli.txt" -threads "$INTERLACE_THREADS" -c "ghauri -u _target_ --batch -H \"${HEADER}\" --force-ssl >> vulns/ghauri_log.txt" 2>>"$LOGFILE" >/dev/null
fi
end_func "Results are saved in vulns/sqlmap folder" "${FUNCNAME[0]}"
@@ -474,7 +474,7 @@ function test_ssl() {
# Run testssl.sh
_print_msg INFO "Running: SSL Test with testssl.sh"
- "${tools}/testssl.sh/testssl.sh" --quiet --color 0 -U -iL "$dir/hosts/ips.txt" 2>>"$LOGFILE" >"vulns/testssl.txt"
+ run_command "${tools}/testssl.sh/testssl.sh" --quiet --color 0 -U -iL "$dir/hosts/ips.txt" 2>>"$LOGFILE" >"vulns/testssl.txt"
end_func "Results are saved in vulns/testssl.txt" "${FUNCNAME[0]}"
@@ -545,7 +545,7 @@ function command_injection() {
_print_msg INFO "Running: Command Injection Payload Generation"
# Process rce.txt with qsreplace and filter lines containing 'FUZZ'
- qsreplace "FUZZ" <"gf/rce.txt" | sed '/FUZZ/!d' | anew -q ".tmp/tmp_rce.txt"
+ run_command qsreplace "FUZZ" <"gf/rce.txt" | sed '/FUZZ/!d' | anew -q ".tmp/tmp_rce.txt"
# Determine whether to proceed based on DEEP flag or number of URLs
URL_COUNT=$(wc -l <".tmp/tmp_rce.txt")
@@ -652,8 +652,14 @@ function prototype_pollution() {
start_func "${FUNCNAME[0]}" "Prototype Pollution Checks"
+ if [[ ! -s "webs/url_extract_nodupes.txt" ]]; then
+ _print_msg WARN "File webs/url_extract_nodupes.txt is missing or empty."
+ end_func "Skipping prototype pollution: missing URL candidates." "${FUNCNAME[0]}" "SKIP"
+ return
+ fi
+
# Determine whether to proceed based on DEEP flag or number of URLs
- URL_COUNT=$(wc -l <"webs/url_extract_nodupes.txt" 2>/dev/null)
+ URL_COUNT=$(wc -l <"webs/url_extract_nodupes.txt" 2>/dev/null || echo 0)
if [[ $DEEP == true ]] || [[ $URL_COUNT -le $DEEP_LIMIT ]]; then
# Ensure fuzzing_full.txt exists and has content
@@ -670,9 +676,8 @@ function prototype_pollution() {
end_func "Results are saved in vulns/prototype_pollution.txt" "${FUNCNAME[0]}"
else
- print_warnf "File webs/url_extract_nodupes.txt is missing or empty."
- end_func "File webs/url_extract_nodupes.txt is missing or empty." "${FUNCNAME[0]}"
- return 1
+ end_func "Skipping prototype pollution: missing URL candidates." "${FUNCNAME[0]}" "SKIP"
+ return
fi
else
@@ -817,8 +822,14 @@ function fuzzparams() {
start_func "${FUNCNAME[0]}" "Fuzzing Parameters Values Checks"
+ if [[ ! -s "webs/url_extract_nodupes.txt" ]]; then
+ _print_msg WARN "File webs/url_extract_nodupes.txt is missing or empty."
+ end_func "Skipping fuzzparams: missing URL candidates." "${FUNCNAME[0]}" "SKIP"
+ return
+ fi
+
# Determine if we should proceed based on DEEP flag or number of URLs
- URL_COUNT=$(wc -l <"webs/url_extract_nodupes.txt")
+ URL_COUNT=$(wc -l <"webs/url_extract_nodupes.txt" 2>/dev/null || echo 0)
if [[ $DEEP == true ]] || [[ $URL_COUNT -le $DEEP_LIMIT2 ]]; then
#cent update -p ${NUCLEI_TEMPLATES_PATH} &>/dev/null
@@ -846,7 +857,12 @@ function fuzzparams() {
# Convert JSON output to text
- jq -r '["[" + .["template-id"] + (if .["matcher-name"] != null then ":" + .["matcher-name"] else "" end) + "] [" + .["type"] + "] [" + .info.severity + "] " + (.["matched-at"] // .host) + (if .["extracted-results"] != null then " " + (.["extracted-results"] | @json) else "" end)] | .[]' .tmp/fuzzparams_json.txt >.tmp/fuzzparams.txt
+ if [[ -s ".tmp/fuzzparams_json.txt" ]]; then
+ jq -r '["[" + .["template-id"] + (if .["matcher-name"] != null then ":" + .["matcher-name"] else "" end) + "] [" + .["type"] + "] [" + .info.severity + "] " + (.["matched-at"] // .host) + (if .["extracted-results"] != null then " " + (.["extracted-results"] | @json) else "" end)] | .[]' .tmp/fuzzparams_json.txt >.tmp/fuzzparams.txt
+ else
+ : >.tmp/fuzzparams.txt
+ log_note "fuzzparams: nuclei produced no JSON output; skipping conversion" "${FUNCNAME[0]}" "${LINENO}"
+ fi
# Append unique results to vulns/fuzzparams.txt
if [[ -s ".tmp/fuzzparams.txt" ]]; then
diff --git a/modules/web.sh b/modules/web.sh
index cc17885..cceb9f7 100644
--- a/modules/web.sh
+++ b/modules/web.sh
@@ -26,12 +26,12 @@ _run_httpx() {
if [[ $AXIOM != true ]]; then
# shellcheck disable=SC2086 # HTTPX_FLAGS intentionally word-split
- httpx $HTTPX_FLAGS -no-color -json -random-agent \
+ 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
- axiom-scan "$input" -m httpx $HTTPX_FLAGS -no-color -json -random-agent \
+ 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
@@ -70,7 +70,7 @@ _send_to_proxy() {
count=$(wc -l < "$urls_file" | tr -d ' ')
if [[ $count -le $max_urls ]]; then
notification "Sending websites to proxy" "info"
- ffuf -mc all -w "$urls_file" -u FUZZ -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
+ run_command ffuf -mc all -w "$urls_file" -u FUZZ -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
fi
fi
}
@@ -110,12 +110,12 @@ function webprobe_simple() {
# Run httpx or axiom-scan
if [[ $AXIOM != true ]]; then
# shellcheck disable=SC2086 # HTTPX_FLAGS intentionally word-split
- httpx $HTTPX_FLAGS -no-color -json -random-agent -threads "$HTTPX_THREADS" -rl "$HTTPX_RATELIMIT" \
+ 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
- axiom-scan subdomains/subdomains.txt -m httpx $HTTPX_FLAGS -no-color -json -random-agent \
+ 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
@@ -170,7 +170,7 @@ function webprobe_simple() {
# 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"
- ffuf -mc all -w webs/webs.txt -u FUZZ -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
+ run_command ffuf -mc all -w webs/webs.txt -u FUZZ -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
fi
else
@@ -256,7 +256,7 @@ function webprobe_full() {
# 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"
- ffuf -mc all -w webs/webs_uncommon_ports.txt -u FUZZ -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
+ 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]}"
@@ -288,11 +288,11 @@ function screenshot() {
# Run nuclei or axiom-scan based on AXIOM flag
if [[ $AXIOM != true ]]; then
if [[ -s "webs/webs_all.txt" ]]; then
- nuclei -headless -id screenshot -V dir='screenshots' <webs/webs_all.txt 2>>"$LOGFILE" >/dev/null
+ run_command nuclei -headless -id screenshot -V dir='screenshots' <webs/webs_all.txt 2>>"$LOGFILE" >/dev/null
fi
else
if [[ -s "webs/webs_all.txt" ]]; then
- axiom-scan webs/webs_all.txt -m nuclei-screenshots -o screenshots "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
+ run_command axiom-scan webs/webs_all.txt -m nuclei-screenshots -o screenshots "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
fi
fi
end_func "Results are saved in $domain/screenshots" "${FUNCNAME[0]}"
@@ -332,7 +332,7 @@ function virtualhosts() {
# Optionally send to proxy if conditions are 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"
- ffuf -mc all -w webs/webs_uncommon_ports.txt -u FUZZ -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
+ run_command ffuf -mc all -w webs/webs_uncommon_ports.txt -u FUZZ -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
fi
else
@@ -370,11 +370,11 @@ function favicon() {
# Run the favicon IP lookup tool
if [[ -n "${TIMEOUT_CMD:-}" ]]; then
- if ! "$TIMEOUT_CMD" -k 10s 10m "${tools}/fav-up/venv/bin/python3" "${tools}/fav-up/favUp.py" -w "$domain" -sc -o favicontest.json 2>>"$LOGFILE" >/dev/null; then
+ if ! run_command "$TIMEOUT_CMD" -k 10s 10m "${tools}/fav-up/venv/bin/python3" "${tools}/fav-up/favUp.py" -w "$domain" -sc -o favicontest.json 2>>"$LOGFILE" >/dev/null; then
log_note "favicon: fav-up failed or timed out; skipping" "${FUNCNAME[0]}" "${LINENO}"
fi
else
- if ! "${tools}/fav-up/venv/bin/python3" "${tools}/fav-up/favUp.py" -w "$domain" -sc -o favicontest.json 2>>"$LOGFILE" >/dev/null; then
+ if ! run_command "${tools}/fav-up/venv/bin/python3" "${tools}/fav-up/favUp.py" -w "$domain" -sc -o favicontest.json 2>>"$LOGFILE" >/dev/null; then
log_note "favicon: fav-up failed; skipping" "${FUNCNAME[0]}" "${LINENO}"
fi
fi
@@ -489,7 +489,7 @@ function portscan() {
else
json_array=()
while IFS= read -r cip; do
- if ! json_result=$(curl -s "https://internetdb.shodan.io/${cip}"); then
+ if ! json_result=$(run_command curl -s "https://internetdb.shodan.io/${cip}"); then
print_warnf "Failed to retrieve data for IP %s." "$cip"
else
json_array+=("$json_result")
@@ -510,7 +510,7 @@ function portscan() {
fi
if [[ $PORTSCAN_PASSIVE == true ]] && [[ ! -f "hosts/portscan_passive.txt" ]] && [[ -s ".tmp/ips_nocdn.txt" ]]; then
- smap -iL .tmp/ips_nocdn.txt >hosts/portscan_passive.txt
+ run_command smap -iL .tmp/ips_nocdn.txt >hosts/portscan_passive.txt
fi
if [[ $PORTSCAN_ACTIVE == true ]]; then
@@ -603,7 +603,7 @@ function cdnprovider() {
# Check if ips_cdn.txt exists and is not empty
if [[ -s "hosts/ips.txt" ]]; then
# Run cdncheck on the IPs and save to cdn_providers.txt
- cdncheck -silent -resp -nc <hosts/ips.txt | anew -q "$dir/hosts/cdn_providers.txt"
+ run_command cdncheck -silent -resp -nc <hosts/ips.txt | anew -q "$dir/hosts/cdn_providers.txt"
fi
end_func "Results are saved in hosts/cdn_providers.txt" "${FUNCNAME[0]}"
@@ -646,7 +646,7 @@ function waf_checks() {
wafw00f -i "webs/webs_all.txt" -o ".tmp/wafs.txt" 2>>"$LOGFILE" >/dev/null
else
# Run axiom-scan with wafw00f module on webs_all.txt
- axiom-scan "webs/webs_all.txt" -m wafw00f -o ".tmp/wafs.txt" "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
+ run_command axiom-scan "webs/webs_all.txt" -m wafw00f -o ".tmp/wafs.txt" "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
fi
# Process wafs.txt if it exists and is not empty
@@ -729,7 +729,9 @@ _nuclei_parse_results() {
if [[ -s "nuclei_output/${crit}.txt" ]]; then
local _count
_count=$(wc -l <"nuclei_output/${crit}.txt" | tr -d ' ')
- _print_status OK "nuclei_${crit}" "${_count} findings -> nuclei_output/${crit}.txt"
+ if [[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]]; then
+ _print_status OK "nuclei_${crit}" "${_count} findings -> nuclei_output/${crit}.txt"
+ fi
fi
fi
}
@@ -894,7 +896,7 @@ function param_discovery() {
local input_file="webs/url_extract_nodupes.txt"
[[ ! -s $input_file ]] && input_file="webs/webs_all.txt"
if [[ -s $input_file ]]; then
- arjun -i "$input_file" -t "$ARJUN_THREADS" -oJ .tmp/arjun.json 2>>"$LOGFILE" >/dev/null || true
+ run_command arjun -i "$input_file" -t "$ARJUN_THREADS" -oJ .tmp/arjun.json 2>>"$LOGFILE" >/dev/null || true
if [[ -s .tmp/arjun.json ]]; then
jq -r '..|.url? // empty' .tmp/arjun.json | sed 's/^/URL: /' | anew -q webs/params_discovered.txt
jq -r '..|.params? // empty | to_entries[] | .key' .tmp/arjun.json | sed 's/^/PARAM: /' | sort -u | anew -q webs/params_discovered.txt
@@ -927,7 +929,7 @@ function grpc_reflection() {
# Probe common plaintext gRPC ports
while read -r ip; do
for p in 50051 50052; do
- grpcurl -plaintext -max-msg-sz 10485760 -d '{}' "$ip:$p" list 2>>"$LOGFILE" | sed "s/^/[$ip:$p] /" | anew -q hosts/grpc_reflection.txt || true
+ run_command grpcurl -plaintext -max-msg-sz 10485760 -d '{}' "$ip:$p" list 2>>"$LOGFILE" | sed "s/^/[$ip:$p] /" | anew -q hosts/grpc_reflection.txt || true
done
done <.tmp/grpc_ips.txt
fi
@@ -961,7 +963,7 @@ _fuzz_run_local() {
_fuzz_classify_targets
if [[ -s .tmp/webs_normal.txt ]]; then
- interlace -tL .tmp/webs_normal.txt -threads "${INTERLACE_THREADS}" -c "ffuf ${FFUF_FLAGS} -t ${FFUF_THREADS} -rate ${FFUF_RATELIMIT} -H \"${HEADER}\" -w ${fuzz_wordlist} -maxtime ${FFUF_MAXTIME} -u _target_/FUZZ -o _output_/_cleantarget_.json" -o "$dir/.tmp/fuzzing" 2>>"$LOGFILE" >/dev/null
+ run_command interlace -tL .tmp/webs_normal.txt -threads "${INTERLACE_THREADS}" -c "ffuf ${FFUF_FLAGS} -t ${FFUF_THREADS} -rate ${FFUF_RATELIMIT} -H \"${HEADER}\" -w ${fuzz_wordlist} -maxtime ${FFUF_MAXTIME} -u _target_/FUZZ -o _output_/_cleantarget_.json" -o "$dir/.tmp/fuzzing" 2>>"$LOGFILE" >/dev/null
fi
if [[ -s .tmp/webs_slow.txt ]]; then
@@ -969,14 +971,14 @@ _fuzz_run_local() {
[[ $slow_threads -lt 5 ]] && slow_threads=5
local slow_rate=$FFUF_RATELIMIT
[[ ${FFUF_RATELIMIT:-0} -eq 0 ]] && slow_rate=50 || slow_rate=$((FFUF_RATELIMIT / 3 + 1))
- interlace -tL .tmp/webs_slow.txt -threads "${INTERLACE_THREADS}" -c "ffuf ${FFUF_FLAGS} -t ${slow_threads} -rate ${slow_rate} -H \"${HEADER}\" -w ${fuzz_wordlist} -maxtime ${FFUF_MAXTIME} -u _target_/FUZZ -o _output_/_cleantarget_.json" -o "$dir/.tmp/fuzzing" 2>>"$LOGFILE" >/dev/null
+ run_command interlace -tL .tmp/webs_slow.txt -threads "${INTERLACE_THREADS}" -c "ffuf ${FFUF_FLAGS} -t ${slow_threads} -rate ${slow_rate} -H \"${HEADER}\" -w ${fuzz_wordlist} -maxtime ${FFUF_MAXTIME} -u _target_/FUZZ -o _output_/_cleantarget_.json" -o "$dir/.tmp/fuzzing" 2>>"$LOGFILE" >/dev/null
fi
}
# Run ffuf via axiom-scan and parse per-subdomain results
_fuzz_run_axiom() {
cached_download_typed "${fuzzing_remote_list}" ".tmp/fuzzing_remote_list.txt" "onelistforallmicro.txt" "wordlists"
- axiom-scan webs/webs_all.txt -m ffuf -wL .tmp/fuzzing_remote_list.txt -H "${HEADER}" "$FFUF_FLAGS" -s -maxtime "$FFUF_MAXTIME" -oJ "$dir/.tmp/ffuf-content.json" "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
+ run_command axiom-scan webs/webs_all.txt -m ffuf -wL .tmp/fuzzing_remote_list.txt -H "${HEADER}" "$FFUF_FLAGS" -s -maxtime "$FFUF_MAXTIME" -oJ "$dir/.tmp/ffuf-content.json" "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
while read -r sub; do
local sub_out
@@ -1049,7 +1051,7 @@ function iishortname() {
mkdir -p "$dir/vulns/iis-shortname-shortscan/" "$dir/vulns/iis-shortname-sns/"
# Run shortscan using interlace
- interlace -tL .tmp/iis_sites.txt -threads "$INTERLACE_THREADS" \
+ run_command interlace -tL .tmp/iis_sites.txt -threads "$INTERLACE_THREADS" \
-c "shortscan _target_ -F -s -p 1 > _output_/_cleantarget_.txt" \
-o "$dir/vulns/iis-shortname-shortscan/" 2>>"$LOGFILE" >/dev/null
@@ -1061,7 +1063,7 @@ function iishortname() {
done < <(find "$dir/vulns/iis-shortname-shortscan/" -type f -iname "*.txt" -print0 2>/dev/null)
# Run sns using interlace
- interlace -tL .tmp/iis_sites.txt -threads "$INTERLACE_THREADS" \
+ run_command interlace -tL .tmp/iis_sites.txt -threads "$INTERLACE_THREADS" \
-c "sns -u _target_ > _output_/_cleantarget_.txt" \
-o "$dir/vulns/iis-shortname-sns/" 2>>"$LOGFILE" >/dev/null
@@ -1110,15 +1112,8 @@ function cms_scanner() {
touch webs/webs_uncommon_ports.txt
fi
- # Combine webs.txt and webs_uncommon_ports.txt into webs_all.txt if it doesn't exist
+ # Ensure webs_all.txt exists
if [[ ! -s "webs/webs_all.txt" ]]; then
- cat webs/webs.txt webs/webs_uncommon_ports.txt 2>/dev/null | anew -q webs/webs_all.txt
- fi
-
- # Combine webs_all.txt into .tmp/cms.txt as a comma-separated list
- if [[ -s "webs/webs_all.txt" ]]; then
- tr '\n' ',' <webs/webs_all.txt >.tmp/cms.txt 2>>"$LOGFILE"
- else
end_func "No webs/webs_all.txt file found, cms scanner skipped." "${FUNCNAME[0]}"
return
fi
@@ -1127,28 +1122,12 @@ function cms_scanner() {
local cmseek_cmd=(
timeout -k 1m "${CMSSCAN_TIMEOUT}s"
"${tools}/CMSeeK/venv/bin/python3" "${tools}/CMSeeK/cmseek.py"
- -l .tmp/cms.txt --batch -r
+ -l webs/webs_all.txt --batch -r
)
local exit_status=0
- local log_start=0
- log_start=$(wc -l <"$LOGFILE" 2>/dev/null || echo 0)
- if ! "${cmseek_cmd[@]}" &>>"$LOGFILE"; then
+ if ! run_command "${cmseek_cmd[@]}" &>>"$LOGFILE"; then
exit_status=$?
# Attempt one-time repair on known CMSeeK index corruption.
- if tail -n +"$((log_start + 1))" "$LOGFILE" 2>/dev/null | grep -q "cmseekdb/createindex.py" \
- && tail -n +"$((log_start + 1))" "$LOGFILE" 2>/dev/null | grep -q "JSONDecodeError"; then
- log_note "cms_scanner: detected CMSeeK index corruption, repairing index and retrying once" "${FUNCNAME[0]}" "${LINENO}"
- find "${tools}/CMSeeK/Result" -type f -name "*.json" -size 0 -delete 2>>"$LOGFILE" || true
- if [[ -f "${tools}/CMSeeK/cmseekdb/createindex.py" ]]; then
- (cd "${tools}/CMSeeK" && "${tools}/CMSeeK/venv/bin/python3" cmseekdb/createindex.py) &>>"$LOGFILE" || true
- fi
- if ! "${cmseek_cmd[@]}" &>>"$LOGFILE"; then
- exit_status=$?
- else
- exit_status=0
- fi
- fi
-
if [[ ${exit_status} -eq 124 || ${exit_status} -eq 137 ]]; then
echo "TIMEOUT cmseek.py - investigate manually for $dir" >>"$LOGFILE"
end_func "TIMEOUT cmseek.py - investigate manually for $dir" "${FUNCNAME[0]}"
@@ -1163,14 +1142,15 @@ function cms_scanner() {
# Process CMSeeK results
while IFS= read -r sub; do
sub_out=$(echo "$sub" | sed -e 's|^[^/]*//||' -e 's|/.*$||')
+ sub_out="${sub_out//$'\r'/}"
+ sub_out="${sub_out//:/_}"
cms_json_path="${tools}/CMSeeK/Result/${sub_out}/cms.json"
if [[ -s $cms_json_path ]]; then
- cms_id=$(jq -r 'try .cms_id' "$cms_json_path")
- if [[ -n $cms_id ]]; then
- mv -f "${tools}/CMSeeK/Result/${sub_out}" "$dir/cms/" 2>>"$LOGFILE"
- else
- rm -rf "${tools}/CMSeeK/Result/${sub_out}" 2>>"$LOGFILE"
+ cms_id=$(jq -r 'try .cms_id // empty' "$cms_json_path")
+ mv -f "${tools}/CMSeeK/Result/${sub_out}" "$dir/cms/" 2>>"$LOGFILE"
+ if [[ -z $cms_id ]]; then
+ log_note "cms_scanner: empty cms_id for ${sub_out}, results moved for inspection" "${FUNCNAME[0]}" "${LINENO}"
fi
fi
done <"webs/webs_all.txt"
@@ -1197,6 +1177,9 @@ function urlchecks() {
# Check if the function should run
if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $URL_CHECK == true ]]; then
start_func "${FUNCNAME[0]}" "URL Extraction"
+ local end_message="Results are saved in $domain/webs/url_extract.txt"
+ local katana_timeout_cmd="${TIMEOUT_CMD:-timeout}"
+ local waymore_timeout_cmd="${TIMEOUT_CMD:-timeout}"
# Combine webs.txt and webs_uncommon_ports.txt if webs_all.txt doesn't exist
if [[ ! -s "webs/webs_all.txt" ]]; then
@@ -1210,14 +1193,14 @@ function urlchecks() {
log_note "urlchecks: reusing urlfinder output from sub_scraping" "${FUNCNAME[0]}" "${LINENO}"
else
: >.tmp/url_extract_tmp.txt
- urlfinder -d "$domain" -all -o .tmp/url_extract_tmp.txt 2>>"$LOGFILE" >/dev/null
+ run_command urlfinder -d "$domain" -all -o .tmp/url_extract_tmp.txt 2>>"$LOGFILE" >/dev/null
fi
if command -v waymore &>/dev/null; then
if [[ -s ".tmp/waymore_urls_subs.txt" ]]; then
log_note "urlchecks: reusing waymore output from sub_scraping" "${FUNCNAME[0]}" "${LINENO}"
cat .tmp/waymore_urls_subs.txt | anew -q .tmp/url_extract_tmp.txt || true
else
- if ! "$TIMEOUT_CMD" "${WAYMORE_TIMEOUT:-30m}" waymore -i "$domain" -mode U -oU .tmp/waymore_urls.txt 2>>"$LOGFILE" >/dev/null; then
+ if ! run_command "$waymore_timeout_cmd" "${WAYMORE_TIMEOUT:-30m}" waymore -i "$domain" -mode U -oU .tmp/waymore_urls.txt 2>>"$LOGFILE" >/dev/null; then
log_note "urlchecks: waymore failed or timed out; continuing with other passive sources" "${FUNCNAME[0]}" "${LINENO}"
fi
if [[ -s ".tmp/waymore_urls.txt" ]]; then
@@ -1228,7 +1211,7 @@ function urlchecks() {
log_note "urlchecks: waymore not found; skipping passive waymore collection" "${FUNCNAME[0]}" "${LINENO}"
fi
if [[ -s $GITHUB_TOKENS ]]; then
- github-endpoints -q -k -d "$domain" -t "$GITHUB_TOKENS" -o .tmp/github-endpoints.txt 2>>"$LOGFILE" >/dev/null
+ run_command github-endpoints -q -k -d "$domain" -t "$GITHUB_TOKENS" -o .tmp/github-endpoints.txt 2>>"$LOGFILE" >/dev/null
if [[ -s ".tmp/github-endpoints.txt" ]]; then
cat .tmp/github-endpoints.txt | anew -q .tmp/url_extract_tmp.txt || true
fi
@@ -1268,9 +1251,9 @@ function urlchecks() {
fi
else
if [[ $DEEP == true ]]; then
- timeout 4h katana -silent -list .tmp/katana_targets_normal.txt -jc -kf all -c "$KATANA_THREADS" -d 3 -fs rdn >>.tmp/katana.txt 2>>"$LOGFILE"
+ run_command "$katana_timeout_cmd" 4h katana -silent -list .tmp/katana_targets_normal.txt -jc -kf all -c "$KATANA_THREADS" -d 3 -fs rdn >>.tmp/katana.txt 2>>"$LOGFILE"
else
- timeout 3h katana -silent -list .tmp/katana_targets_normal.txt -jc -kf all -c "$KATANA_THREADS" -d 2 -fs rdn >>.tmp/katana.txt 2>>"$LOGFILE"
+ run_command "$katana_timeout_cmd" 3h katana -silent -list .tmp/katana_targets_normal.txt -jc -kf all -c "$KATANA_THREADS" -d 2 -fs rdn >>.tmp/katana.txt 2>>"$LOGFILE"
fi
fi
fi
@@ -1288,9 +1271,9 @@ function urlchecks() {
fi
else
if [[ $DEEP == true ]]; then
- timeout 4h katana -silent -list .tmp/katana_targets_slow.txt -jc -kf all -c "$slow_c" -d 3 -fs rdn >>.tmp/katana.txt 2>>"$LOGFILE"
+ run_command "$katana_timeout_cmd" 4h katana -silent -list .tmp/katana_targets_slow.txt -jc -kf all -c "$slow_c" -d 3 -fs rdn >>.tmp/katana.txt 2>>"$LOGFILE"
else
- timeout 3h katana -silent -list .tmp/katana_targets_slow.txt -jc -kf all -c "$slow_c" -d 2 -fs rdn >>.tmp/katana.txt 2>>"$LOGFILE"
+ run_command "$katana_timeout_cmd" 3h katana -silent -list .tmp/katana_targets_slow.txt -jc -kf all -c "$slow_c" -d 2 -fs rdn >>.tmp/katana.txt 2>>"$LOGFILE"
fi
fi
fi
@@ -1306,9 +1289,9 @@ function urlchecks() {
if [[ $diff_webs != "0" ]] || [[ ! -s ".tmp/katana.txt" ]]; then
if [[ $URL_CHECK_ACTIVE == true ]]; then
if [[ $DEEP == true ]]; then
- axiom-scan webs/webs_all.txt -m katana -jc -kf all -d 3 -fs rdn --max-runtime 4h -o .tmp/katana.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
+ run_command axiom-scan webs/webs_all.txt -m katana -jc -kf all -d 3 -fs rdn --max-runtime 4h -o .tmp/katana.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
else
- axiom-scan webs/webs_all.txt -m katana -jc -kf all -d 2 -fs rdn --max-runtime 3h -o .tmp/katana.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
+ run_command axiom-scan webs/webs_all.txt -m katana -jc -kf all -d 2 -fs rdn --max-runtime 3h -o .tmp/katana.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
fi
fi
fi
@@ -1323,7 +1306,7 @@ function urlchecks() {
grep -a "$domain" .tmp/url_extract_tmp.txt | grep -aEo 'https?://[^ ]+' | grep -iE '\.js([?#].*)?$|\.js([/?&].*)' | anew -q .tmp/url_extract_js.txt || true
grep -a "$domain" .tmp/url_extract_tmp.txt | grep -aEo 'https?://[^ ]+' | grep -iE '\.map([/?#].*)?$' | anew -q .tmp/url_extract_jsmap.txt || true
if [[ $DEEP == true ]] && [[ -s ".tmp/url_extract_js.txt" ]]; then
- interlace -tL .tmp/url_extract_js.txt -threads 10 -c "${tools}/JSA/venv/bin/python3 ${tools}/JSA/jsa.py -f _target_ | anew -q .tmp/url_extract_tmp.txt" &>/dev/null
+ run_command interlace -tL .tmp/url_extract_js.txt -threads 10 -c "${tools}/JSA/venv/bin/python3 ${tools}/JSA/jsa.py -f _target_ | anew -q .tmp/url_extract_tmp.txt" &>/dev/null
fi
grep -a "$domain" .tmp/url_extract_tmp.txt | grep -aEo 'https?://[^ ]+' | grep "=" | qsreplace -a 2>>"$LOGFILE" | grep -aEiv "\.(eot|jpg|jpeg|gif|css|tif|tiff|png|ttf|otf|woff|woff2|ico|pdf|svg)$" | anew -q .tmp/url_extract_tmp2.txt || true
@@ -1344,21 +1327,27 @@ function urlchecks() {
NUMOFLINES=0
fi
- end_func "Results are saved in $domain/webs/url_extract.txt" "${FUNCNAME[0]}"
-
if [[ -s "webs/url_extract.txt" ]]; then
p1radup -i webs/url_extract.txt -o webs/url_extract_nodupes.txt -s 2>>"$LOGFILE" >/dev/null || true
if [[ $PROXY == true ]] && [[ -n $proxy_url ]] && [[ $(wc -l <webs/url_extract.txt) -le $DEEP_LIMIT2 ]]; then
notification "Sending URLs to proxy" "info"
- ffuf -mc all -w webs/url_extract.txt -u FUZZ -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
+ run_command ffuf -mc all -w webs/url_extract.txt -u FUZZ -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
fi
else
_print_msg WARN "No URL extraction output generated; skipping p1radup/proxy replay."
log_note "No URL extraction output generated; skipping p1radup/proxy replay." "${FUNCNAME[0]}" "${LINENO}"
+ end_message="No URL extraction output generated."
fi
+ else
+ end_message="No URL extraction candidates generated."
+ _print_msg WARN "No URL extraction candidates generated."
fi
+ else
+ end_message="No web targets available for URL extraction."
+ _print_msg WARN "No web targets available for URL extraction."
fi
+ end_func "${end_message}" "${FUNCNAME[0]}"
else
if [[ $URL_CHECK == false ]]; then
pt_msg_warn "${FUNCNAME[0]} skipped due to configuration"
@@ -1403,13 +1392,13 @@ function url_gf() {
_print_msg INFO "Running: GF Pattern '${pattern}'"
if [[ $pattern == "potential" ]]; then
# Special handling for 'potential' pattern
- gf "$pattern" "webs/url_extract.txt" | cut -d ':' -f3-5 | anew -q "$output_file"
+ run_command gf "$pattern" "webs/url_extract.txt" | cut -d ':' -f3-5 | anew -q "$output_file"
elif [[ $pattern == "redirect" && -s "gf/ssrf.txt" ]]; then
# Append SSFR results to redirect if ssrf.txt exists
- gf "$pattern" "webs/url_extract.txt" | anew -q "$output_file"
+ run_command gf "$pattern" "webs/url_extract.txt" | anew -q "$output_file"
else
# General handling for other patterns
- gf "$pattern" "webs/url_extract.txt" | anew -q "$output_file"
+ run_command gf "$pattern" "webs/url_extract.txt" | anew -q "$output_file"
fi
done
@@ -1529,7 +1518,7 @@ function jschecks() {
| grep -F "$domain" \
| grep -aEo 'https?://[^ ]+' | anew -q .tmp/subjslinks.txt || true
else
- axiom-scan .tmp/url_extract_js.txt -m subjs -o .tmp/subjslinks.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
+ run_command axiom-scan .tmp/url_extract_js.txt -m subjs -o .tmp/subjslinks.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
fi
if [[ -s ".tmp/subjslinks.txt" ]]; then
@@ -1544,13 +1533,13 @@ function jschecks() {
[[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%bRunning: Resolving JS URLs 2/6%b\n" "$yellow" "$reset"
if [[ $AXIOM != true ]]; then
if [[ -s "js/url_extract_js.txt" ]]; then
- httpx -follow-redirects -random-agent -silent -timeout "$HTTPX_TIMEOUT" -threads "$HTTPX_THREADS" \
+ run_command httpx -follow-redirects -random-agent -silent -timeout "$HTTPX_TIMEOUT" -threads "$HTTPX_THREADS" \
-rl "$HTTPX_RATELIMIT" -status-code -content-type -retries 2 -no-color <js/url_extract_js.txt \
| grep "[200]" | grep "javascript" | cut -d ' ' -f1 | anew -q js/js_livelinks.txt
fi
else
if [[ -s "js/url_extract_js.txt" ]]; then
- axiom-scan js/url_extract_js.txt -m httpx -follow-host-redirects -H "$HEADER" -status-code \
+ run_command axiom-scan js/url_extract_js.txt -m httpx -follow-host-redirects -H "$HEADER" -status-code \
-threads "$HTTPX_THREADS" -rl "$HTTPX_RATELIMIT" -timeout "$HTTPX_TIMEOUT" -silent \
-content-type -retries 2 -no-color -o .tmp/js_livelinks.txt "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
if [[ -s ".tmp/js_livelinks.txt" ]]; then
@@ -1565,19 +1554,19 @@ function jschecks() {
print_warnf "Failed to create sourcemapper directory."
fi
if [[ -s "js/js_livelinks.txt" ]]; then
- interlace -tL js/js_livelinks.txt -threads "$INTERLACE_THREADS" \
+ run_command interlace -tL js/js_livelinks.txt -threads "$INTERLACE_THREADS" \
-c "sourcemapper -jsurl '_target_' -output _output_/_cleantarget_" \
-o .tmp/sourcemapper 2>>"$LOGFILE" >/dev/null
fi
if [[ -s ".tmp/url_extract_jsmap.txt" ]]; then
- interlace -tL .tmp/url_extract_jsmap.txt -threads "$INTERLACE_THREADS" \
+ run_command interlace -tL .tmp/url_extract_jsmap.txt -threads "$INTERLACE_THREADS" \
-c "sourcemapper -url '_target_' -output _output_/_cleantarget_" \
-o .tmp/sourcemapper 2>>"$LOGFILE" >/dev/null
fi
find .tmp/sourcemapper/ \( -name "*.js" -o -name "*.ts" \) -type f \
- | jsluice urls | jq -r .url | anew -q .tmp/js_endpoints.txt || true
+ | run_command jsluice urls | jq -r .url | anew -q .tmp/js_endpoints.txt || true
[[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%bRunning: Gathering endpoints 4/6%b\n" "$yellow" "$reset"
if [[ -s "js/js_livelinks.txt" ]]; then
@@ -1596,17 +1585,17 @@ function jschecks() {
cat js/js_livelinks.txt | mantra -ua \"$HEADER\" -s | anew -q js/js_secrets.txt 2>>"$LOGFILE" >/dev/null || true
else
axiom-exec "go install github.com/Brosck/mantra@latest" 2>>"$LOGFILE" >/dev/null
- axiom-scan js/js_livelinks.txt -m mantra -ua "$HEADER" -s -o js/js_secrets.txt "$AXIOM_EXTRA_ARGS" &>/dev/null
+ run_command axiom-scan js/js_livelinks.txt -m mantra -ua "$HEADER" -s -o js/js_secrets.txt "$AXIOM_EXTRA_ARGS" &>/dev/null
fi
mkdir -p .tmp/sourcemapper/secrets
if [[ -s "js/js_secrets.txt" ]]; then
while IFS= read -r i; do
[[ -z "$i" ]] && continue
- wget -q -P .tmp/sourcemapper/secrets -- "$i" || true
+ run_command wget -q -P .tmp/sourcemapper/secrets -- "$i" || true
done < <(cut -d' ' -f2 js/js_secrets.txt)
fi
- trufflehog filesystem .tmp/sourcemapper/ -j 2>/dev/null | jq -c | anew -q js/js_secrets_jsmap.txt
- find .tmp/sourcemapper/ -type f -name "*.js" | jsluice secrets -j --patterns="${tools}/jsluice_patterns.json" | anew -q js/js_secrets_jsmap_jsluice.txt
+ run_command trufflehog filesystem .tmp/sourcemapper/ -j 2>/dev/null | jq -c | anew -q js/js_secrets_jsmap.txt
+ find .tmp/sourcemapper/ -type f -name "*.js" | run_command jsluice secrets -j --patterns="${tools}/jsluice_patterns.json" | anew -q js/js_secrets_jsmap_jsluice.txt
fi
[[ "${OUTPUT_VERBOSITY:-1}" -ge 2 ]] && printf "%bRunning: Building wordlist 6/6%b\n" "$yellow" "$reset"
@@ -1617,7 +1606,7 @@ function jschecks() {
# shellcheck source=/dev/null
source "${GETJSWORDS_VENV}/bin/activate"
if python3 -c "import jsbeautifier, requests" 2>/dev/null; then
- interlace -tL js/js_livelinks.txt -threads "$INTERLACE_THREADS" \
+ run_command interlace -tL js/js_livelinks.txt -threads "$INTERLACE_THREADS" \
-c "python3 ${tools}/getjswords.py '_target_' | anew -q webs/dict_words.txt" 2>>"$LOGFILE" >/dev/null
else
log_note "jschecks: jsbeautifier/requests missing in venv ${GETJSWORDS_VENV}; skipping getjswords wordlist step" "${FUNCNAME[0]}" "${LINENO}"
@@ -1632,7 +1621,7 @@ function jschecks() {
if ! command -v "$getjs_py" >/dev/null 2>&1; then
log_note "getjswords python not found: ${getjs_py}; skipping wordlist step" "${FUNCNAME[0]}" "${LINENO}"
elif "$getjs_py" -c "import jsbeautifier, requests" 2>/dev/null; then
- interlace -tL js/js_livelinks.txt -threads "$INTERLACE_THREADS" \
+ run_command interlace -tL js/js_livelinks.txt -threads "$INTERLACE_THREADS" \
-c "${getjs_py} ${tools}/getjswords.py '_target_' | anew -q webs/dict_words.txt" 2>>"$LOGFILE" >/dev/null
else
log_note "jschecks: jsbeautifier/requests missing in ${getjs_py}; skipping getjswords wordlist step" "${FUNCNAME[0]}" "${LINENO}"
@@ -1672,7 +1661,7 @@ function websocket_checks() {
host=$(echo "$url_no_proto" | cut -d'/' -f1)
# Prepare Sec-WebSocket headers for accurate handshake
wskey=$(head -c 16 /dev/urandom | base64 2>/dev/null || echo dGVzdGtleQ==)
- code=$(curl -sk --http1.1 -o /dev/null -w '%{http_code}' \
+ code=$(run_command curl -sk --http1.1 -o /dev/null -w '%{http_code}' \
-H 'Connection: Upgrade' -H 'Upgrade: websocket' \
-H "Host: $host" \
-H "Sec-WebSocket-Key: $wskey" \
@@ -1682,7 +1671,7 @@ function websocket_checks() {
printf "HANDSHAKE %s\n" "$ws" | anew -q vulns/websockets.txt || true
# Origin test: send a cross-origin header, expect failure ideally
wskey2=$(head -c 16 /dev/urandom | base64 2>/dev/null || echo dGVzdGtleQ==)
- code2=$(curl -sk --http1.1 -o /dev/null -w '%{http_code}' \
+ code2=$(run_command curl -sk --http1.1 -o /dev/null -w '%{http_code}' \
-H 'Connection: Upgrade' -H 'Upgrade: websocket' \
-H "Origin: https://evil.example" -H "Host: $host" \
-H "Sec-WebSocket-Key: $wskey2" \
@@ -1777,7 +1766,7 @@ function wordlist_gen_roboxtractor() {
# Handle Proxy if conditions are met
if [[ $PROXY == true ]] && [[ -n $proxy_url ]] && [[ "$(wc -l <"webs/robots_wordlist.txt")" -le $DEEP_LIMIT2 ]]; then
notification "Sending URLs to proxy" info
- ffuf -mc all -w "webs/robots_wordlist.txt" -u "FUZZ" -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
+ run_command ffuf -mc all -w "webs/robots_wordlist.txt" -u "FUZZ" -replay-proxy "$proxy_url" 2>>"$LOGFILE" >/dev/null
fi
else
@@ -1812,7 +1801,7 @@ function password_dict() {
word="${domain%%.*}"
# Run pydictor.py with specified parameters
- python3 "${tools}/pydictor/pydictor.py" -extend "$word" --leet 0 1 2 11 21 --len "$PASSWORD_MIN_LENGTH" "$PASSWORD_MAX_LENGTH" -o "$dir/webs/password_dict.txt" 2>>"$LOGFILE" >/dev/null
+ run_command python3 "${tools}/pydictor/pydictor.py" -extend "$word" --leet 0 1 2 11 21 --len "$PASSWORD_MIN_LENGTH" "$PASSWORD_MAX_LENGTH" -o "$dir/webs/password_dict.txt" 2>>"$LOGFILE" >/dev/null
end_func "Results are saved in $domain/webs/password_dict.txt" "${FUNCNAME[0]}"
# Optionally, create a marker file to indicate the function has been processed
@@ -1874,9 +1863,9 @@ function brokenLinks() {
# Use axiom-scan for scanning
if [[ ! -s ".tmp/katana.txt" ]]; then
if [[ $DEEP == true ]]; then
- axiom-scan "webs/webs_all.txt" -m katana -jc -kf all -d 3 --max-runtime 4h -o ".tmp/katana.txt" $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
+ run_command axiom-scan "webs/webs_all.txt" -m katana -jc -kf all -d 3 --max-runtime 4h -o ".tmp/katana.txt" $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
else
- axiom-scan "webs/webs_all.txt" -m katana -jc -kf all -d 2 --max-runtime 3h -o ".tmp/katana.txt" $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
+ run_command axiom-scan "webs/webs_all.txt" -m katana -jc -kf all -d 2 --max-runtime 3h -o ".tmp/katana.txt" $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/null
fi
# Remove lines longer than 2048 characters
if [[ -s ".tmp/katana.txt" ]]; then
@@ -1887,7 +1876,7 @@ function brokenLinks() {
# Process katana.txt to find broken links
if [[ -s ".tmp/katana.txt" ]]; then
- httpx -follow-redirects -random-agent -status-code -threads "$HTTPX_THREADS" -rl "$HTTPX_RATELIMIT" -timeout "$HTTPX_TIMEOUT" -silent -retries 2 -no-color <".tmp/katana.txt" 2>>"$LOGFILE" \
+ run_command httpx -follow-redirects -random-agent -status-code -threads "$HTTPX_THREADS" -rl "$HTTPX_RATELIMIT" -timeout "$HTTPX_TIMEOUT" -silent -retries 2 -no-color <".tmp/katana.txt" 2>>"$LOGFILE" \
| grep "\[4" | cut -d ' ' -f1 | anew -q ".tmp/brokenLinks_total.txt"
fi