Layer-2 LAN Bandwidth Manager
NetCtrl is a Layer-2 bandwidth management tool that uses ARP spoofing to intercept LAN traffic passing between devices on your local network and the gateway. It provides real-time download and upload speed monitoring for every device, lets you block devices from accessing the internet entirely, apply custom speed limits (in KB/s), and track cumulative total usage per device — all from a clean graphical interface.
This tool is intended for educational and personal network use only. You should only use NetCtrl on networks that you own or have explicit permission to manage. Unauthorized interception of network traffic may violate local laws and regulations. The authors assume no liability for misuse.
- Windows 10/11
- Python 3.10+
- Npcap (https://npcap.com) — must be installed before running
- Rust toolchain (https://rustup.rs) — only needed to build from source
- Visual Studio Build Tools (download) — select "Desktop development with C++" during install. Required to compile the Rust engine.
Download the installer from npcap.com and run it. During installation, make sure to check:
"Install Npcap in WinPcap API-compatible Mode"
pip install scapy psutil requests customtkintercd rust_engine
cargo build --release
copy target\release\rust_engine.exe ..\rust_engine.exeEdit device_names.json to map IP addresses to friendly names. The format is shown in the template file — simply add entries like "192.168.1.42": "Living Room TV".
python main.py --rustOn first run, a dialog will appear asking you to select your network interface. Choose the interface connected to your LAN (WiFi or Ethernet). The selection is saved to netctrl_config.json for future runs.
If you want a single double-clickable .exe that bundles everything:
- Rust toolchain installed (rustup.rs)
- Python 3.10+ with pip
Simply run the provided build script:
build_exe.batThis will:
- Compile the Rust engine (
cargo build --release) - Install PyInstaller if not already installed
- Bundle everything into a single
dist/NetCtrl.exe
Double-click dist/NetCtrl.exe — it will automatically request Administrator privileges.
No Python or Rust installation required on the target machine.
Note: Windows Defender or antivirus may flag the EXE due to network packet capture capabilities. This is a false positive — you can whitelist it or build from source to verify.
- Real-time DL/UL speed monitoring per device
- Block internet access for any device
- Set custom speed limits (KB/s)
- Cumulative total usage tracking per device
- Automatic device name resolution (
device_names.json→ NetBIOS → mDNS → MAC) - Your own device shown at top, protected from accidental blocking
- Interface selector on first run
netctrl/
├── main.py # Entry point, launches Rust engine
├── gui.py # Tkinter GUI
├── device_names.json # Your custom device name mappings
├── rust_engine/
│ ├── src/
│ │ ├── main.rs # Rust entry point
│ │ ├── server.rs # HTTP API server
│ │ ├── scanner.rs # ARP network scanner
│ │ ├── spoofer.rs # ARP poisoning engine
│ │ ├── l2_forwarder.rs # Packet forwarding + rate limiting
│ │ └── device_registry.rs # Device state management
│ └── Cargo.toml
NetCtrl uses ARP spoofing to position itself between LAN devices and the gateway. Once positioned, all traffic flows through the host machine, which enables full monitoring and control. The Rust engine handles high-speed packet forwarding with token bucket rate limiting for precise bandwidth control. The Python GUI communicates with the Rust engine over a local HTTP API running on port 8765.
| Problem | Solution |
|---|---|
| "No module named netifaces" | pip install netifaces |
| Gateway MAC shows ?? | Run as Administrator |
| Block / speed limit not working | Run as Administrator + ensure Npcap is installed |
| Devices not appearing | Run Rescan, check interface selection |
