Skip to content

Conversation

@dogancanbakir
Copy link
Member

@dogancanbakir dogancanbakir commented Jan 5, 2026

Summary

  • When ARP or other host discovery methods find no live hosts (e.g., due to network configuration, firewall rules, or container environments), naabu now falls back to scanning all original targets instead of exiting with an error
  • Adds a warning message to inform users when this fallback occurs

Fixes

Closes #1194

Test plan

  • Test with host discovery enabled on a network where ARP fails (e.g., container/VM without proper network access)
  • Verify that port scanning proceeds with all original targets
  • Verify warning message is displayed when fallback occurs

Summary by CodeRabbit

  • Bug Fixes
    • Improved host discovery behavior: when no live hosts are discovered, the scanner now includes all targets in the scan instead of limiting to discovery results, with a warning message.

✏️ Tip: You can customize this high-level summary in your review settings.

When ARP or other host discovery methods find no live hosts
(e.g., due to network configuration or firewall rules), fall back
to scanning all original targets instead of exiting with error.

Fixes #1194
@auto-assign auto-assign bot requested a review from Mzack9999 January 5, 2026 10:10
@coderabbitai
Copy link

coderabbitai bot commented Jan 5, 2026

Walkthrough

The change modifies the host discovery callback selection in RunEnumeration to check whether the discovery found live hosts. If no hosts are detected, the function falls back to scanning all targets instead of relying on empty results, with a warning log emitted for this scenario.

Changes

Cohort / File(s) Summary
Host Discovery Fallback Logic
pkg/runner/runner.go
Made ipsCallback selection conditional: verifies if scanner.HostDiscoveryResults.HasIPS() before using getHostDiscoveryIps; falls back to preprocessed IPs and logs warning "Host discovery found no live hosts, scanning all targets" when no live hosts detected

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A rabbit once sought hosts upon the wire,
But when the path grew dark and silence deep,
It hopped back to the safer, broader way,
With warnings whispered to the watchers near—
No failure now, just prudent fallback fare! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'fix: fallback to all targets when host discovery finds no hosts' clearly summarizes the main change: implementing fallback behavior when host discovery yields no results.
Linked Issues check ✅ Passed The code changes implement the exact requirement from issue #1194: when host discovery finds no live hosts, the scanner now falls back to scanning all original targets instead of failing with an error.
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue objectives. The modification to RunEnumeration adds conditional logic for host discovery fallback and warning logging, which aligns precisely with the stated requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9976c32 and d1df30e.

📒 Files selected for processing (1)
  • pkg/runner/runner.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: build-mac
  • GitHub Check: build-windows
  • GitHub Check: build-linux
  • GitHub Check: release-test-mac
  • GitHub Check: release-test-windows
  • GitHub Check: release-test-linux
  • GitHub Check: Functional Test (ubuntu-latest)
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
pkg/runner/runner.go (1)

486-490: Good fix for the host discovery fallback issue!

The conditional check correctly addresses the problem described in issue #1194. When host discovery finds no live hosts (e.g., due to ARP failures in containers or restricted network environments), the code now falls back to scanning all original targets instead of proceeding with an empty result set. The warning message appropriately informs users about this fallback behavior.

The logic is sound:

  • Defaults to scanning preprocessed IPs (line 484)
  • Only uses host discovery results if they contain IPs (line 486)
  • Falls back gracefully with a clear warning when discovery yields nothing

The HasIPS() method is correctly implemented on the Result type and properly returns a boolean indicating whether IPs were discovered.


Comment @coderabbitai help to get the list of available commands and usage tips.

@dogancanbakir dogancanbakir removed the request for review from Mzack9999 January 5, 2026 10:14
@dogancanbakir dogancanbakir marked this pull request as draft January 5, 2026 10:14
@dogancanbakir dogancanbakir marked this pull request as ready for review January 5, 2026 10:27
@auto-assign auto-assign bot requested a review from Mzack9999 January 5, 2026 10:27
@dogancanbakir dogancanbakir self-assigned this Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ARP causing host discovery to fail on LAN

2 participants