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
fixes parallelization
six2dez86c274b1870e
diff --git a/lib/parallel.sh b/lib/parallel.shindex 11ce9f8..894d154 100644--- a/lib/parallel.sh+++ b/lib/parallel.sh@@ -69,42 +69,84 @@ parallel_funcs() {local max_jobsmax_jobs=$(_parallel_effective_max_jobs "${1:-$PARALLEL_MAX_JOBS}")shift-- local -a pids=()++ local parallel_log_root+ if [[ -n "${dir:-}" ]]; then+ parallel_log_root="${dir}/.tmp/parallel"+ else+ parallel_log_root="/tmp/reconftw_parallel.$$"+ fi+ mkdir -p "$parallel_log_root" 2>/dev/null || true++ local -a batch_pids=()+ local -a batch_funcs=()+ local -a batch_logs=()local func- local running=0-+ local failed=0+for func in "$@"; do# Check if function existsif ! declare -f "$func" >/dev/null 2>&1; thenprintf "%b[!] Function %s not found, skipping%b\n" "${yellow:-}" "$func" "${reset:-}" >&2continuefi-++ local log_file="${parallel_log_root}/${func}.$$.$RANDOM.log"# Run function in background subshell- ( "$func" ) &- pids+=($!)- ((running++))-+ (+ "$func"+ ) >"$log_file" 2>&1 &+ batch_pids+=("$!")+ batch_funcs+=("$func")+ batch_logs+=("$log_file")+# Log if verbose[[ ${VERBOSE:-false} == true ]] && \- printf "%b[*] Started %s (PID: %d)%b\n" "${cyan:-}" "$func" "${pids[-1]}" "${reset:-}"-- # If we've reached max jobs, wait for one to finish- if ((running >= max_jobs)); then- wait -n 2>/dev/null || true- ((running--))+ printf "%b[*] Started %s (PID: %d)%b\n" "${cyan:-}" "$func" "${batch_pids[${#batch_pids[@]}-1]}" "${reset:-}"++ # If we've reached max jobs, flush the current batch.+ if ((${#batch_pids[@]} >= max_jobs)); then+ local idx rc+ for idx in "${!batch_pids[@]}"; do+ if wait "${batch_pids[$idx]}" 2>/dev/null; then+ rc=0+ else+ rc=$?+ fi+ if [[ -s "${batch_logs[$idx]}" ]]; then+ printf "\n%b[%s] Output (%s)%b\n" "${bblue:-}" "$(date +'%Y-%m-%d %H:%M:%S')" "${batch_funcs[$idx]}" "${reset:-}"+ cat "${batch_logs[$idx]}"+ fi+ [[ ${VERBOSE:-false} == true ]] && printf "%b[*] Finished %s (PID: %s, rc=%s)%b\n" "${cyan:-}" "${batch_funcs[$idx]}" "${batch_pids[$idx]}" "$rc" "${reset:-}"+ [[ $rc -ne 0 ]] && ((failed++))+ rm -f "${batch_logs[$idx]}" 2>/dev/null || true+ done+ batch_pids=()+ batch_funcs=()+ batch_logs=()fidone-+# Wait for all remaining jobs and collect exit codes- local failed=0- for pid in "${pids[@]}"; do- if ! wait "$pid" 2>/dev/null; then- ((failed++))- fi- done-+ if ((${#batch_pids[@]} > 0)); then+ local idx rc+ for idx in "${!batch_pids[@]}"; do+ if wait "${batch_pids[$idx]}" 2>/dev/null; then+ rc=0+ else+ rc=$?+ fi+ if [[ -s "${batch_logs[$idx]}" ]]; then+ printf "\n%b[%s] Output (%s)%b\n" "${bblue:-}" "$(date +'%Y-%m-%d %H:%M:%S')" "${batch_funcs[$idx]}" "${reset:-}"+ cat "${batch_logs[$idx]}"+ fi+ [[ ${VERBOSE:-false} == true ]] && printf "%b[*] Finished %s (PID: %s, rc=%s)%b\n" "${cyan:-}" "${batch_funcs[$idx]}" "${batch_pids[$idx]}" "$rc" "${reset:-}"+ [[ $rc -ne 0 ]] && ((failed++))+ rm -f "${batch_logs[$idx]}" 2>/dev/null || true+ done+ fi+ rmdir "$parallel_log_root" 2>/dev/null || true+return $failed}diff --git a/modules/axiom.sh b/modules/axiom.shindex 5afe5b1..9f6bf79 100644--- a/modules/axiom.sh+++ b/modules/axiom.sh@@ -115,7 +115,7 @@ function axiom_launch() {printf 'axiom-fleet %q' "${AXIOM_FLEET_NAME}"printf ' %q' "${AXIOM_FLEET_ARGS[@]}"echo- axiom-fleet "${AXIOM_FLEET_NAME}" "${AXIOM_FLEET_ARGS[@]}"+ axiom-fleet2 "${AXIOM_FLEET_NAME}" "${AXIOM_FLEET_ARGS[@]}"axiom-select "$AXIOM_FLEET_NAME*"if [[ -n $AXIOM_POST_START ]]; thenbash -lc "$AXIOM_POST_START" 2>>"$LOGFILE" >/dev/nulldiff --git a/modules/core.sh b/modules/core.shindex 4195e65..f53cd7a 100644--- a/modules/core.sh+++ b/modules/core.sh@@ -1269,10 +1269,14 @@ function write_perf_summary() {donelocal subs_count webs_count hosts_count findings_count- subs_count=$(wc -l <"${dir}/subdomains/subdomains.txt" 2>/dev/null | tr -d ' ')- webs_count=$(wc -l <"${dir}/webs/webs_all.txt" 2>/dev/null | tr -d ' ')- hosts_count=$(wc -l <"${dir}/hosts/ips.txt" 2>/dev/null | tr -d ' ')- findings_count=$(find "${dir}/nuclei_output" -type f -name '*_json.txt' -exec cat {} + 2>/dev/null | wc -l | tr -d ' ')+ subs_count=$(count_lines "${dir}/subdomains/subdomains.txt")+ webs_count=$(count_lines "${dir}/webs/webs_all.txt")+ hosts_count=$(count_lines "${dir}/hosts/ips.txt")+ if [[ -d "${dir}/nuclei_output" ]]; then+ findings_count=$(find "${dir}/nuclei_output" -type f -name '*_json.txt' -exec cat {} + 2>/dev/null | wc -l | tr -d ' ')+ else+ findings_count=0+ fisubs_count=${subs_count:-0}webs_count=${webs_count:-0}hosts_count=${hosts_count:-0}@@ -1339,16 +1343,16 @@ function generate_consolidated_report() {local sev_info sev_low sev_medium sev_high sev_criticallocal top_assets_json timeline_json links_json monitor_delta_json monitor_alerts_json- subs_count=$(wc -l <subdomains/subdomains.txt 2>/dev/null | tr -d ' ')- webs_count=$(wc -l <webs/webs_all.txt 2>/dev/null | tr -d ' ')- hosts_count=$(wc -l <hosts/ips.txt 2>/dev/null | tr -d ' ')+ subs_count=$(count_lines "subdomains/subdomains.txt")+ webs_count=$(count_lines "webs/webs_all.txt")+ hosts_count=$(count_lines "hosts/ips.txt")screenshots_count=$(find screenshots -type f -name '*.png' 2>/dev/null | wc -l | tr -d ' ')- sev_info=$(wc -l <nuclei_output/info_json.txt 2>/dev/null | tr -d ' ')- sev_low=$(wc -l <nuclei_output/low_json.txt 2>/dev/null | tr -d ' ')- sev_medium=$(wc -l <nuclei_output/medium_json.txt 2>/dev/null | tr -d ' ')- sev_high=$(wc -l <nuclei_output/high_json.txt 2>/dev/null | tr -d ' ')- sev_critical=$(wc -l <nuclei_output/critical_json.txt 2>/dev/null | tr -d ' ')+ sev_info=$(count_lines "nuclei_output/info_json.txt")+ sev_low=$(count_lines "nuclei_output/low_json.txt")+ sev_medium=$(count_lines "nuclei_output/medium_json.txt")+ sev_high=$(count_lines "nuclei_output/high_json.txt")+ sev_critical=$(count_lines "nuclei_output/critical_json.txt")subs_count=${subs_count:-0}webs_count=${webs_count:-0}diff --git a/modules/modes.sh b/modules/modes.shindex 08417ff..2ff8889 100644--- a/modules/modes.sh+++ b/modules/modes.sh@@ -274,6 +274,9 @@ function end() {global_end=$(date +%s)getElapsedTime $global_start $global_endprintf "${bgreen}#######################################################################${reset}\n"+ if [[ "${RECON_PARTIAL_RUN:-false}" == "true" ]]; then+ notification "Run completed with non-fatal warnings (osint_parallel=${RECON_OSINT_PARALLEL_FAILURES:-0})" warn+ finotification "Finished Recon on: ${domain} under ${finaldir} in: ${runtime}" good "$(date +'%Y-%m-%d %H:%M:%S')"[ "$SOFT_NOTIFICATION" = true ] && echo "[$(date +'%Y-%m-%d %H:%M:%S')] Finished Recon on: ${domain} under ${finaldir} in: ${runtime}" | notify -silentprintf "${bgreen}#######################################################################${reset}\n"@@ -400,21 +403,49 @@ function vulns() {if [[ "${PARALLEL_MODE:-true}" == "true" ]] && declare -f parallel_funcs &>/dev/null; then# Parallel execution - group independent checksprintf "%b[*] Running vulnerability checks in parallel mode%b\n" "$bblue" "$reset"- if ! parallel_funcs 4 cors open_redirect crlf_checks xss; then- notification "Parallel vulns batch failed (group 1)" error- return 1+ parallel_funcs 4 cors open_redirect crlf_checks xss+ local vulns_g1_rc=$?+ if ((vulns_g1_rc > 0)); then+ if [[ "${CONTINUE_ON_TOOL_ERROR:-true}" == "true" ]]; then+ RECON_PARTIAL_RUN=true+ notification "Parallel vulns group 1 completed with ${vulns_g1_rc} warning(s); continuing" warn+ else+ notification "Parallel vulns batch failed (group 1)" error+ return 1+ fifi- if ! parallel_funcs 4 ssrf_checks lfi ssti sqli; then- notification "Parallel vulns batch failed (group 2)" error- return 1+ parallel_funcs 4 ssrf_checks lfi ssti sqli+ local vulns_g2_rc=$?+ if ((vulns_g2_rc > 0)); then+ if [[ "${CONTINUE_ON_TOOL_ERROR:-true}" == "true" ]]; then+ RECON_PARTIAL_RUN=true+ notification "Parallel vulns group 2 completed with ${vulns_g2_rc} warning(s); continuing" warn+ else+ notification "Parallel vulns batch failed (group 2)" error+ return 1+ fifi- if ! parallel_funcs 3 command_injection prototype_pollution smuggling; then- notification "Parallel vulns batch failed (group 3)" error- return 1+ parallel_funcs 3 command_injection prototype_pollution smuggling+ local vulns_g3_rc=$?+ if ((vulns_g3_rc > 0)); then+ if [[ "${CONTINUE_ON_TOOL_ERROR:-true}" == "true" ]]; then+ RECON_PARTIAL_RUN=true+ notification "Parallel vulns group 3 completed with ${vulns_g3_rc} warning(s); continuing" warn+ else+ notification "Parallel vulns batch failed (group 3)" error+ return 1+ fifi- if ! parallel_funcs 3 webcache spraying brokenLinks; then- notification "Parallel vulns batch failed (group 4)" error- return 1+ parallel_funcs 3 webcache spraying brokenLinks+ local vulns_g4_rc=$?+ if ((vulns_g4_rc > 0)); then+ if [[ "${CONTINUE_ON_TOOL_ERROR:-true}" == "true" ]]; then+ RECON_PARTIAL_RUN=true+ notification "Parallel vulns group 4 completed with ${vulns_g4_rc} warning(s); continuing" warn+ else+ notification "Parallel vulns batch failed (group 4)" error+ return 1+ fififuzzparams4xxbypass@@ -509,6 +540,9 @@ function multi_osint() {}function recon() {+ RECON_PARTIAL_RUN=false+ RECON_OSINT_PARALLEL_FAILURES=0+# Initialize progress tracking for selected execution model.local progress_totalif [[ "${PARALLEL_MODE:-true}" == "true" ]] && declare -f parallel_funcs &>/dev/null; then@@ -520,14 +554,20 @@ function recon() {if [[ "${PARALLEL_MODE:-true}" == "true" ]] && declare -f parallel_funcs &>/dev/null; thenprogress_step "OSINT: domain_info, ip_info, emails, dorks"- if ! parallel_funcs 4 domain_info ip_info emails google_dorks; then- notification "Parallel OSINT batch failed (group 1)" error- return 1+ parallel_funcs 4 domain_info ip_info emails google_dorks+ local osint_g1_rc=$?+ if ((osint_g1_rc > 0)); then+ RECON_PARTIAL_RUN=true+ RECON_OSINT_PARALLEL_FAILURES=$((RECON_OSINT_PARALLEL_FAILURES + osint_g1_rc))+ notification "Parallel OSINT group 1 completed with ${osint_g1_rc} warning(s); continuing" warnfiprogress_step "OSINT: repos, metadata, api_leaks, 3rd_party"- if ! parallel_funcs 4 github_repos metadata apileaks third_party_misconfigs; then- notification "Parallel OSINT batch failed (group 2)" error- return 1+ parallel_funcs 4 github_repos metadata apileaks third_party_misconfigs+ local osint_g2_rc=$?+ if ((osint_g2_rc > 0)); then+ RECON_PARTIAL_RUN=true+ RECON_OSINT_PARALLEL_FAILURES=$((RECON_OSINT_PARALLEL_FAILURES + osint_g2_rc))+ notification "Parallel OSINT group 2 completed with ${osint_g2_rc} warning(s); continuing" warnfiprogress_step "Zone transfer"zonetransfer@@ -557,6 +597,10 @@ function recon() {faviconfi+ if [[ "${RECON_PARTIAL_RUN:-false}" == "true" ]]; then+ notification "Recon is continuing in partial mode (OSINT warnings: ${RECON_OSINT_PARALLEL_FAILURES:-0})" warn+ fi+if [[ $AXIOM == true ]]; thenaxiom_launchaxiom_selected@@ -575,9 +619,16 @@ function recon() {if [[ "${PARALLEL_MODE:-true}" == "true" ]] && declare -f parallel_funcs &>/dev/null; thenprogress_step "screenshot, cdnprovider, portscan"- if ! parallel_funcs 3 screenshot cdnprovider portscan; then- notification "Parallel web/host batch failed" error- return 1+ parallel_funcs 3 screenshot cdnprovider portscan+ local webhost_rc=$?+ if ((webhost_rc > 0)); then+ if [[ "${CONTINUE_ON_TOOL_ERROR:-true}" == "true" ]]; then+ RECON_PARTIAL_RUN=true+ notification "Parallel web/host batch completed with ${webhost_rc} warning(s); continuing" warn+ else+ notification "Parallel web/host batch failed" error+ return 1+ fifiprogress_step "geo_info"geo_infodiff --git a/modules/osint.sh b/modules/osint.shindex b1c8598..46d9ef2 100644--- a/modules/osint.sh+++ b/modules/osint.sh@@ -93,15 +93,17 @@ function github_repos() {return 1fielse+ log_note "No GitHub repos found for ${domain}; continuing" "${FUNCNAME[0]}" "${LINENO}"end_func "Results are saved in $domain/osint/github_company_secrets.json" "${FUNCNAME[0]}"- return 1+ return 0fiif [[ -d ".tmp/github_repos/" ]]; thenls .tmp/github_repos >.tmp/github_repos_folders.txtelse+ log_note "GitHub clone directory missing for ${domain}; no repo artifacts to process" "${FUNCNAME[0]}" "${LINENO}"end_func "Results are saved in $domain/osint/github_company_secrets.json" "${FUNCNAME[0]}"- return 1+ return 0fiif [[ -s ".tmp/github_repos_folders.txt" ]]; then@@ -111,8 +113,9 @@ function github_repos() {return 1fielse+ log_note "No cloned GitHub repos to scan with gitleaks for ${domain}" "${FUNCNAME[0]}" "${LINENO}"end_func "Results are saved in $domain/osint/github_company_secrets.json" "${FUNCNAME[0]}"- return 1+ return 0fiif [[ -s ".tmp/company_repos_url.txt" ]]; then@@ -128,8 +131,9 @@ function github_repos() {return 1fielse+ log_note "No GitHub scan outputs available to merge for ${domain}" "${FUNCNAME[0]}" "${LINENO}"end_func "Results are saved in $domain/osint/github_company_secrets.json" "${FUNCNAME[0]}"- return 1+ return 0fiend_func "Results are saved in $domain/osint/github_company_secrets.json" "${FUNCNAME[0]}"@@ -349,8 +353,24 @@ function third_party_misconfigs() {return 1fi- # Run misconfig-mapper and handle errors- misconfig-mapper -target "$company_name" -service "*" 2>&1 | grep -v "\-\]" | grep -v "Failed" >"${dir}/osint/3rdparts_misconfigurations.txt"+ # Run misconfig-mapper and treat manual interrupts as non-fatal so recon can continue.+ local misconfig_rc=0+ {+ misconfig-mapper -target "$company_name" -service "*" 2>&1 \+ | grep -v "\-\]" \+ | grep -v "Failed" >"${dir}/osint/3rdparts_misconfigurations.txt"+ misconfig_rc=${PIPESTATUS[0]:-0}+ } || true+ if [[ $misconfig_rc -eq 130 || $misconfig_rc -eq 137 || $misconfig_rc -eq 143 ]]; then+ notification "misconfig-mapper interrupted (rc=${misconfig_rc}); skipping third_party_misconfigs and continuing" warn+ log_note "misconfig-mapper interrupted by user/system (rc=${misconfig_rc})" "${FUNCNAME[0]}" "${LINENO}"+ if ! popd >/dev/null; then+ printf "%b[!] Failed to return to previous directory in %s at line %s.%b\n" \+ "$bred" "${FUNCNAME[0]}" "$LINENO" "$reset"+ return 1+ fi+ return 0+ fi# Return to the previous directoryif ! popd >/dev/null; thendiff --git a/modules/subdomains.sh b/modules/subdomains.shindex 525bd6c..4c40ca6 100644--- a/modules/subdomains.sh+++ b/modules/subdomains.sh@@ -262,27 +262,51 @@ _subdomains_enumerate() {sub_asn# Phase 1: Passive sources (all can run in parallel)- if ! parallel_funcs 4 sub_passive sub_crt; then- notification "Parallel subdomain batch failed (passive)" error- return 1+ parallel_funcs 4 sub_passive sub_crt+ local sub_g1_rc=$?+ if ((sub_g1_rc > 0)); then+ if [[ "${CONTINUE_ON_TOOL_ERROR:-true}" == "true" ]]; then+ notification "Parallel subdomain passive phase completed with ${sub_g1_rc} warning(s); continuing" warn+ else+ notification "Parallel subdomain batch failed (passive)" error+ return 1+ fifi# Phase 2: Active DNS resolution (parallel)- if ! parallel_funcs 3 sub_active sub_noerror sub_dns; then- notification "Parallel subdomain batch failed (active)" error- return 1+ parallel_funcs 3 sub_active sub_noerror sub_dns+ local sub_g2_rc=$?+ if ((sub_g2_rc > 0)); then+ if [[ "${CONTINUE_ON_TOOL_ERROR:-true}" == "true" ]]; then+ notification "Parallel subdomain active phase completed with ${sub_g2_rc} warning(s); continuing" warn+ else+ notification "Parallel subdomain batch failed (active)" error+ return 1+ fifi# Phase 3: Post-active (depend on resolved subdomains)- if ! parallel_funcs 2 sub_tls sub_analytics; then- notification "Parallel subdomain batch failed (post-active)" error- return 1+ parallel_funcs 2 sub_tls sub_analytics+ local sub_g3_rc=$?+ if ((sub_g3_rc > 0)); then+ if [[ "${CONTINUE_ON_TOOL_ERROR:-true}" == "true" ]]; then+ notification "Parallel subdomain post-active phase completed with ${sub_g3_rc} warning(s); continuing" warn+ else+ notification "Parallel subdomain batch failed (post-active)" error+ return 1+ fifi# Phase 4: Brute force (limited parallelism - resource intensive)- if ! parallel_funcs 2 sub_brute sub_permut sub_regex_permut sub_ia_permut; then- notification "Parallel subdomain batch failed (bruteforce/permutations)" error- return 1+ parallel_funcs 2 sub_brute sub_permut sub_regex_permut sub_ia_permut+ local sub_g4_rc=$?+ if ((sub_g4_rc > 0)); then+ if [[ "${CONTINUE_ON_TOOL_ERROR:-true}" == "true" ]]; then+ notification "Parallel subdomain bruteforce/permutations phase completed with ${sub_g4_rc} warning(s); continuing" warn+ else+ notification "Parallel subdomain batch failed (bruteforce/permutations)" error+ return 1+ fifi# Phase 5: Recursive and scraping (sequential - depends on previous results)diff --git a/reconftw.cfg b/reconftw.cfgindex a468748..18bb8c4 100644--- a/reconftw.cfg+++ b/reconftw.cfg@@ -210,6 +210,7 @@ FUZZPARAMS=true # Fuzz parameters values# ParallelizationPARALLEL_MODE=true # Run independent functions in parallel (faster, uses more resources). Disable with --no-parallel or set false.PERF_PROFILE="balanced" # Performance profile: low|balanced|max+CONTINUE_ON_TOOL_ERROR=true # Continue recon when a tool/module fails in parallel batches (set false for fail-fast).# Extra featuresNOTIFICATION=false # Notification for every functiondiff --git a/reconftw.sh b/reconftw.shindex 7ba26ac..134f5a3 100755--- a/reconftw.sh+++ b/reconftw.sh@@ -122,6 +122,7 @@ fi# shellcheck disable=SC2086eval set -- "$PROGARGS"unset PROGARGS+CLI_PARALLEL_MODE=""while true; docase "$1" in@@ -310,11 +311,13 @@ while true; do;;'--parallel')PARALLEL_MODE=true+ CLI_PARALLEL_MODE=trueshiftcontinue;;'--no-parallel')PARALLEL_MODE=false+ CLI_PARALLEL_MODE=falseshiftcontinue;;@@ -405,6 +408,9 @@ fiif [[ "${CLI_REPORT_ONLY:-false}" == "true" ]]; thenREPORT_ONLY=truefi+if [[ -n "${CLI_PARALLEL_MODE:-}" ]]; then+ PARALLEL_MODE="${CLI_PARALLEL_MODE}"+fiif [[ $opt_deep ]]; thenDEEP=truediff --git a/tests/unit/test_parallel.bats b/tests/unit/test_parallel.batsindex d980ee7..a3d12e5 100644--- a/tests/unit/test_parallel.bats+++ b/tests/unit/test_parallel.bats@@ -84,6 +84,24 @@ teardown() {[ "$status" -eq 1 ]}+@test "parallel_funcs buffers output per function" {+ func_a() { echo "A1"; sleep 0.05; echo "A2"; }+ func_b() { echo "B1"; sleep 0.05; echo "B2"; }++ run parallel_funcs 2 func_a func_b+ [ "$status" -eq 0 ]+ [[ "$output" == *$'A1\nA2'* ]]+ [[ "$output" == *$'B1\nB2'* ]]+}++@test "parallel_funcs cleans temporary buffered output" {+ func_ok() { echo "ok"; }++ run parallel_funcs 2 func_ok+ [ "$status" -eq 0 ]+ [ ! -d "/tmp/reconftw_parallel.$$" ]+}+################################################################################ parallel_batch tests###############################################################################diff --git a/tests/unit/test_reporting.bats b/tests/unit/test_reporting.batsindex bce3e06..e64b795 100644--- a/tests/unit/test_reporting.bats+++ b/tests/unit/test_reporting.bats@@ -49,3 +49,13 @@ JSONgrep -q '"delta_since_last"' report/report.jsongrep -q '"alerts_last"' report/report.json}++@test "report generation handles missing optional artifacts gracefully" {+ rm -f subdomains/subdomains.txt webs/webs_all.txt hosts/ips.txt+ rm -rf nuclei_output++ run generate_consolidated_report+ [ "$status" -eq 0 ]+ [ -f report/report.json ]+ [[ "$output" != *"No such file or directory"* ]]+}