hacker news Hacker News
  1. new
  2. show
  3. ask
  4. jobs
The DGS-1100 is a ~$40 managed gigabit switch with real features (802.1Q VLANs, STP, IGMP, port security) but its only management interface is a JavaScript web UI from 2015. No SSH, no REST API, SNMP is read-only for anything useful.

  I needed to configure a few of these and clicking through the web UI was painful,
  so I wrote a CLI that drives headless Chrome via Selenium. It logs in, scrapes the
   JS data files the switch populates via XHR, and submits forms to the CGI
  endpoints for changes. Every write command reads back the config afterward to
  verify the switch accepted it.

  63 commands covering everything the switch exposes — VLANs, PVIDs, STP, IGMP,
  storm control, port security, mirroring, QoS, bandwidth limits, SNMP, traffic
  segmentation, and more. Plus a recommend command that crawls 13 data files and
  checks 20 categories of issues (PVID mismatches, orphaned ports, disabled security
   features, etc.) and a fix command that auto-applies what it finds.

  Other things that fell out of this: config dump/diff/restore for version control,
  a template command to generate reproducible batch files, multi-switch support, a
  Prometheus exporter, a Textual TUI, and shell completions.

  Built with Nix so nix run github:bobberb/dgs-cli -- status just works. 179 offline
   tests.

  Tested on DGS-1100-08V2. The --1210 flag is stubbed out for future DGS-1210
  support.

loading...