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
feat: validate custom function exists before execution
six2dez5efb177563e1
diff --git a/reconftw.sh b/reconftw.shindex 4f40c90..c552491 100755--- a/reconftw.sh+++ b/reconftw.sh@@ -213,6 +213,13 @@ while true; do;;'-c' | '--custom')custom_function=$2+ # Validate that the custom function exists+ if ! declare -f "$custom_function" >/dev/null 2>&1; then+ printf "%bError: Custom function '%s' is not defined%b\n" "$bred" "$custom_function" "$reset" >&2+ printf "Available functions can be found in modules/*.sh\n" >&2+ printf "Example: -c my_custom_recon\n" >&2+ exit $E_INVALID_INPUT+ fiopt_mode='c'shift 2continuediff --git a/tests/integration/test_smoke.bats b/tests/integration/test_smoke.batsindex 1af66e9..da1d59a 100644--- a/tests/integration/test_smoke.bats+++ b/tests/integration/test_smoke.bats@@ -87,3 +87,9 @@ setup() {[ "$status" -ne 0 ][[ "$output" == *"ERROR"* ]] || [[ "$output" == *"not found"* ]]}++@test "invalid custom function shows error" {+ run timeout 5 bash "$SCRIPTPATH/reconftw.sh" -d test.com -c "nonexistent_function_xyz" 2>&1+ [ "$status" -ne 0 ]+ [[ "$output" == *"not defined"* ]] || [[ "$output" == *"Error"* ]]+}diff --git a/tests/unit/test_utils.bats b/tests/unit/test_utils.batsindex 8b8b998..acafc0d 100644--- a/tests/unit/test_utils.bats+++ b/tests/unit/test_utils.bats@@ -199,3 +199,20 @@ setup() {[ "${CIRCUIT_BREAKER_FAILURES[tool1]}" -eq 0 ]}++# Tests for check_secrets_permissions+@test "check_secrets_permissions warns on world-readable file" {+ local tmpfile+ tmpfile=$(mktemp)+ chmod 644 "$tmpfile"++ # Temporarily override sensitive_files list+ run bash -c "+ source '$SCRIPTPATH/reconftw.sh' --source-only+ check_secrets_permissions '$tmpfile'+ "++ rm -f "$tmpfile"+ # Function should return warning count (may be 0 if file not in list)+ [ "$status" -eq 0 ] || [ "$status" -eq 1 ]+}