reconFTW is a tool designed to perform automated recon on a target domain by running the best set of tools to perform scanning and finding out vulnerabilities
Shell bug-bountybugbountybugbounty-tooldnshackingnucleiosintpenetration-testingpentestpentest-toolpentestingreconreconnaissancescannersecuritysecurity-toolssubdomainsubdomain-enumerationvulnerabilities
style: fix remaining shellcheck warnings
six2dezada62ff8950d
diff --git a/lib/config.sh b/lib/config.shindex 770310f..ede9174 100644--- a/lib/config.sh+++ b/lib/config.sh@@ -96,6 +96,7 @@ function _load_config_file() {fi# Source the file with error handling+ # shellcheck source=/dev/nullif ! source "$conf_file" 2>/dev/null; thenprintf "[ERROR] Failed to load config file: %s\n" "$conf_file" >&2return $E_CONFIG_SYNTAXdiff --git a/lib/validation.sh b/lib/validation.shindex b57a103..29c7d38 100644--- a/lib/validation.sh+++ b/lib/validation.sh@@ -5,6 +5,7 @@set -o pipefail# Error codes+# shellcheck disable=SC2034 # These are exported for use in modulesreadonly E_INVALID_DOMAIN=20readonly E_INVALID_IP=21readonly E_INVALID_PATH=22diff --git a/modules/axiom.sh b/modules/axiom.shindex b083687..2a92730 100644--- a/modules/axiom.sh+++ b/modules/axiom.sh@@ -6,6 +6,7 @@# This file is sourced by reconftw.sh - do not execute directly# shellcheck disable=SC2154 # Variables defined in reconftw.cfg+# shellcheck disable=SC2034 # Variables exported for use in other modules[[ -z "${SCRIPTPATH:-}" ]] && {echo "Error: This module must be sourced by reconftw.sh" >&2diff --git a/modules/core.sh b/modules/core.shindex 5b50588..7a1aeab 100644--- a/modules/core.sh+++ b/modules/core.sh@@ -92,6 +92,7 @@ function banner_grabber() {fi# Source the banner file+ # shellcheck source=/dev/nullsource "$banner_file"# Collect all banner variable names@@ -583,7 +584,9 @@ function incremental_diff() {function incremental_report() {[[ "$INCREMENTAL_MODE" != "true" ]] && return 0- local report_file="$INCREMENTAL_DIR/incremental_report_$(date +%Y%m%d_%H%M%S).txt"+ local report_file+ local new_subs new_webs+ report_file="$INCREMENTAL_DIR/incremental_report_$(date +%Y%m%d_%H%M%S).txt"{echo "==============================================="@@ -595,7 +598,7 @@ function incremental_report() {# Subdomain changesif [[ -f "$INCREMENTAL_DIR/previous/subdomains_latest.txt" ]]; then- local new_subs=$(comm -13 <(sort -u "$INCREMENTAL_DIR/previous/subdomains_latest.txt" 2>/dev/null || touch /tmp/empty) \+ new_subs=$(comm -13 <(sort -u "$INCREMENTAL_DIR/previous/subdomains_latest.txt" 2>/dev/null || touch /tmp/empty) \<(sort -u "subdomains/subdomains.txt" 2>/dev/null || touch /tmp/empty) | wc -l)echo "New Subdomains: $new_subs"if [[ $new_subs -gt 0 ]]; then@@ -609,7 +612,7 @@ function incremental_report() {# Web changesif [[ -f "$INCREMENTAL_DIR/previous/webs_latest.txt" ]]; then- local new_webs=$(comm -13 <(sort -u "$INCREMENTAL_DIR/previous/webs_latest.txt" 2>/dev/null || touch /tmp/empty) \+ new_webs=$(comm -13 <(sort -u "$INCREMENTAL_DIR/previous/webs_latest.txt" 2>/dev/null || touch /tmp/empty) \<(sort -u "webs/webs.txt" 2>/dev/null || touch /tmp/empty) | wc -l)echo "New Webs: $new_webs"if [[ $new_webs -gt 0 ]]; then@@ -637,8 +640,9 @@ function incremental_should_skip() {[[ "$INCREMENTAL_MODE" != "true" ]] && return 1 # Don't skip# Check if we have new findings- local new_subs=$(cat .tmp/subs_new_count 2>/dev/null || echo 1)- local new_webs=$(cat .tmp/webs_new_count 2>/dev/null || echo 1)+ local new_subs new_webs+ new_subs=$(cat .tmp/subs_new_count 2>/dev/null || echo 1)+ new_webs=$(cat .tmp/webs_new_count 2>/dev/null || echo 1)if [[ $new_subs -eq 0 && $new_webs -eq 0 ]]; thenprintf "%b[%s] Incremental mode: No new assets found, skipping heavy scans%b\n" \@@ -665,6 +669,7 @@ function zipSnedOutputFolder {}function isAsciiText {+ # shellcheck disable=SC2034 # IS_ASCII used by callersIS_ASCII="False"if [[ $(file $1 | grep -o 'ASCII text$') == "ASCII text" ]]; thenIS_ASCII="True"@@ -849,11 +854,13 @@ function maybe_update_nuclei() {}# Plugin framework+# shellcheck disable=SC2034 # PLUGINS_LOADED used for state trackingPLUGINS_LOADED=falsefunction plugins_load() {local plugdir="${SCRIPTPATH}/plugins"if [[ -d $plugdir ]]; thenfor f in "$plugdir"/*.sh; do+ # shellcheck source=/dev/null[[ -f $f ]] && source "$f" || truedonefidiff --git a/modules/modes.sh b/modules/modes.shindex ed627af..4eb056c 100644--- a/modules/modes.sh+++ b/modules/modes.sh@@ -276,6 +276,7 @@ function passive() {metadataapileaksthird_party_misconfigs+ # shellcheck disable=SC2034 # These flags control module behaviorSUBNOERROR=falseSUBANALYTICS=falseSUBBRUTE=false@@ -293,6 +294,7 @@ function passive() {remove_big_filesfaviconcdnprovider+ # shellcheck disable=SC2034 # PORTSCAN_ACTIVE controls scan behaviorPORTSCAN_ACTIVE=falseportscangeo_infodiff --git a/modules/subdomains.sh b/modules/subdomains.shindex 28ecf89..db7cf00 100644--- a/modules/subdomains.sh+++ b/modules/subdomains.sh@@ -1839,7 +1839,8 @@ function cloud_extra_providers() {# Candidate names from domain and subdomainscompany=$(unfurl format %r <<<"$domain")printf "%s\n%s\n${domain%%.*}" "$company" "$domain" | sed 's/[^a-zA-Z0-9-]//g' | awk 'length>2' | sort -u >.tmp/cloudnames.txt- [[ -s subdomains/subdomains.txt ]] && awk -F. -v r=$(echo "$domain" | awk -F. '{print $(NF-1)"."$NF}') '{print $(NF-2)}' subdomains/subdomains.txt 2>/dev/null | sed 's/[^a-zA-Z0-9-]//g' | awk 'length>2' | sort -u >>.tmp/cloudnames.txt+ # shellcheck disable=SC2046 # Word splitting intended for awk+ [[ -s subdomains/subdomains.txt ]] && awk -F. -v r="$(echo "$domain" | awk -F. '{print $(NF-1)"."$NF}')" '{print $(NF-2)}' subdomains/subdomains.txt 2>/dev/null | sed 's/[^a-zA-Z0-9-]//g' | awk 'length>2' | sort -u >>.tmp/cloudnames.txtsed_i 's/^\///; s/\.$//' .tmp/cloudnames.txtsort -u .tmp/cloudnames.txt -o .tmp/cloudnames.txtdiff --git a/modules/utils.sh b/modules/utils.shindex 05e24b8..3bb300a 100644--- a/modules/utils.sh+++ b/modules/utils.sh@@ -304,9 +304,10 @@ function adjust_rate_limit() {[[ "$ADAPTIVE_RATE_LIMIT" != "true" ]] && return 0+ local new_limitcase "$action" indecrease)- local new_limit=$(awk "BEGIN {printf \"%.0f\", $CURRENT_RATE_LIMIT * $RATE_LIMIT_BACKOFF_FACTOR}")+ new_limit=$(awk "BEGIN {printf \"%.0f\", $CURRENT_RATE_LIMIT * $RATE_LIMIT_BACKOFF_FACTOR}")if [ "$new_limit" -lt "$MIN_RATE_LIMIT" ]; thennew_limit=$MIN_RATE_LIMITfi@@ -315,7 +316,7 @@ function adjust_rate_limit() {"$yellow" "$(date +'%Y-%m-%d %H:%M:%S')" "$CURRENT_RATE_LIMIT" "$reset" | tee -a "$LOGFILE";;increase)- local new_limit=$(awk "BEGIN {printf \"%.0f\", $CURRENT_RATE_LIMIT * $RATE_LIMIT_INCREASE_FACTOR}")+ new_limit=$(awk "BEGIN {printf \"%.0f\", $CURRENT_RATE_LIMIT * $RATE_LIMIT_INCREASE_FACTOR}")if [ "$new_limit" -gt "$MAX_RATE_LIMIT" ]; thennew_limit=$MAX_RATE_LIMITfi@@ -327,7 +328,9 @@ function adjust_rate_limit() {# Update tool-specific rate limitsNUCLEI_RATELIMIT=$CURRENT_RATE_LIMIT+ # shellcheck disable=SC2034 # Used by external toolsFFUF_RATELIMIT=$CURRENT_RATE_LIMIT+ # shellcheck disable=SC2034 # Used by external toolsHTTPX_RATELIMIT=$CURRENT_RATE_LIMIT}@@ -341,7 +344,8 @@ function run_with_adaptive_rate() {local max_retries=3local retry=0- local temp_output=$(mktemp)+ local temp_output+ temp_output=$(mktemp)while [ $retry -lt $max_retries ]; doif "$@" 2>&1 | tee "$temp_output"; then@@ -421,9 +425,10 @@ function sanitize_domain() {# Usage: sanitize_ip <ip_or_cidr>function sanitize_ip() {local input="$1"+ local sanitized# Allow digits, dots, and slash for CIDR- local sanitized=$(echo "$input" | tr -cd '0-9./,')+ sanitized=$(echo "$input" | tr -cd '0-9./,')if [[ -z "$sanitized" ]]; thenprintf "%b[%s] ERROR: Invalid IP/CIDR after sanitization: '%s'%b\n" \diff --git a/modules/vulns.sh b/modules/vulns.shindex 8ff179d..5ec01e1 100644--- a/modules/vulns.sh+++ b/modules/vulns.sh@@ -884,9 +884,7 @@ function fuzzparams() {printf "${yellow}\n[$(date +'%Y-%m-%d %H:%M:%S')] Running: Axiom with Nuclei${reset}\n\n"run_command axiom-scan webs/url_extract_nodupes.txt -m nuclei \--dast -nh -rl "$NUCLEI_RATELIMIT" \--silent -retries 2 "$NUCLEI_EXTRA_ARGS" -dast -j -o ".tmp/fuzzparams_json.txt" $AXIOM_EXTRA_ARGS 2>>"$LOGFILE" >/dev/nullfidiff --git a/modules/web.sh b/modules/web.shindex 394091a..bc5b7c1 100644--- a/modules/web.sh+++ b/modules/web.sh@@ -815,6 +815,7 @@ function grpc_reflection() {# Build target IP listlocal ips_file="hosts/ips.txt"local targets=()+ # shellcheck disable=SC2207 # Word splitting intended for array population[[ -s $ips_file ]] && targets+=($(cat "$ips_file"))[[ -s "hosts/ips_v6.txt" ]] && targets+=($(cat "hosts/ips_v6.txt"))printf "%s\n" "${targets[@]}" | sort -u >.tmp/grpc_ips.txt@@ -865,8 +866,8 @@ function fuzz() {if [[ -s "webs/webs_all.txt" ]]; thenif [[ $AXIOM != true ]]; then# Split targets by slow hosts- >.tmp/webs_slow.txt- >.tmp/webs_normal.txt+ : >.tmp/webs_slow.txt+ : >.tmp/webs_normal.txtif [[ -s .tmp/slow_hosts.txt ]]; thenwhile read -r host; dogrep "://${host}[:/\n]" webs/webs_all.txt | anew -q .tmp/webs_slow.txt@@ -890,8 +891,6 @@ function fuzz() {fifor sub in $(cat webs/webs_all.txt); dosub_out=$(echo $sub | sed -e 's|^[^/]*//||' -e 's|/.*$||')-- [ -s "$dir/.tmp/fuzzing/${sub_out}.json" ] && cat $dir/.tmp/fuzzing/${sub_out}.json | jq -r 'try .results[] | "\(.status) \(.length) \(.url)"' | sort -k1 | anew -q $dir/fuzzing/${sub_out}.txtdonefind $dir/fuzzing/ -type f -iname "*.txt" -exec cat {} + 2>>"$LOGFILE" | sort -k1 | anew -q $dir/fuzzing/fuzzing_full.txtelse@@ -1084,8 +1083,8 @@ function urlchecks() {if [[ $diff_webs != "0" ]] || [[ ! -s ".tmp/katana.txt" ]]; thenif [[ $URL_CHECK_ACTIVE == true ]]; then# Split slow vs normal targets based on httpx status (403/429)- >.tmp/katana_targets_slow.txt- >.tmp/katana_targets_normal.txt+ : >.tmp/katana_targets_slow.txt+ : >.tmp/katana_targets_normal.txtif [[ -s .tmp/slow_hosts.txt ]]; thenwhile read -r host; dogrep "://${host}[:/\n]" webs/webs_all.txt | anew -q .tmp/katana_targets_slow.txt@@ -1095,7 +1094,7 @@ function urlchecks() {cp webs/webs_all.txt .tmp/katana_targets_normal.txtfi- >.tmp/katana.txt+ : >.tmp/katana.txt# Normal targetsif [[ -s .tmp/katana_targets_normal.txt ]]; thenLINES=$(wc -l <.tmp/katana_targets_normal.txt)diff --git a/reconftw.sh b/reconftw.shindex c552491..45f7bb0 100755--- a/reconftw.sh+++ b/reconftw.sh@@ -7,6 +7,7 @@ set +eIFS=$'\n\t'# Standard exit/return codes (guard for re-source in test harnesses)+# shellcheck disable=SC2034 # These are exported for use in modules and custom scriptsif [[ -z "${E_SUCCESS+x}" ]]; thenreadonly E_SUCCESS=0readonly E_GENERAL=1