Introducing: wrtview

I wrote a command line tool called 'wrtview' because I needed a simple overview of my network and all the hosts connected to it on one screen. 'wrtview' is meant to run on a computer that connects to the central OpenWRT box on a network and collects files and command output to produce text output like this:

Network 'lan' on

  H   openwrt         
ADHE MacbookPro        F0:18:98:36:06:73  Apple, Inc.             wlan1 493.286Mbps
ADHE MacbookPro-wired  00:50:B6:98:C4:29  GOOD WAY IND. CO., LTD
ADHE iPad              26:5A:90:A8:52:73  locally administered    wlan1 380.493Mbps
ADHE JessicaPhone      EA:24:8C:29:DA:12  locally administered    wlan1 429.656Mbps
AD                   76:2A:A6:21:85:EC  locally administered       
ADHE OldMacbookPro     20:C9:D0:84:02:D6  Apple, Inc.             wlan0 120.208Mbps
  HE MacookAir         D0:E1:40:91:88:1E  Apple, Inc.                
ADHE iPhone-John       2E:73:1F:31:B0:1D  locally administered    wlan1 456.389Mbps
ADHE lights-gw         00:17:88:26:0A:26  Philips Lighting BV        
ADHE tv                10:4F:A8:03:00:8C  Sony Corporation           
ADHE printer           3C:2A:F4:42:24:A2  Brother Industries, LT     
AD                   2E:73:1F:31:B0:1D  locally administered    wlan1 456.389Mbps
ADHE switch            00:1F:28:E2:66:82  HPN Supply Chain

I hope the README on the project GitHub page adequately explains how it works. It needs python 3.5 or newer and then installs with:

python -m pip install wrtview

For remarks, complaints and praise please (also) use the issues or discussion options on the GitHub page as I do not check this forum regularly.


Nice, but I already have a separate pubkey files for connecting, would be nice if you could add an option to support ssh -i.
I tried to hack in the support by hard coding it but I failed, I don't know python at all really.

This didn't work:
return['ssh',' -i',' /root/.ssh/id_router', 'root@'

I checked with print(addr) and it returns nothing.

However manually doing this in bash works fine:
ssh -i /root/.ssh/id_router root@router "uci get network.lan.ipaddr"

1 Like

No time to play with it right now, but I think the options are specified without the space in front, so '-i' and not ' -i', same for the path. See if that works... I'll add a -i option when I work on it again. Soon.

Correct, works now., But now it fails at the # ARP unpack instead, this is more likely a bug or something. Uncommenting the whole ARP for loop makes the script show some output at least.

Traceback (most recent call last):
  File "/root/.local/bin/wrtview", line 8, in <module>
  File "/root/.local/lib/python3.8/site-packages/wrtview/", line 125, in main
    ip, _, _, _, mac, *_ = whitespace.split(line)
ValueError: not enough values to unpack (expected at least 5, got 4)

That was a bug indeed. The current version, 0.10.0, addresses this and natively supports the --identity / -i command line option.

python -m pip install wrtview --upgrade

Ah, great, works now. :slight_smile:

I just released version 1.0.0 of wrtview.

  • BREAKING CHANGE: networks and wifi-interfaces now with multiple -n and -w options
  • Added ping script to ping entire networks from router, so you see all hosts
  • Offline hosts are greyed, router itself in bold
  • Fixed various bugs in presenting data
  • More readable code parsing data out of command output
  • More descriptive errors
  • Updated vendors file for MAC->vendor lookup from IEEE with new (included) script
  • Cleaner code

GitHub - PyPI

Install/upgrade with

python -m pip install wrtview --upgrade
 ifconfig lan' returned non-zero exit status 1. (ifconfig: lan: error fetching interface information: Device not found

I have no interface named lan, it's called br-lan for some reason. Might be an old default.
@hnyman might know, not that it matters much but it causes the script to fail.

on some contexts, Openwrt adds a prefix like "br-" for bridges, "ipv6-" for ipv6 special interfaces like "ipv6-6in4"

1 Like

Version 1.0.1 has correct recognition of true network interface names in more scenarios, and presents network speeds based on available information for more different wireless drivers.

python -m pip install wrtview --upgrade