Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

manage-ibox-2 — CLI Management Tool for the Swisscom Internet-Box 2

A small POSIX-shell tool that lets you manage a Swisscom Internet-Box 2 (Askey RTV1905VW) from the command line — reboot it, query WAN status, dump device info, or call any of the router's underlying sysbus RPC endpoints directly. Designed to run on constrained devices like an upstream OpenWrt router, but works anywhere curl runs.

The tool talks to the undocumented Sagemcom-style HTTP "sysbus" API that powers the router's own web UI. No browser, no headless Chromium — just curl and standard busybox tools.

⚠️ Undocumented, reverse-engineered API. Not endorsed or supported by Swisscom or Askey. Use at your own risk. Firmware updates may change the API surface at any time. See the Disclaimer below.


A note from the author

I originally started this script quite a while ago for my own home lab and have been chipping away at it ever since. If you live in Switzerland, chances are you still have one of the "old" Internet-Box 2 units acting as your gateway — Swisscom has shipped a lot of them and they're still very much in production.

In my own setup the Internet-Box 2 sits at the edge, and immediately behind it I run an OpenWrt router — as it happens, on the venerable Alix-2 board from PC Engines, another Swiss company. That board has served me faithfully for years and I really ought to replace it one of these days, but it Just Keeps Working™.

To the best of my knowledge, Swisscom does not document any non-web-UI way to talk to the Internet-Box 2 — no SSH, no SNMP, no published REST API, no way to reboot it or read stats from the command line. So I started building this. It runs happily on an OpenWrt router (or any Linux box) next to the Internet-Box and lets you do a bunch of genuinely useful things, including:

  • Reboot the Internet-Box from the command line or cron.
  • Read live DSL / g.fast line stats (sync rate, SNR, attenuation, error counters) with the new dsl-stats command.
  • Read the router's event log with logs — where in some cases you actually get to see more than the web UI itself shows you.
  • Export Prometheus metrics natively via --prometheus (recent addition), so you can graph WAN status, DSL health, RAM, CPU, uptime, and firmware crashes right next to everything else in Grafana.
  • Watch stats in real time with watch <cmd> — think top(1) but for your CPE.
  • Plus the mundane-but-useful stuff: query WAN status, dump device info, list firmware crashes, and script arbitrary sysbus calls via raw.

If you find bugs, add commands, or get this working on other Internet-Box generations, PRs are very welcome.

Steven


Table of contents


Why you might want this

The Internet-Box's only official management interface is the web UI at http://<box-ip>/. There is no SSH, no telnet, no published REST API, no SNMP write, no locally-accessible TR-069 handle. If you want to script or automate anything, your options up to now were:

  • Click through the web UI manually.
  • Wheel out a full browser-automation framework (Puppeteer / Playwright / Selenium) — enormous overkill and generally not deployable to constrained devices like your upstream router.

Real-world situations where this tool helps:

  • IPv6 wedges. DHCPv6-PD occasionally stops refreshing and IPv6 dies on the whole downstream network. A CPE reboot fixes it. Now your OpenWrt / pfSense / OPNsense router can detect the wedge and fix it — even when you're not home.
  • Scheduled maintenance reboots. Some folks like a weekly 04:00 kick.
  • Alert-driven recovery. Trigger a reboot from Prometheus, gatus, Uptime Kuma, or a plain ping-loss watchdog after N minutes of WAN downtime.
  • Full Prometheus integration. Native --prometheus output for uptime, WAN state, RAM, CPU, DSL line stats, and firmware crash counter. Drop straight into node_exporter's textfile collector.
  • DSL / g.fast line telemetry. Real-time sync rates, SNR margin, attenuation, FEC/HEC/CRC error counters via dsl-stats.
  • Firmware crash tracking. crashes reads the router's persistent oops log — a growing counter is an early warning of a sick unit.
  • Live monitoring. watch <cmd> gives you a top(1)-style live view of any subsystem.
  • Ad-hoc exploration. The raw subcommand lets you call any sysbus endpoint the web UI can call — DHCP static leases, DECT phones, firewall rules, and more.

Supported hardware and firmware

Item Value
Marketing name Swisscom Internet-Box 2
OEM Askey
Model RTV1905VW
Firmware 14.30.02 / 02330 (confirmed)
Web UI stack Sagemcom-derived Stargate v2 SPA
API dialect sah / sysbus over HTTP

Other Internet-Box generations (1, 3, 4, standard, plus, smart) almost certainly speak a similar dialect but may differ in authentication details or endpoint paths. If you test on another model/firmware, please open a PR with your findings.


How it works

The Internet-Box's web UI is a single-page app that speaks to the router over an internal RPC bus called sysbus. Every meaningful action in the UI is a POST to http://<box>/sysbus/<Service>:<method> with a JSON body. This tool reproduces those calls directly.

Authentication — POST /ws

POST /ws HTTP/1.1
Host: 172.16.18.1
Authorization: X-Sah-Login
Content-Type: application/x-sah-ws-4-call+json
X-Requested-With: XMLHttpRequest

{
  "service": "sah.Device.Information",
  "method":  "createContext",
  "parameters": {
    "applicationName": "webui",
    "username": "admin",
    "password": "<your admin password>"
  }
}

On success the box responds 200 OK with:

{
  "status": 0,
  "data": {
    "contextID": "<opaque session token>",
    "username": "admin",
    "groups": "Administrator"
  }
}

The contextID is used for all subsequent calls as Authorization: X-Sah <contextID> plus a matching cookie.

An authenticated RPC — POST /sysbus/<Service>:<method>

POST /sysbus/NMC:reboot HTTP/1.1
Host: 172.16.18.1
Authorization: X-Sah <contextID>
X-Context: <contextID>
Content-Type: application/x-sah-ws-4-call+json

{ "parameters": { "reason": "Scripted reboot via manage-ibox-2.sh" } }

The tool handles login and cookie management automatically; every command runs a fresh login and terminates its session at exit.


Requirements

  • curl — the only real dependency. On OpenWrt: opkg install curl.
  • A POSIX shell. busybox ash is fine; bash, dash, zsh all work.
  • Standard busybox / coreutilssed, mktemp, head, tr, date.
  • Optional: jq — not required; the tool parses JSON with sed. If you want to build on top of raw output, jq is nice to have.

The tool auto-checks for curl via opkg list-installed when running on OpenWrt and prints an actionable install command if it's missing.


Installation

On OpenWrt (primary target)

# On your workstation
scp manage-ibox-2.sh root@<openwrt-ip>:/root/

# On the OpenWrt router
opkg update && opkg install curl
chmod +x /root/manage-ibox-2.sh

# Store the admin password (mode 0600 so only root can read it)
echo 'YourAdminPassword' > /etc/manage-ibox-2.conf
chmod 600 /etc/manage-ibox-2.conf

# Test — with the interactive confirmation prompt
/root/manage-ibox-2.sh info

On other Linux / BSD / macOS

Any Unix with curl works. The opkg dependency check is skipped automatically when opkg isn't in $PATH.

chmod +x manage-ibox-2.sh
./manage-ibox-2.sh --host 172.16.18.1 --password 'YourAdminPassword' info

Configuration

The admin password can be supplied three ways, in order of precedence:

  1. --password on the CLI — highest priority, but leaks into process listings and shell history. Use only for one-off tests.
  2. IBOX_PASSWORD environment variable — best for CI, systemd EnvironmentFile=, or exporting in a wrapper script.
  3. /etc/manage-ibox-2.conf — first line of the file is used. Set mode 0600. See manage-ibox-2.conf.example in this repo.

Other global flags:

  • --host HOST — router IP (default 172.16.18.1).
  • --user USER — admin username (default admin).
  • --yes / -y — skip interactive confirmation prompts (required in cron).
  • --json — print full JSON response for readable commands too.
  • --quiet / -q — suppress INFO lines to stderr.

Commands

Every command has two output modes:

  • default — human-readable Key: Value text, aligned columns.
  • --json — machine-readable JSON. For simple commands this is the raw sysbus response body verbatim; for diagnostics it is a merged JSON object with info / memory / wan / time / _computed keys.

The tool auto-computes ISO8601 timestamps (_computed.query_time_iso, _computed.last_reboot_iso) for commands where they make sense, so downstream loggers, InfluxDB, Prometheus text exporters, etc. do not have to parse the RFC 2822 date string the router returns.

ping

Reachability check only. Does not log in. Fast fail (5-second timeout). Useful as a preflight in scripts or as a monitoring probe.

$ manage-ibox-2.sh ping
Router at 172.16.18.1 is reachable.

$ manage-ibox-2.sh --json ping
{"host":"172.16.18.1","reachable":true}

# Exit code 3 if unreachable.

reboot

Reboot the router. Interactively prompts for yes unless --yes is given.

$ manage-ibox-2.sh reboot
2026-07-24T10:30:00+02:00 INFO:  Logging in to 172.16.18.1 as admin
About to REBOOT the Internet-Box at 172.16.18.1.
WAN will be down for ~3-5 minutes.
Type "yes" to proceed: yes
2026-07-24T10:30:04+02:00 INFO:  Login OK (contextID length=64)
2026-07-24T10:30:04+02:00 INFO:  Firing NMC:reboot
2026-07-24T10:30:05+02:00 INFO:  Connection closed by router — expected during reboot.

Non-interactive:

manage-ibox-2.sh --yes reboot

info

Human-readable device summary: model, firmware, serial, MAC, uptime.

$ manage-ibox-2.sh info
Product class:           Router
Model name:              RTV1905VW
Manufacturer:            Askey
Serial number:           SN0123456789
Software version:        14.30.02/02330
Hardware version:        1.0
MAC:                     AA:BB:CC:DD:EE:FF
Uptime:                  123456 s

Add --json to get the full raw payload for parsing.

wan-status

WAN connection state, protocol, IPv4/IPv6 addresses, delegated IPv6 prefix, DNS servers, last error.

$ manage-ibox-2.sh wan-status
Connection state:        Bound
Link type:               g.fast
Link state:              up
Protocol:                dhcp
MAC address:             1C:24:CD:26:6E:60
IPv4 address:            85.0.190.196
Remote gateway:          85.0.188.1
DNS servers:             193.5.23.23,193.247.204.23
IPv6 address:            2a02:1210:76a2:4e00:1e24:cdff:fe26:6e60
IPv6 delegated pfx:      2a02:1210:76a2:4e00::/56
Last connection err:     None

memory

Aliased as ram. Total / Used / Free / Buffered / Cached and a rounded usage percentage. Values shown in MB.

$ manage-ibox-2.sh memory
Total:               929 MB
Used:                318 MB
Free:                611 MB
Buffered:            26 MB
Cached:              88 MB
Usage:               34 %

$ manage-ibox-2.sh --json memory
{"status":{"Total":951292,"Free":626272,"Buffered":26712,"Cached":89872}}

cpu

Most recent CPU usage sample (%). Backed by the router's own log ring (GenLog:readLogs on source Devices.Device.HGW).

$ manage-ibox-2.sh cpu
Timestamp:           2026-07-24T08:35:37Z
CPU usage:           23 %

--json returns the full log window with per-sample User / System / Idle / IOwait / Irq / Softirq / Steal / Guest breakdown, ideal for logging and graphing over time.

dsl-stats

DSL / g.fast line statistics: current and attainable sync rates, SNR margin, line attenuation, current profile, plus firmware error counters (FEC / HEC / CRC per direction).

$ manage-ibox-2.sh dsl-stats
=== DSL / g.fast line ===
Link status:             Up
Modulation:              G.Fast
Standard in use:         G.9701_Annex_A
Current profile:         106b
Sync rate:               42157 / 126167 kbps  (up / down current)
Attainable:              42147 / 121775 kbps  (up / down max)
SNR margin:              91 / 151 (0.1 dB, up / down)
Line atten:              0 / 362 (0.1 dB, up / down)
Seconds since resync:    5968 s

=== Error counters (since showtime) ===
XTURFECErrors:           3975144
XTUCFECErrors:           155
XTURHECErrors:           0
XTUCHECErrors:           0
XTURCRCErrors:           0
XTUCCRCErrors:           0

Backed by two sysbus calls: NeMo/Intf/dsl0:getMIBs (line MIBs) and NeMo/Intf/dsl0:getDSLChannelStats (error counters). --json returns the merged {"mibs":..., "stats":...} blob. --prometheus emits ibox_dsl_link_up, ibox_dsl_rate_kbps, ibox_dsl_max_rate_kbps, ibox_dsl_noise_margin_decidb, ibox_dsl_attenuation_decidb, and ibox_dsl_errors_total — ready to scrape.

crashes

Alias: oops. Reads the router's firmware crash log via the OopsTracker sysbus service. Each entry represents one boot-time recovered crash dump (typically OOM kills). Extremely handy for answering "is my box unhealthy?" — a rapidly-growing counter is a very strong signal something is wrong (bad firmware release, dying flash, memory leak in a background daemon).

$ manage-ibox-2.sh crashes
Retained firmware crashes: 10

TIME                     REASON       VERSION      PROCESS                        FILENAME
---------------------------------------------------------------------------------------------
2023-06-26T08:30:27Z     oom          13.20.26     unknown                        dmesg-ramoops-0
2025-03-21T04:13:42Z     oom          14.20.32     unknown                        dmesg-ramoops-1
2025-08-05T10:39:02Z     oom          14.30.02     unknown                        dmesg-ramoops-2
...

--json returns the raw OopsTracker:getOopses response. --prometheus emits ibox_crashes_total, useful as a Grafana alert threshold.

logs

Reads the router's internal event log via GenLog:readLogs + nextLogs. Optional flags:

  • --source SRC — event source (default Devices.Device.HGW, which contains CPU and system stats. Also useful: Devices.Device, Conntrack.Query).
  • --tail N — how many records to return (default 50).
$ manage-ibox-2.sh logs --tail 3
2026-07-24T08:54:31.825Z [Devices.Device.HGW] topic=cpu/  {"timestamp":"2026-07-24T08:54:31.825Z",...}
2026-07-24T08:56:37.841Z [Devices.Device.HGW] topic=cpu/  {"timestamp":"2026-07-24T08:56:37.841Z",...}
2026-07-24T08:58:43.860Z [Devices.Device.HGW] topic=cpu/  {"timestamp":"2026-07-24T08:58:43.860Z",...}
(source=Devices.Device.HGW, requested tail=3)

--json returns the raw record array — pipe into jq for real filtering. In many cases this exposes richer information than the web UI's built-in event log.

diagnostics

Combined dashboard mirroring the web UI's #diagnostics/info/gateway page, plus computed ISO8601 timestamps for easy machine parsing.

$ manage-ibox-2.sh diagnostics
=== Internet-Box diagnostic information ===
Device name:             Internet-Box 2
Manufacturer:            Askey
Serial number:           3.2G1903E0194840
Product class:           SG2-NP-00
Model class code:        SG2-NP-00 (marketing: RTV1905VW)
MAC address:             1c:24:cd:26:6e:60
Firmware version:        14.30.02
Hardware version:        3.2
External IP:             85.0.190.196
Uptime:                  4648 s (0 days)
Last reboot (ISO):       2026-07-24T09:19:05+02:00
Query time (ISO):        2026-07-24T10:36:33+02:00
System time (raw):       Fri, 24 Jul 2026 10:36:33 GMT+0200
Reboot count:            17
WAN state:               Bound
WAN protocol:            dhcp
WAN IPv4:                85.0.190.196
WAN IPv6:                2a02:1210:76a2:4e00:1e24:cdff:fe26:6e60
IPv6 delegated pfx:      2a02:1210:76a2:4e00::/56
RAM used:                318 / 929 MB (34%)
RAM buffered:            26 MB
RAM cached:              88 MB

--json returns a single object:

{
  "info":     { ... DeviceInfo:get raw payload ... },
  "memory":   { ... DeviceInfo/MemoryStatus:get raw payload ... },
  "wan":      { ... NMC:getWANStatus raw payload ... },
  "time":     { ... Time:getTime raw payload ... },
  "_computed": {
    "query_time_iso":   "2026-07-24T10:37:18+02:00",
    "last_reboot_iso":  "2026-07-24T09:19:05+02:00",
    "uptime_seconds":   4693,
    "system_time_raw":  "Fri, 24 Jul 2026 10:37:18 GMT+0200"
  }
}

Perfect for piping into jq, InfluxDB line protocol, Prometheus text exporters, or logging to a stats system.

--prometheus on diagnostics emits a compact single-scrape overview: ibox_uptime_seconds, ibox_reboots_total, ibox_memory_bytes{state=...}, ibox_wan_up{state=...}.

watch

Poll any read-only subcommand at a fixed interval — think top(1) for your CPE.

manage-ibox-2.sh watch cpu                        # every 5s, default
manage-ibox-2.sh watch dsl-stats --interval 30    # every 30s
manage-ibox-2.sh --json watch memory --interval 10 > /var/log/ibox-mem.ndjson

In text mode the screen is cleared between iterations (so you see one "live" snapshot at a time). In --json mode, output is NDJSON — one JSON object per line, appended forever — so you can pipe it straight to a log file, a Kafka producer, or jq -c '. | select(.foo)'.

watch inherits the global --field, --prometheus, --host, --user, and --password from its outer invocation and passes them through, so watch --field IPv6DelegatedPrefix wan-status --interval 60 also works.

raw

Call any sysbus endpoint directly. Prints the full response body plus the HTTP status to stderr.

# List static DHCP leases
manage-ibox-2.sh raw DHCPv4/Server/Pool/default:getStaticLeases

# Get firewall port-forwarding table
manage-ibox-2.sh raw Firewall:getPortForwarding

# Get DECT (cordless phone) base state
manage-ibox-2.sh raw DECT:getBaseState

# Provide a custom body:
manage-ibox-2.sh raw NMC:reboot '{"parameters":{"reason":"maintenance"}}'

The endpoint path may use either dots or slashes for the service hierarchy — NeMo.Intf.dsl0:getMIBs and NeMo/Intf/dsl0:getMIBs are both accepted. The tool normalises to the slash form the API expects on the wire.

Sysbus endpoints observed in the wild (there are dozens more — inspect the web UI's Network tab in DevTools to discover the rest):

Endpoint What it does
DeviceInfo:get Product / model / firmware / uptime
Time:getTime Current router time
NMC:get Top-level Network Management Config
NMC:getWANStatus WAN connection state
NMC:getIPConflicts LAN IP conflict detector
NMC/DNS:get DNS server config
NMC/WWAN:get 4G/5G backup radio state
NMC/Wifi:get Wi-Fi config
NMC/Guest:get Guest Wi-Fi state
NMC:reboot Reboot
Firewall:getDMZ DMZ config
Firewall:getPortForwarding Port forwards
Firewall:getFirewallIPv6Level IPv6 firewall level
DHCPv4/Server/Pool/default:getStaticLeases Static DHCP leases
NetMaster/LAN/default/Bridge/lan:getIPv4 LAN bridge IPv4 config
NeMo/Intf/data:getMIBs Data interface MIBs
NeMo/Intf/dsl0:getMIBs DSL/g.fast line MIBs (rate, SNR, atten)
NeMo/Intf/dsl0:getDSLChannelStats DSL sync / channel error counters
OopsTracker:get Firmware crash count summary
OopsTracker:getOopses Firmware crash log (one entry per crash)
GenLog:readLogs + nextLogs Router event log iterator
DeviceInfo/MemoryStatus:get Live RAM figures
VoiceService/VoiceApplication:listTrunks SIP trunks
VoiceService/VoiceApplication:listHandsets DECT handsets
DECT:getBaseState DECT base state
WebuiupgradeService:get Firmware upgrade status
UserManagement:getUserLog Login history

Global options

Option Meaning
--host HOST Router IP (default 172.16.18.1)
--user USER Admin username (default admin)
--password P Admin password (highest precedence)
--yes / -y Skip interactive confirmation prompts (needed for cron)
--json Print full raw JSON body for parsed commands
--prometheus Emit Prometheus text-format metrics
--field FIELD Extract single JSON value from response and print unquoted
--quiet / -q Suppress INFO lines on stderr
--version Print the tool version and exit
-h / --help Show help

Global options must appear before the command name.

--field FIELD

Cherry-pick a single JSON value from any command's response and print it as a bare (unquoted) string — perfect for shell substitution.

# Grab the current external IPv4 without piping through jq
IP=$(manage-ibox-2.sh --field IPAddress wan-status)

# Grab the current DSL upstream sync rate in kbps
UP=$(manage-ibox-2.sh --field UpstreamCurrRate dsl-stats)

# Grab the delegated IPv6 prefix
PFX=$(manage-ibox-2.sh --field IPv6DelegatedPrefix wan-status)

# Grab a value from the merged diagnostics blob
UPTIME=$(manage-ibox-2.sh --field uptime_seconds diagnostics)

--field implies --json internally and silences INFO lines, so manage-ibox-2.sh --field X <cmd> is safe to use inside $(...) without extra plumbing. Exits 5 if the field can't be found.

The matcher is a naive first-match on "FIELD":<value>. It works beautifully for the flat/shallow structures the sysbus API returns. If you need real nested drilling, use --json and jq.

--prometheus

Emit metrics in Prometheus text exposition format instead of human-readable text. Applies to diagnostics, cpu, memory, wan-status, dsl-stats, and crashes (and by extension watch <cmd> when <cmd> is one of those).

$ manage-ibox-2.sh --prometheus diagnostics
# HELP ibox_uptime_seconds Router uptime in seconds
# TYPE ibox_uptime_seconds gauge
ibox_uptime_seconds 5926
# HELP ibox_reboots_total Total number of reboots
# TYPE ibox_reboots_total counter
ibox_reboots_total 17
# HELP ibox_memory_bytes RAM bytes by state
# TYPE ibox_memory_bytes gauge
ibox_memory_bytes{state="total"} 974123008
ibox_memory_bytes{state="free"} 640786432
ibox_memory_bytes{state="used"} 333336576
ibox_memory_bytes{state="buffered"} 27353088
ibox_memory_bytes{state="cached"} 91742208
# HELP ibox_wan_up 1 if WAN link is up
# TYPE ibox_wan_up gauge
ibox_wan_up{state="Bound"} 1

Drop into your Prometheus stack via node_exporter's textfile collector with a cron job:

* * * * * /root/manage-ibox-2.sh -q --prometheus diagnostics > /var/lib/node_exporter/textfile_collector/ibox.prom.tmp && mv /var/lib/node_exporter/textfile_collector/ibox.prom.tmp /var/lib/node_exporter/textfile_collector/ibox.prom

Exit codes

Code Meaning
0 Success (or user aborted at the prompt).
1 Bad arguments or missing password.
2 Missing dependency (curl not installed).
3 Router unreachable (no HTTP response within timeout).
4 Login failed (wrong password / API changed).
5 RPC call failed (auth succeeded but endpoint refused).

The reachability probe runs before every authenticated call, so a dead router surfaces as exit 3 rather than a login failure — useful for monitoring pipelines that want to distinguish "box off" from "credentials wrong".


Automation examples

Weekly cron reboot on OpenWrt

Append to /etc/crontabs/root:

0 4 * * 0  /root/manage-ibox-2.sh -y -q reboot >>/var/log/manage-ibox-2.log 2>&1

Then:

/etc/init.d/cron enable
/etc/init.d/cron restart

WAN-loss watchdog

#!/bin/sh
# /root/wan-watchdog.sh — run every minute via cron
STATE=/tmp/wan-fail-count
COOLDOWN=/tmp/wan-reboot-cooldown

# If we rebooted in the last hour, do nothing (avoid loops)
if [ -f "$COOLDOWN" ] && [ "$(( $(date +%s) - $(cat "$COOLDOWN") ))" -lt 3600 ]; then
    exit 0
fi

if ping -c 3 -W 2 -q 1.1.1.1 >/dev/null 2>&1; then
    rm -f "$STATE"; exit 0
fi

COUNT=$(( $(cat "$STATE" 2>/dev/null || echo 0) + 1 ))
echo "$COUNT" > "$STATE"

if [ "$COUNT" -ge 5 ]; then
    logger -t wan-watchdog "WAN down 5 min, rebooting Internet-Box"
    /root/manage-ibox-2.sh -y -q reboot
    date +%s > "$COOLDOWN"
    rm -f "$STATE"
fi

Cron:

* * * * * /root/wan-watchdog.sh

Prometheus scrape via node_exporter textfile collector

The tool has native Prometheus output — no jq gymnastics needed:

# /etc/cron.d/ibox-metrics
* * * * * root /root/manage-ibox-2.sh -q --prometheus diagnostics \
    > /var/lib/node_exporter/textfile_collector/ibox.prom.tmp && \
    mv /var/lib/node_exporter/textfile_collector/ibox.prom.tmp \
       /var/lib/node_exporter/textfile_collector/ibox.prom

Combine multiple subsystem scrapes if you want more detail (DSL, crashes, etc.):

{
    /root/manage-ibox-2.sh -q --prometheus diagnostics
    /root/manage-ibox-2.sh -q --prometheus dsl-stats
    /root/manage-ibox-2.sh -q --prometheus crashes
} > /var/lib/node_exporter/textfile_collector/ibox.prom

One-liner IPv6 wedge detector

# Reboot the CPE if it lost its delegated IPv6 prefix
PREFIX=$(manage-ibox-2.sh --field IPv6DelegatedPrefix wan-status)
if [ -z "$PREFIX" ] || [ "$PREFIX" = "::/0" ]; then
    manage-ibox-2.sh -y -q reboot
fi

Alert on DSL sync-rate drop

UP=$(manage-ibox-2.sh --field UpstreamCurrRate dsl-stats)
DOWN=$(manage-ibox-2.sh --field DownstreamCurrRate dsl-stats)
[ "$DOWN" -lt 50000 ] && logger -t ibox "downstream sync dropped to $DOWN kbps"

Live top(1) for the router

manage-ibox-2.sh watch cpu --interval 3
manage-ibox-2.sh watch dsl-stats --interval 30

Extending the tool

Adding a new "friendly" subcommand for another sysbus endpoint is mechanical:

  1. Copy an existing cmd_* function (e.g. cmd_info).
  2. Change the endpoint path in call_sysbus.
  3. Change the jget field names to whatever your JSON returns.
  4. Add a dispatch line to the case "$CMD" block at the bottom.

If in doubt, use raw first to see the response shape, then wrap it.


Security notes

  • The Internet-Box speaks plain HTTP on the LAN. No HTTPS is available. Anyone on the same broadcast domain who can sniff traffic will see the admin password cross the wire in cleartext during login. Only run this on a trusted LAN segment.
  • Store the config file with mode 0600 and owned by the account that runs the script (root on OpenWrt).
  • Do not commit manage-ibox-2.conf to git. The included .gitignore excludes it. Use manage-ibox-2.conf.example as your template.
  • Prefer the env var or config file over --password. Command-line arguments show up in /proc/<pid>/cmdline and shell history.
  • The tool never writes config or persists state on the router. It only performs read/RPC calls; the reboot command is the only one that changes state on the box, and it's identical to what the web UI does.

Troubleshooting

"Login rejected (HTTP 401)" Wrong password, or you're temporarily locked out from too many attempts. The Internet-Box implements login throttling — wait a few minutes and try again. Confirm the password by logging into the web UI manually first.

"Login OK but no contextID" Your firmware likely uses a slightly different createContext response shape. Open the browser DevTools Network tab on a successful login, copy the response body, and file an issue with the details.

Script hangs Confirm the box IP is reachable: curl -v http://<box-ip>/. The default --max-time 15 should cause a timeout otherwise.

"Missing opkg packages: curl" Run opkg update && opkg install curl.

raw returns HTTP 400 or empty body The endpoint likely requires a specific parameters payload. Watch what the web UI sends in DevTools → Network for the same action and copy the body.

Reboot request succeeds but the box doesn't reboot Try a different reason string in the raw body: manage-ibox-2.sh raw NMC:reboot '{"parameters":{"reason":"User"}}'.


⚠️ Disclaimer

  • This is not an official Swisscom or Askey tool. Nobody involved is affiliated with either company.
  • The API used here is not documented publicly. It was discovered by reading the JavaScript bundle that the router serves to the browser and by observing normal browser traffic. That means:
    • Firmware updates can break it without notice.
    • The vendor could deliberately close it in the future.
    • Behavior on other Internet-Box generations or firmware versions is unverified.
  • You are responsible for using this on hardware you own or are authorized to manage. Do not point it at somebody else's router.
  • There is no warranty. See LICENSE.

Contributing

PRs welcome, especially:

  • Confirmation that this works (or doesn't) on other Internet-Box generations: IB standard, IB smart, IB plus, IB 3, IB 4.
  • Confirmation on other firmware releases.
  • New wrapped subcommands (guest-wifi, port-forwards, dhcp-leases, …).
  • Better error messages for known failure modes.

When submitting a PR:

  1. Include the firmware version (Overview → System info in the web UI).
  2. Redact your admin password from any log excerpts you paste.
  3. Keep the script POSIX-shell compatible — no bash-isms — so it continues to run on busybox ash.

License

MIT — see LICENSE.


Author

Steven Uggowitzer <steven@entuura.org> Entuura (Asia) Limited, 2025

Reverse engineering assistance and script authoring: Claude (Anthropic), Opus 4.7.

About

Command-line management + monitoring tool for the Swisscom Internet-Box 2 (Askey RTV1905VW). POSIX shell, runs on OpenWrt. Talks the router's undocumented sysbus HTTP API directly - no browser automation required. Reboot, WAN status, DSL/g.fast line stats, RAM/CPU, firmware crash log, event log, native Prometheus output.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages