Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glorouter

A fast, lightweight terminal CLI and local web dashboard for Huawei HiLink 4G/LTE CPE routers (tested live on the Huawei B311-221 / HUAWEI 4G Router 2, Glo Nigeria firmware).

Replicates the high-usability architecture of zltrouter, adapted for Huawei's reverse-engineered SCRAM-SHA256 protocol.


Features

  • Terminal CLI: Inspect live signal strength, data traffic, active Wi-Fi clients, network bearer preference, SMS inbox reading/deletion, and USSD execution directly from your shell.
  • Web Dashboard: Zero-dependency, offline-capable dashboard at http://127.0.0.1:8464:
    • Pinned Meter: Pinned header meter with live signal strength, quality classification (excellent, good, fair, poor), and range bar that collapses to a single sticky line on scroll.
    • Walk-Test Sparkline: 15-minute continuous rolling SVG sparkline for signal variation while moving the router.
    • Network Mode & Cellular Switch: One-click toggles for network bearer preference (auto, 4g, 3g, 2g) and cellular connection (on/off).
    • USSD Suite: One-click buttons for saved codes, manual code runner, and carrier reply display.
    • Messages: Full inbox viewer with unread indicators, batch select/delete, and outgoing SMS composer.
    • In-Browser Speed Test: Streamed CORS speed test directly against Cloudflare measuring ping, download speed, and upload speed.
    • Light / Dark Themes: Follows system preference by default, with manual SVG toggle and persistent memory.
  • Autostart Service: Systemd user service management via glorouter service install.

Installation & Quick Start

Needs pipx. It puts glorouter on your PATH in an isolated environment, and works the same on Linux, macOS, and Windows:

# Install globally from source checkout
git clone https://github.com/exbyte-dev/glorouter.git
cd glorouter
pipx install --editable .


# Configure router credentials interactively
glorouter init-config

Config resolution order

  1. Environment variables GLO_HOST, GLO_USERNAME, GLO_PASSWORD.
  2. $XDG_CONFIG_HOME/glorouter/config (default ~/.config/glorouter/config).
  3. Project-local ./.env, if present.

Defaults: GLO_HOST=192.168.8.1, GLO_USERNAME=admin.

Session cache: $XDG_STATE_HOME/glorouter/session.json (default ~/.local/state/glorouter/session.json), written with permissions 0600.


Command Reference

Command Auth? Description
glorouter status no Shows device metadata (Name, Model, Hardware Version, Uptime), active Wi-Fi users, connection state, visual signal bars, and DNS servers.
glorouter traffic no Displays live upload/download speed (KB/s), current session duration & data volume, today's usage, and monthly/all-time totals.
glorouter net best-effort Displays configured network mode (auto, lte, etc.), current network operator, and cellular data switch state.
glorouter net get yes Displays configured network mode and active carrier connection.
glorouter net set <mode> yes Sets the network mode (auto | lte | 4g | 4g3g | wcdma | 3g | gsm | 2g). Verifies and confirms the change.
glorouter net on yes Enables mobile cellular data connection.
glorouter net off yes Disables mobile cellular data connection.
glorouter sms count no Shows SMS inbox count, unread count, and capacity (40 / 500).
glorouter sms list yes Displays inbox messages (newest first) with ID, sender, timestamp, and unread marker. Supports --limit <N>.
glorouter sms send <phone> <text> yes Sends an SMS message via the router.
glorouter sms rm <id>... yes Deletes one or more messages permanently by ID.
glorouter ussd list no Lists saved USSD quick-dial codes.
glorouter ussd save <label> <code> no Saves a USSD code under a friendly label (saved to ~/.config/glorouter/ussd.json).
glorouter ussd rm <label> no Removes a saved USSD code by label.
glorouter ussd send <code> yes Sends a USSD code (e.g. *310#) and polls the carrier for the live reply text.
glorouter ussd run <label> yes Runs a saved USSD code by label.
glorouter init-config no Interactively configures ~/.config/glorouter/config.
glorouter service install no Installs and starts the systemd user service (glorouter-web.service).
glorouter service status no Checks the status of the background systemd service.
glorouter service logs no Displays recent journalctl logs for the service.
glorouter serve no Launches the local web dashboard (default http://127.0.0.1:8464).

Web Dashboard

Launch the dashboard locally:

glorouter serve                      # http://127.0.0.1:8464
glorouter serve --host 0.0.0.0       # reachable from other LAN devices (e.g. phone)
  • Pinned meter, tabbed tools: Whichever tool you are using, the live signal reading and range bar stay on screen, folding smoothly to a single line on scroll.
  • Walk test strip: Continuous 15-minute rolling signal history chart.
  • Zero CDN dependencies: Served 100% locally from vanilla HTML, CSS, and JS—works with zero internet connectivity on the router LAN.
  • Speed test target: Runs directly in your browser against Cloudflare (https://speed.cloudflare.com), avoiding double-proxying data through the router host.

Safety & Concurrency Notes

  • Single-Admin Limit: Huawei HiLink firmware allows only one active admin session at a time. If you are logged into the router web interface at http://192.168.8.1 in your browser, the router will hold that session and reject any new login attempt with 108005: ERROR_LOGIN_TOOMANY_LOGIN. Simply click "Log out" or close the browser tab to allow the CLI and dashboard to connect.
  • Lockout Safeguard: The router locks out login after 5 consecutive failed password attempts for 300 seconds. glorouter verifies password validity before repeating authentication.

Protocol Documentation

For deep technical details on the reverse-engineered Huawei REST endpoints, SCRAM-SHA256 handshake, reversed HMAC order, and sequential CSRF token queues, read docs/protocol.md.


License

MIT.

About

CLI & local web dashboard for the Huawei B311-221 (HUAWEI 4G Router 2 / Glo Nigeria), reverse-engineered from its HiLink web UI

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages