Python SDK and CLI for Netgear Smart Managed Plus switches
Project description
netgear-tool
A Python SDK and interactive CLI for Netgear Smart Managed Plus switches — no browser required.
These switches have no REST API, no SSH, and no serial console. This project reverse-engineers the HTTP web UI shared by the Netgear Smart Managed Plus switch family to provide a clean Python interface and a Cisco IOS-inspired shell.
Developed and tested on:
- Hardware: GS105Ev2 (5-port gigabit)
- Firmware: V1.6.0.24
A full test suite passes against this hardware. Other Netgear Smart Managed Plus switches that share the same web UI (GS108Ev3, GS116Ev2, etc.) are likely compatible.
Installation
pip install netgear-tool
After installation, the netgear CLI command is available and the
netgear_tool Python package is importable:
from netgear_tool import Switch, PortSpeed, RateLimit
The legacy module name netgear_switch is still importable as a
backward-compatibility shim.
Files
| File | Purpose |
|---|---|
src/netgear_tool/__init__.py |
Python SDK (Switch class, all read/write operations) |
src/netgear_tool/_cli.py |
CLI entry point (installed as netgear command) |
cli.py |
Standalone CLI script (same as netgear command, for direct use) |
netgear_switch.py |
Backward-compatibility shim (imports from netgear_tool) |
docs/sdk.md |
SDK programmer reference |
docs/cli.md |
CLI user guide |
Requirements
pip install netgear-tool
No other dependencies beyond requests. HTML parsing is done with regex
against the known page structure.
Quick start — SDK
from netgear_tool import Switch, PortSpeed, RateLimit
with Switch('192.168.0.1', password='secret') as sw:
# Read system info
print(sw.get_system_info())
# Port status
for port in sw.get_port_settings():
print(port)
# Configure a port
sw.set_port(1, speed=PortSpeed.AUTO, fc_enabled=True)
# Rate limiting
sw.set_rate_limit(3, RateLimit.M64, RateLimit.M128)
# 802.1Q VLANs
sw.set_dot1q_enabled(True)
sw.add_vlan(10)
sw.set_vlan_membership(10, '11112') # ports 1-4 untagged, port 5 tagged
sw.set_port_pvid(1, 10)
See docs/sdk.md for the full API reference.
Quick start — CLI
netgear 192.168.0.1
# or directly:
python3 cli.py 192.168.0.1
GS105Ev2# show interfaces
GS105Ev2# configure terminal
GS105Ev2(config)# loop-detection
GS105Ev2(config)# vlan 10
GS105Ev2(config-vlan-10)# exit
GS105Ev2(config)# interface gi1
GS105Ev2(config-if-gi1)# switchport access vlan 10
GS105Ev2(config-if-gi1)# exit
GS105Ev2(config)# end
GS105Ev2# show vlan
GS105Ev2# show running-config
Commands can be abbreviated to their shortest unambiguous prefix (conf t,
sho int, sw acc vl 10, etc.).
See docs/cli.md for the full command reference.
What is supported
Read operations
- System info (firmware, MAC, IP, model, serial)
- Switch configuration (name, IP/DHCP settings)
- Port settings (speed, duplex, flow control)
- Port statistics (TX/RX byte counters, CRC errors)
- Rate limits (ingress/egress per port)
- Port mirroring
- IGMP snooping
- Loop detection
- Broadcast filtering
- QoS mode
- Power saving (Green Ethernet) — read-only; see firmware note below
- 802.1Q VLAN (IDs, membership, PVIDs)
- Cable diagnostics (TDR)
Write operations
Everything listed above except power saving, plus:
- Factory reset
- Reboot
- Password change
Known firmware issues
Power saving (Green Ethernet) — GS105Ev2 firmware V1.6.0.24
set_power_saving() is implemented and the POST succeeds, but the switch
ignores the request — a subsequent GET always returns the hardware-controlled
state. This appears to be a firmware limitation on the GS105Ev2: the web UI
shows the toggle but the hardware drives the actual state. The method is
provided for completeness; it may work on other models or firmware versions.
Ports cannot be fully removed from VLAN 1
The firmware silently rejects any attempt to set a port's VLAN 1 membership to
'3' (not-a-member). Ports that are access members of another VLAN remain as
tagged members of VLAN 1 in the firmware — they simply have their PVID set to
the access VLAN so untagged ingress traffic is steered correctly. The CLI's
show running-config hides this detail and displays such ports as access ports
on their PVID VLAN.
Protocol notes
The switch uses an HTTP web UI on port 80. All pages are at /<name>.cgi.
- Reads:
GET /<name>.cgiwith a validSIDcookie — state is embedded in HTML<input type="hidden">form elements (not JavaScript variables). - Writes:
POST /<name>.cgi— every POST must include a session-specific CSRFhashvalue extracted from the page's GET response. - Authentication:
MD5(merge(password, rand))whererandis a nonce provided in a custom HTTP response header and hidden form field. - Session cookie: The
SIDvalue contains RFC 6265-invalid characters that Python'shttp.cookiejarsilently drops. The SDK works around this by extracting the SID from the rawSet-Cookieheader. - Single-session limit: the switch allows only one active session at a
time. The SDK always calls
logout()(via the context manager) to free the slot.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file netgear_tool-0.1.0.tar.gz.
File metadata
- Download URL: netgear_tool-0.1.0.tar.gz
- Upload date:
- Size: 55.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.13.7 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f60d4c38a7a5e4de1c560708f940184c4d230e01835b36b490e1689c4129484
|
|
| MD5 |
2256850ed785055c36754c20041f3135
|
|
| BLAKE2b-256 |
4160d3e7d614467db1c9d789911d867ec7f2efce3df07f9bd88a819e3625b5ee
|
File details
Details for the file netgear_tool-0.1.0-py3-none-any.whl.
File metadata
- Download URL: netgear_tool-0.1.0-py3-none-any.whl
- Upload date:
- Size: 38.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.13.7 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a7a0635f01d28f8bf71c64a8f2741c438d7cf2d2d847ae417ccf941c589c8e0
|
|
| MD5 |
7e098d89ef861233df9d19136ff6c226
|
|
| BLAKE2b-256 |
58f6ff133ca2e5ecc0a4a835dd2eeb30bc95aae718b486a881bd2c434efa4b4d
|