Skip to content

[Phase 2] arp-scan + nmap integration and XML parsing - #20

Merged
reloadfast merged 4 commits into
mainfrom
feature/phase-2-scanner
Feb 27, 2026
Merged

reloadfast merged 4 commits into
mainfrom
feature/phase-2-scanner

Conversation

@reloadfast

Copy link
Copy Markdown
Owner

Summary

  • Implements arp_scan.py (subprocess wrapper + pure parser for arp-scan output), nmap_scan.py (subprocess wrapper + XML parser for -oX output), and scanner/__init__.py orchestrator that merges ARP MAC data into nmap results
  • Fixes arp-scan regex to correctly handle missing vendor column (no trailing tab) — discovered during testing
  • Adds 4 nmap fixture XML files and 45 unit/integration tests achieving 100% line coverage across all scanner modules
  • Cleans up pre-existing Ruff PT001/PT023 linting issues in test_db.py and test_main.py

Test coverage

backend/app/scanner/__init__.py   33/33  100%
backend/app/scanner/arp_scan.py   29/29  100%
backend/app/scanner/nmap_scan.py 101/101 100%
TOTAL                            217/217 100%

Closes #4

- Implement ArpHost dataclass and parse_arp_output() pure parser
- Implement run_arp_scan() with subprocess, env var fallbacks, and error handling
- Fix arp-scan regex to handle optional vendor column (no trailing tab)
- Implement NmapHost/PortInfo dataclasses and parse_nmap_xml() with full XML parsing
- Implement run_nmap_scan() with temp-file XML output and guaranteed cleanup
- Implement orchestrate_scan() merging ARP MAC enrichment into nmap results
- Add 4 nmap fixture XML files covering rich, minimal, down-host, and no-ports cases
- Add 45 tests (unit + integration) with 100% line coverage
- Fix pre-existing Ruff PT001/PT023 issues in test_db.py and test_main.py
CI was running ruff==0.4.x which had reversed PT023 opinion (requires parens)
and flagged S603 noqa comments differently. Pinning to 0.15.x matches local
toolchain. Add N817 to ignore list since 'ET' is the universal stdlib alias
for xml.etree.ElementTree.
CVE-2024-47874 and CVE-2025-54121 in starlette 0.37.x; fix is starlette>=0.47.2
which requires fastapi>=0.120 for dependency compatibility.
@reloadfast
reloadfast merged commit 795d1db into main Feb 27, 2026
2 checks passed
@reloadfast
reloadfast deleted the feature/phase-2-scanner branch February 27, 2026 19:00
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.

[Phase 2] arp-scan + nmap integration and XML parsing

1 participant