A modern network scanning utility for Apple platforms, built with Swift and SwiftUI.
This application is designed to discover devices and services on your local network. It provides a clean and simple interface to visualize network information.
- Local Network Scanning: Discovers active hosts on the local network.
- ARP & Ping Discovery: On macOS we harvest the route table (no shell tools required) and nudge hosts with UDP; on iOS we lean on SimplePingKit for fast ICMP sweeps.
- Service Discovery: Uses Bonjour browsing/resolution along with ARP/Ping to surface advertised services in real time.
- Discovery Controls: Built-in toolbar lets you start/stop Bonjour, trigger an on-demand scan, and manually persist the current snapshot.
- Configurable Detail View: Toggle fingerprint data visibility from Settings on macOS and iOS.
- Device Intelligence: Normalises IP, MAC, and service data into a unified model with classification heuristics.
- Modern UI: Built with SwiftUI for a responsive and modern user experience across all target platforms.
- Language: Swift
- UI: SwiftUI
- Networking: Combines the
Networkframework, SystemConfiguration route-table APIs, and SimplePingKit for platform-appropriate discovery.
To build and run this project:
- Clone the repository:
git clone https://github.com/vernonstinebaker/netscan.git
- Open the project in Xcode:
cd netscan xed .
- Select a target (iOS or macOS) and run the application.
To enable discovery features on iOS, ensure the following:
- Info.plist keys
NSLocalNetworkUsageDescription: A user-facing string explaining why the app needs local network access.NSBonjourServices: Array of service types you plan to browse (e.g.,_http._tcp.,_ssh._tcp., etc.). If you use dynamic DNS‑SD type discovery, include the superset of types your app may browse.
- Entitlements (optional)
- Multicast Networking is only required if you add protocols beyond Bonjour that depend on multicast (e.g., SSDP). Bonjour browsing/resolution works with the current entitlement set.
- Notes
- macOS discovery reads the ARP/route table directly (works inside App Sandbox) and sends lightweight UDP probes to keep entries fresh.
- iOS discovery uses SimplePingKit; on first launch, iOS will prompt the user to allow Local Network access.
The unified scanner decomposes Bonjour (mDNS) handling into layered services:
- Browse:
BonjourBrowseServicemaintains curated + wildcardNetServiceBrowserinstances. Dynamic service types discovered via the wildcard browser are capped to avoid runaway browser creation. Logs tagged withbrowse:show lifecycle (start, wildcard discovery, cap skips, emissions). - Resolve:
BonjourResolveServicelaunches per-type browsers only when needed and applies a cooldown to suppress excessive resolves of the same service instance. Logs tagged withresolve:include discovery events, resolution starts, cooldown skips, and successful resolution details (IPs, port, TXT size). - Aggregation:
DiscoveryProvidermerges resolved service data intoDevicemodels viaSnapshotService.upsert, triggering classification updates when pertinent fields (services, ports, vendor) change.
Logging Control:
LoggingService.setMinimumLevel(.debug)enables verbose output; default is.info.- Emission format:
[Scan][LEVEL] messagewith consistent prefixes (browse:,resolve:,enqueue,ping,ARPetc.). - For deterministic test logging, use
await LoggingService.setMinimumLevelSync(.debug).
Offline Detection & Filtering:
SnapshotServicehonoursofflineCheckIntervalandonlineGraceInterval, and automatically marks devices back online whenever fresh Bonjour or Ping data is received.- Loopback, link-local, and off-subnet addresses are filtered out so the UI only surfaces devices that truly live on the active network(s).
- Fingerprint TXT records are mined for vendor/model hints, with OUI lookup filling gaps when MAC data is available.
- OUI Lookup Integration: ingest the vendor prefix database (
oui.csv) and use fingerprint data to tighten classification heuristics. - Port Scanning: Bring back the multi-tier port scanner with themed status pills and cancellation controls.
- Discovery Audit: Evaluate additional mechanisms (SSDP, WS-Discovery) for inclusion or removal.
- Service Helpers: Enhance service actions (open in browser, copy SSH, custom handlers for AirPlay/HomeKit/etc.).
- Structured Logging: Replace ad-hoc debug prints with channelled, toggleable log streams.
This README was generated by the Gemini CLI.