A powerful C# WPF application for network device discovery and upstream analysis using MVVM architecture.
- Subnet Scanning: Scan entire subnets (e.g., 192.168.1.0/24) with configurable timeout
- Real-time Progress: Live percentage-based progress reporting during scans with device count
- Device Detection: Automatic device type identification (Router, Computer, Printer, IoT, etc.)
- Cancellation Support: Stop long-running scans at any time
- CSV Export: Export discovered devices to timestamped CSV files
- IP Address and Hostname resolution
- MAC Address discovery via ARP
- Response time measurement (ping latency)
- Device type determination via port scanning (HTTP, HTTPS, SSH, Telnet, SNMP, SMB, AFP, IPP)
- Last seen timestamp
- Trace Route: Trace the path to any destination with hop-by-hop details
- Hop Analysis: See detailed information about each network hop with latency
- Ping Testing: Test individual device connectivity with refresh capability
- Interface Enumeration: View all network interfaces with IP, MAC, Gateway information
- File Logging: Comprehensive logging to
logs/netmap.logwith millisecond timestamps - Log Viewer: Built-in UI to view recent log entries (latest 500, newest first)
- Log Rotation: Automatic rotation when log file exceeds 5MB (keeps 3 backups: .1, .2, .3)
- Clear Logs: Clear log file from UI with confirmation
- Auto-load: Logs automatically loaded on application startup
The application can discover and display:
- IP Addresses: IPv4 addresses of upstream devices
- MAC Addresses: Physical addresses from ARP tables
- Hostnames: DNS names and device identifiers
- Device Types: Routers, switches, access points, servers
- Response Times: Network latency measurements
- Routing Paths: Complete paths to destinations
- Gateway Information: Default gateways and routing tables
Built using MVVM (Model-View-ViewModel) pattern with strict separation of concerns:
- Models:
NetworkDevice,NetworkInterface,RouteEntry,NetworkTrace,TraceHop,ScanProgress - ViewModels:
MainViewModelwith RelayCommand/AsyncRelayCommand binding and ObservableCollections - Views:
MainWindow.xamlwith tabbed interface (Network Scan, Trace Route, Network Information, Logs) - Services:
NetworkDiscoveryService: Async network operations with cancellation and progress reportingLogger: Thread-safe file logging with automatic rotation
- .NET 8.0 WPF (net8.0-windows)
- CommunityToolkit.Mvvm 8.2.2 for MVVM implementation
- System.Management 8.0.0 for system queries
- System.Net.NetworkInformation for network operations
- Warning-Free: All projects configured with
TreatWarningsAsErrors=true - Async/Await: All network operations are asynchronous
- Thread-Safe: Logger uses locking for concurrent access
- Error Handling: Comprehensive try-catch blocks with logging
- .NET 8.0 SDK or higher
- Windows operating system (WPF application)
- Administrator privileges (recommended for full functionality)
dotnet build NetMap.csprojdotnet run --project NetMap.csprojcd tools/NetMapCli
dotnet run scan- Select your network interface from the dropdown
- Review the auto-populated subnet (e.g., 192.168.1.0/24)
- Click "Scan Network" to discover devices
- Watch real-time progress: "Scanning... 125/254 hosts (49.2%) - Found 8 devices"
- Click "Cancel" to stop scan at any time
- Click "Export to CSV" to save results to timestamped file
- Enter a destination IP or hostname (e.g., 8.8.8.8)
- Click "Trace Route" to see the network path
- View hop-by-hop details with latency information in the data grid
- View all network interfaces with detailed information (IP, MAC, Gateway, Speed)
- Click "Refresh Interfaces" to update interface status
- View recent log entries (latest 500, newest first) in monospace font
- Click "Refresh Logs" to reload from disk
- Click "Clear Logs" to empty the log file (new log entry confirms action)
-
Basic Network Info:
- IP addresses and subnets
- MAC addresses from ARP tables
- Default gateways and routing information
- Network interface details (Type, Speed, Status)
-
Device Identification:
- Hostnames via DNS lookups
- Device types through port scanning (80, 443, 22, 23, 161, 135, 445, 548, 631)
- Response time measurements (milliseconds)
- Online/Offline status
-
Connectivity Analysis:
- Ping response times and reachability
- Network path visualization via traceroute
- Hop-by-hop latency analysis
- Interface configuration and gateway discovery
-
Topology Mapping:
- Network hop discovery with detailed routing paths
- Distance to upstream devices (hop count)
- Complete path visualization to any destination
- Application Logs:
bin/Debug/net8.0-windows/logs/netmap.log- Rotated backups:
.log.1,.log.2,.log.3(when file exceeds 5MB) - Format:
YYYY-MM-DD HH:mm:ss.fff [message]
- Rotated backups:
- Exported Data:
bin/Debug/net8.0-windows/exports/network_devices_YYYYMMDD_HHMMSS.csv- CSV format with headers: IPAddress, MacAddress, HostName, DeviceType, Vendor, ResponseTime, Status, LastSeen
- CLI Logs:
tools/NetMapCli/bin/Debug/net8.0/logs/netmap-cli.log
NetMap/
├── Models/
│ └── NetworkModels.cs # Data models (NetworkDevice, NetworkInterface, etc.)
├── ViewModels/
│ └── MainViewModel.cs # Main ViewModel with all commands and collections
├── Views/
│ ├── MainWindow.xaml # Main UI window with tabs
│ └── MainWindow.xaml.cs # Code-behind
├── Services/
│ ├── NetworkDiscoveryService.cs # Network operations (scan, ping, traceroute)
│ └── Logger.cs # File logging with rotation
├── tools/
│ └── NetMapCli/ # Command-line tool for testing
│ ├── Program.cs # CLI entry point
│ ├── Services/ # CLI-specific NetworkDiscoveryService
│ └── Models/ # CLI-specific models
├── Properties/
│ └── AssemblyInfo.cs # Manual assembly metadata
├── .github/
│ └── copilot-instructions.md # Development guidelines
├── NetMap.csproj # Main WPF project file
└── README.md # This file
- Add models to
Models/NetworkModels.cs - Add service methods to
Services/NetworkDiscoveryService.cs - Add commands and properties to
ViewModels/MainViewModel.cs - Update UI in
Views/MainWindow.xaml - Build and verify warning-free compilation:
dotnet build NetMap.csproj
- Follow MVVM pattern strictly - no business logic in Views
- Use async/await for all network operations
- Implement proper error handling with try-catch blocks
- Log all significant operations to Logger
- Use CancellationToken for long-running operations
- Report progress via IProgress for user feedback
- All code must compile with zero warnings (TreatWarningsAsErrors=true)
- Ensure .NET 8.0 SDK is installed:
dotnet --version - Clean and rebuild:
dotnet clean; dotnet build - Check that
GenerateAssemblyInfo=falseis set in both project files - Verify
tools/**folder is excluded in NetMap.csproj to avoid assembly conflicts
- Check
logs/netmap.logfor detailed error information - Ensure you have network interface access permissions
- Some features may require administrator privileges (ARP table access, port scanning)
- Firewall may block ICMP (ping) or traceroute packets
- Long scans can be cancelled using the "Cancel" button
- Progress bar shows real-time scan percentage
- Check Task Manager if application appears frozen (background network operations may be running)
This project is provided as-is for network discovery and analysis purposes.
Built with ❤️ using .NET 8.0, WPF, and MVVM architecture
- Route path analysis
- Gateway identification
dotnet build
dotnet runOr open in Visual Studio and press F5 to debug.
This project is for educational and network administration purposes.