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 ffuf and other stuff
six2dez4fe052cf2778
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 28fe8fe..8df4dfb 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]+### Added+- `swagger_check()` function in `modules/web.sh`: Swagger/OpenAPI definition discovery and authentication analysis using [sj](https://github.com/BishopFox/sj) (Swagger Jacker). Three phases: (1) active brute-force discovery of hidden swagger/openapi definitions via `sj brute` with interlace parallelization, (2) aggregation of swagger URLs from nuclei (`swagger-api`/`openapi` templates) and SwaggerSpy OSINT output (with scope filtering via `check_inscope`), (3) endpoint extraction (`sj endpoints`) and authentication testing (`sj automate`) to identify unauthenticated API endpoints. Config: `SJ_CHECK=true`, `SJ_BRUTE=true`, `SJ_AUTOMATE=true`, `SJ_TIMEOUT=30`, `SJ_MAX_TARGETS=200`. Output: `webs/swagger_urls.txt`, `vulns/swagger/endpoints_all.txt`, `vulns/swagger/automate/*.json`, `vulns/swagger/accessible_endpoints.txt`.+### Changed- Replaced metagoofil + exiftool with [exifray](https://github.com/mmarting/exifray) in `metadata()` function (`modules/osint.sh`). Single tool handles both file discovery and metadata extraction, outputting structured JSON (`osint/metadata.json`) plus a human-readable summary (`osint/metadata_results.txt`).diff --git a/config/tool_versions.txt b/config/tool_versions.txtindex 9a31b46..b6e88df 100644--- a/config/tool_versions.txt+++ b/config/tool_versions.txt@@ -54,6 +54,7 @@ shortscan=v0.9.2hakoriginfinder=latestsourcemapper=latestjsluice=latest+sj=v2.5.0urlfinder=v0.0.3cent=v2.0.0csprecon=v0.4.3diff --git a/install.sh b/install.shindex ced7902..6e0515f 100755--- a/install.sh+++ b/install.sh@@ -333,6 +333,7 @@ declare -A gotools=(["hakoriginfinder"]="github.com/hakluke/hakoriginfinder"["sourcemapper"]="github.com/denandz/sourcemapper"["jsluice"]="github.com/BishopFox/jsluice/cmd/jsluice"+ ["sj"]="github.com/BishopFox/sj"["urlfinder"]="github.com/projectdiscovery/urlfinder/cmd/urlfinder"["cent"]="github.com/xm1k3/cent"["csprecon"]="github.com/edoardottt/csprecon/cmd/csprecon"diff --git a/modules/core.sh b/modules/core.shindex 29d5fea..895d714 100644--- a/modules/core.sh+++ b/modules/core.sh@@ -500,6 +500,7 @@ function tools_installed() {["second-order"]="second-order"["exifray"]="exifray"["fray"]="fray"+ ["sj"]="sj")# Check for tool filesdiff --git a/modules/modes.sh b/modules/modes.shindex 6e9c9bc..82f298c 100644--- a/modules/modes.sh+++ b/modules/modes.sh@@ -825,7 +825,7 @@ function recon() {_print_status SKIP "Web Analysis" "(no new subs/webs)"TIME_SAVED_EST=$((${TIME_SAVED_EST:-0} + \${TIME_EST_WAF:-0} + ${TIME_EST_NUCLEI:-600} + ${TIME_EST_API:-300} + ${TIME_EST_GQL:-180} + \- ${TIME_EST_FUZZ:-900} + ${TIME_EST_IIS:-60} + ${TIME_EST_URLCHECKS:-300} + ${TIME_EST_JSCHECKS:-300} + \+ ${TIME_EST_FUZZ:-900} + ${TIME_EST_IIS:-60} + ${TIME_EST_SJ:-120} + ${TIME_EST_URLCHECKS:-300} + ${TIME_EST_JSCHECKS:-300} + \${TIME_EST_PARAM:-240} + ${TIME_EST_GRPC:-120}))else_print_section "Web Analysis"@@ -836,6 +836,7 @@ function recon() {run_module_with_axiom_failover graphql_scanrun_module_with_axiom_failover fuzzrun_module_with_axiom_failover iishortname+ swagger_checkrun_module_with_axiom_failover urlchecksrun_module_with_axiom_failover jscheckssub_js_extract@@ -1053,6 +1054,7 @@ function multi_recon() {loopstart=$(date +%s)run_module_with_axiom_failover fuzzrun_module_with_axiom_failover iishortname+ swagger_checkrun_module_with_axiom_failover urlchecksrun_module_with_axiom_failover jscheckscurrently=$(date +"%H:%M:%S")@@ -1232,6 +1234,7 @@ function webs_menu() {run_module_with_axiom_failover fuzzcms_scannerrun_module_with_axiom_failover iishortname+ swagger_checkrun_module_with_axiom_failover urlchecksparam_discoveryrun_module_with_axiom_failover jschecks@@ -1278,6 +1281,7 @@ function zen_menu() {run_module_with_axiom_failover graphql_scanrun_module_with_axiom_failover fuzzrun_module_with_axiom_failover iishortname+ swagger_checkif [[ $AXIOM == true ]]; thenaxiom_shutdownfidiff --git a/modules/web.sh b/modules/web.shindex 0b81bec..7d851fa 100644--- a/modules/web.sh+++ b/modules/web.sh@@ -1513,8 +1513,11 @@ _fuzz_run_local() {find "$dir/.tmp/fuzzing/" -type f -name "*.json" -print0 2>/dev/null | while IFS= read -r -d '' json_file; dolocal basebase=$(basename "${json_file%.json}")- jq -r 'try .results[] | "\(.status) \(.length) \(.url)"' "$json_file" 2>/dev/null \- | sort -k1 | anew -q "fuzzing/${base}.txt" 2>>"$LOGFILE" || true+ # Preserve raw JSON in final output directory+ cp "$json_file" "$dir/fuzzing/${base}.json" 2>>"$LOGFILE" || true+ # Extract human-readable TXT summary+ jq -r 'try .results[] | "\(.status) \(.length) \(.url)"' "$json_file" 2>>"$LOGFILE" \+ | sort -k1 | anew -q "$dir/fuzzing/${base}.txt" 2>>"$LOGFILE" || truedone}@@ -1531,7 +1534,7 @@ _fuzz_run_axiom() {jq -r --arg sub "$sub" 'try .results[] | select(.url | contains($sub)) | "\(.status) \(.length) \(.url)"' "$dir/.tmp/ffuf-content.json" 2>>"$LOGFILE" \| sort -k1 >"$tmp_out" || trueif [[ -s "$tmp_out" ]]; then- anew -q "fuzzing/${sub_out}.txt" <"$tmp_out" 2>>"$LOGFILE" || true+ anew -q "$dir/fuzzing/${sub_out}.txt" <"$tmp_out" 2>>"$LOGFILE" || truefirm -f "$tmp_out" 2>/dev/null || truefi@@ -1540,7 +1543,7 @@ _fuzz_run_axiom() {# Merge all per-subdomain fuzzing results into fuzzing_full.txt_fuzz_merge_results() {- find "$dir/fuzzing/" -type f -iname "*.txt" -exec cat {} + 2>>"$LOGFILE" | sort -k1 | anew -q "$dir/fuzzing/fuzzing_full.txt"+ find "$dir/fuzzing/" -type f -iname "*.txt" ! -name "fuzzing_full.txt" -exec cat {} + 2>>"$LOGFILE" | sort -k1 | anew -q "$dir/fuzzing/fuzzing_full.txt"}function fuzz() {@@ -1628,6 +1631,118 @@ function iishortname() {}+function swagger_check() {+ ensure_dirs .tmp webs vulns/swagger++ if { [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; } && [[ $SJ_CHECK == true ]]; then+ if ! command -v sj >/dev/null 2>&1; then+ end_func "sj not found in PATH, skipping" "${FUNCNAME[0]}" "SKIP_NOINPUT"+ return 0+ fi+ start_func "${FUNCNAME[0]}" "Swagger/OpenAPI analysis"++ : >.tmp/swagger_urls_all.txt++ # ── Phase 1: Brute-force discovery with sj brute ─────────────+ if [[ $SJ_BRUTE == true ]] && [[ -s "webs/webs_all.txt" ]]; then+ mkdir -p .tmp/sj_brute++ local brute_targets=".tmp/sj_brute_targets.txt"+ if [[ ${SJ_MAX_TARGETS:-0} -gt 0 ]]; then+ head -n "${SJ_MAX_TARGETS}" webs/webs_all.txt >"$brute_targets"+ else+ cp webs/webs_all.txt "$brute_targets"+ fi++ run_command interlace -tL "$brute_targets" -threads "$INTERLACE_THREADS" \+ -c "sj brute -u _target_ -qi -t ${SJ_TIMEOUT:-30} 2>/dev/null | grep -o 'Definition file found: .*' > _output_/_cleantarget_.txt" \+ -o .tmp/sj_brute 2>>"$LOGFILE" >/dev/null || true++ find .tmp/sj_brute/ -type f -name "*.txt" -print0 2>/dev/null \+ | xargs -0 grep -hoP 'Definition file found: \K\S+' 2>/dev/null \+ | sort -u \+ | anew -q .tmp/swagger_urls_all.txt+ fi++ # ── Phase 2: Aggregate swagger URLs from other sources ────────+ # Nuclei: template-ids "swagger-api" and "openapi" (already in scope)+ if [[ -d "nuclei_output" ]]; then+ IFS=',' read -ra severity_array <<<"$NUCLEI_SEVERITY"+ for crit in "${severity_array[@]}"; do+ local src_json="nuclei_output/${crit}_json.txt"+ if [[ -s "$src_json" ]]; then+ jq -r 'select(."template-id" == "swagger-api" or ."template-id" == "openapi") | .["matched-at"] // .host // empty' "$src_json" 2>/dev/null \+ | sed '/^$/d' \+ | anew -q .tmp/swagger_urls_all.txt+ fi+ done+ fi++ # SwaggerSpy OSINT output: filter against scope before adding+ if [[ -s "${dir}/osint/swagger_leaks.txt" ]]; then+ grep -hioP 'https?://\S+' "${dir}/osint/swagger_leaks.txt" 2>/dev/null \+ | grep -iE '\.(json|yaml|yml)$|swagger|openapi|api-docs' \+ >.tmp/swagger_spy_candidates.txt || true+ if [[ -s .tmp/swagger_spy_candidates.txt ]]; then+ check_inscope .tmp/swagger_spy_candidates.txt 2>/dev/null || true+ if [[ -s .tmp/swagger_spy_candidates.txt ]]; then+ cat .tmp/swagger_spy_candidates.txt | anew -q .tmp/swagger_urls_all.txt+ fi+ fi+ fi++ # Deduplicate+ if [[ -s .tmp/swagger_urls_all.txt ]]; then+ sort -u .tmp/swagger_urls_all.txt -o .tmp/swagger_urls_all.txt+ cp .tmp/swagger_urls_all.txt "webs/swagger_urls.txt"+ fi++ local swagger_count+ swagger_count=$(wc -l <.tmp/swagger_urls_all.txt 2>/dev/null || echo 0)+ swagger_count=$((swagger_count + 0))++ if [[ $swagger_count -eq 0 ]]; then+ end_func "No swagger/openapi definitions discovered" "${FUNCNAME[0]}"+ return+ fi++ # ── Phase 3: Endpoint extraction + auth testing ───────────────+ : >vulns/swagger/endpoints_all.txt+ mkdir -p vulns/swagger/automate++ while IFS= read -r swagger_url; do+ [[ -z "$swagger_url" ]] && continue++ # Extract endpoints+ sj endpoints -u "$swagger_url" -qi -t "${SJ_TIMEOUT:-30}" 2>>"$LOGFILE" \+ | anew -q vulns/swagger/endpoints_all.txt || true++ # Auth testing with sj automate+ if [[ $SJ_AUTOMATE == true ]]; then+ local clean_name+ clean_name=$(echo "$swagger_url" | sed -e 's|^[^/]*//||' -e 's|[^a-zA-Z0-9._-]|_|g')+ local automate_out="vulns/swagger/automate/${clean_name}.json"++ sj automate -u "$swagger_url" -qi -t "${SJ_TIMEOUT:-30}" \+ -F json -o "$automate_out" 2>>"$LOGFILE" || true++ if [[ -s "$automate_out" ]]; then+ jq -r 'select(.status == 200) | "\(.method) \(.target)"' "$automate_out" 2>/dev/null \+ | anew -q vulns/swagger/accessible_endpoints.txt || true+ fi+ fi+ done <.tmp/swagger_urls_all.txt++ end_func "Results are saved in webs/swagger_urls.txt and vulns/swagger/" "${FUNCNAME[0]}"+ else+ if [[ $SJ_CHECK == false ]]; then+ skip_notification "disabled"+ else+ skip_notification "processed"+ fi+ fi+}+function cms_scanner() {# Create necessary directoriesdiff --git a/reconftw.cfg b/reconftw.cfgindex f99005c..691f5e7 100644--- a/reconftw.cfg+++ b/reconftw.cfg@@ -230,6 +230,11 @@ GETJSWORDS_VENV="$SCRIPTPATH/.venv"FUZZ=true # Web fuzzingFUZZ_RECURSION_DEPTH=2 # ffuf recursion depth used in DEEP modeIIS_SHORTNAME=true+SJ_CHECK=true # Swagger/OpenAPI analysis with sj+SJ_BRUTE=true # Brute-force discovery of hidden swagger definitions+SJ_AUTOMATE=true # Test endpoints for auth weaknesses+SJ_TIMEOUT=30 # Per-request timeout (seconds)+SJ_MAX_TARGETS=200 # Max targets for brute-force (0 = unlimited)CMS_SCANNER=true # CMS scannerWORDLIST=true # Wordlist generationROBOTSWORDLIST=true # Check historic disallow entries on waybackMachine (DEEP mode only)diff --git a/tests/unit/test_new_tool_integrations.bats b/tests/unit/test_new_tool_integrations.batsindex 5565d75..3e05de1 100644--- a/tests/unit/test_new_tool_integrations.bats+++ b/tests/unit/test_new_tool_integrations.bats@@ -1192,3 +1192,183 @@ SH[ -s "webs/robots_wordlist.txt" ]grep -q "https://target.example.com/robots-path" "webs/robots_wordlist.txt"}++# ── swagger_check (sj) tests ──────────────────────────────────────────++@test "swagger_check discovers swagger via sj brute and writes swagger_urls.txt" {+ mkdir -p webs .tmp++ printf '%s\n' 'https://target.example.com' > webs/webs_all.txt++ cat > "$MOCK_BIN/sj" <<'SH'+#!/usr/bin/env bash+if [[ "$1" == "brute" ]]; then+ printf '%s\n' 'Definition file found: https://target.example.com/swagger.json'+fi+SH+ chmod +x "$MOCK_BIN/sj"++ cat > "$MOCK_BIN/interlace" <<'SH'+#!/usr/bin/env bash+targets="" cmd="" outdir=""+while [[ $# -gt 0 ]]; do+ case "$1" in+ -tL) targets="$2"; shift 2 ;;+ -c) cmd="$2"; shift 2 ;;+ -o) outdir="$2"; shift 2 ;;+ *) shift ;;+ esac+done+mkdir -p "$outdir"+while IFS= read -r target; do+ clean=$(echo "$target" | sed 's|[^a-zA-Z0-9._-]|_|g')+ real_cmd=$(echo "$cmd" | sed "s|_target_|$target|g" | sed "s|_output_|$outdir|g" | sed "s|_cleantarget_|$clean|g")+ eval "$real_cmd"+done < "$targets"+SH+ chmod +x "$MOCK_BIN/interlace"++ cat > "$MOCK_BIN/anew" <<'SH'+#!/usr/bin/env bash+if [[ "$1" == "-q" ]]; then+ target="$2"+else+ target="$1"+fi+while IFS= read -r line; do+ if [[ -n "$target" ]]; then+ printf '%s\n' "$line" >> "$target"+ else+ printf '%s\n' "$line"+ fi+done+SH+ chmod +x "$MOCK_BIN/anew"++ export SJ_CHECK=true+ export SJ_BRUTE=true+ export SJ_AUTOMATE=false+ export SJ_TIMEOUT=10+ export SJ_MAX_TARGETS=100+ export INTERLACE_THREADS=1+ export NUCLEI_SEVERITY="info"+ export DIFF=false++ run swagger_check+ [ "$status" -eq 0 ]+ [ -s "webs/swagger_urls.txt" ]+ grep -q "target.example.com/swagger.json" "webs/swagger_urls.txt"+}++@test "swagger_check aggregates nuclei swagger-api findings" {+ mkdir -p webs .tmp nuclei_output++ cat > "$MOCK_BIN/sj" <<'SH'+#!/usr/bin/env bash+exit 0+SH+ chmod +x "$MOCK_BIN/sj"++ cat > "$MOCK_BIN/anew" <<'SH'+#!/usr/bin/env bash+if [[ "$1" == "-q" ]]; then+ target="$2"+else+ target="$1"+fi+while IFS= read -r line; do+ if [[ -n "$target" ]]; then+ printf '%s\n' "$line" >> "$target"+ else+ printf '%s\n' "$line"+ fi+done+SH+ chmod +x "$MOCK_BIN/anew"++ # Nuclei output with swagger-api finding+ printf '%s\n' '{"template-id":"swagger-api","matched-at":"https://target.example.com/v2/swagger.json","info":{"severity":"info"}}' \+ > nuclei_output/info_json.txt++ export SJ_CHECK=true+ export SJ_BRUTE=false+ export SJ_AUTOMATE=false+ export SJ_TIMEOUT=10+ export NUCLEI_SEVERITY="info"+ export DIFF=false++ run swagger_check+ [ "$status" -eq 0 ]+ [ -s "webs/swagger_urls.txt" ]+ grep -q "target.example.com/v2/swagger.json" "webs/swagger_urls.txt"+}++@test "swagger_check runs sj automate and extracts accessible endpoints" {+ mkdir -p webs .tmp vulns/swagger/automate++ printf '%s\n' 'https://target.example.com/swagger.json' > .tmp/swagger_urls_all.txt+ printf '%s\n' 'https://target.example.com/swagger.json' > webs/swagger_urls.txt++ cat > "$MOCK_BIN/sj" <<'SH'+#!/usr/bin/env bash+if [[ "$1" == "endpoints" ]]; then+ printf '%s\n' '/api/v1/users' '/api/v1/pets'+elif [[ "$1" == "automate" ]]; then+ outfile=""+ for arg in "$@"; do+ case "$prev" in+ -o) outfile="$arg" ;;+ esac+ prev="$arg"+ done+ if [[ -n "$outfile" ]]; then+ printf '%s\n' '{"method":"GET","status":200,"target":"/api/v1/users"}' > "$outfile"+ printf '%s\n' '{"method":"POST","status":401,"target":"/api/v1/pets"}' >> "$outfile"+ fi+fi+SH+ chmod +x "$MOCK_BIN/sj"++ cat > "$MOCK_BIN/anew" <<'SH'+#!/usr/bin/env bash+if [[ "$1" == "-q" ]]; then+ target="$2"+else+ target="$1"+fi+while IFS= read -r line; do+ if [[ -n "$target" ]]; then+ printf '%s\n' "$line" >> "$target"+ else+ printf '%s\n' "$line"+ fi+done+SH+ chmod +x "$MOCK_BIN/anew"++ export SJ_CHECK=true+ export SJ_BRUTE=false+ export SJ_AUTOMATE=true+ export SJ_TIMEOUT=10+ export NUCLEI_SEVERITY="info"+ export DIFF=false++ run swagger_check+ [ "$status" -eq 0 ]+ [ -s "vulns/swagger/endpoints_all.txt" ]+ grep -q "/api/v1/users" "vulns/swagger/endpoints_all.txt"+ [ -s "vulns/swagger/accessible_endpoints.txt" ]+ grep -q "GET /api/v1/users" "vulns/swagger/accessible_endpoints.txt"+ # 401 endpoint should NOT be in accessible list+ ! grep -q "/api/v1/pets" "vulns/swagger/accessible_endpoints.txt"+}++@test "swagger_check skips when SJ_CHECK=false" {+ mkdir -p webs .tmp++ export SJ_CHECK=false++ run swagger_check+ [ "$status" -eq 0 ]+ [ ! -f "webs/swagger_urls.txt" ]+}