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
clean asnmap output if 0 results
six2dez184c848ca975
diff --git a/modules/subdomains.sh b/modules/subdomains.shindex 3a08e9a..9c2421d 100644--- a/modules/subdomains.sh+++ b/modules/subdomains.sh@@ -455,7 +455,7 @@ function sub_asn() {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+ elif [[ $asn_rc -eq 0 ]] && jq -e '((.cidr // "") | tostring | length) > 0 or ((.as_number // "") | tostring | length) > 0' "$asn_json" >/dev/null 2>&1; thenjq -r '.cidr // empty' "$asn_json" | sed '/^$/d' | sort -u >.tmp/asn_cidrs.txtjq -r '.as_number // empty' "$asn_json" | sed '/^$/d' | sort -u >.tmp/asn_numbers.txt@@ -482,6 +482,9 @@ function sub_asn() {if [[ -s .tmp/subs_no_resolved.txt ]]; then_print_msg INFO "ASN sources added $(wc -l <.tmp/subs_no_resolved.txt | tr -d ' ') in-scope domains"fi+ elif [[ $asn_rc -eq 0 ]]; then+ # No ASN data for this target: continue silently without warning.+ asn_status="OK"elif [[ $asn_rc -eq 124 || $asn_rc -eq 137 ]]; then_print_msg WARN "asnmap timed out after 120s. Skipping ASN output for ${domain}."log_note "asnmap timed out after 120s. Skipping ASN output for ${domain}." "${FUNCNAME[0]}" "${LINENO}"diff --git a/tests/unit/test_subdomains_asn.bats b/tests/unit/test_subdomains_asn.batsindex 70dea99..e76a7cd 100644--- a/tests/unit/test_subdomains_asn.bats+++ b/tests/unit/test_subdomains_asn.bats@@ -141,6 +141,21 @@ EOF[ ! -s "hosts/asn_numbers.txt" ]}+@test "sub_asn continues silently when asnmap returns exit 0 with no ASN data" {+ create_mock_asnmap+ export ASNMAP_MOCK_CALLS="${TEST_DIR}/asnmap_calls.log"+ export ASNMAP_MOCK_SCENARIO="empty"+ export PDCP_API_KEY="pdcp_test_key"++ run sub_asn++ [ "$status" -eq 0 ]+ [[ "$output" != *"no ASN data"* ]]+ ! grep -q "no ASN data" "$LOGFILE"+ [ ! -s "hosts/asn_cidrs.txt" ]+ [ ! -s "hosts/asn_numbers.txt" ]+}+@test "sub_asn skips when asnmap is not installed and logs it" {PATH="/usr/bin:/bin:${MOCK_BIN}"export PATH