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 192.168.1.1:
H 192.168.1.1 openwrt
ADHE 192.168.1.100 MacbookPro F0:18:98:36:06:73 Apple, Inc. wlan1 493.286Mbps
ADHE 192.168.1.101 MacbookPro-wired 00:50:B6:98:C4:29 GOOD WAY IND. CO., LTD
ADHE 192.168.1.105 iPad 26:5A:90:A8:52:73 locally administered wlan1 380.493Mbps
ADHE 192.168.1.130 JessicaPhone EA:24:8C:29:DA:12 locally administered wlan1 429.656Mbps
AD 192.168.1.151 76:2A:A6:21:85:EC locally administered
ADHE 192.168.1.160 OldMacbookPro 20:C9:D0:84:02:D6 Apple, Inc. wlan0 120.208Mbps
HE 192.168.1.182 MacookAir D0:E1:40:91:88:1E Apple, Inc.
ADHE 192.168.1.188 iPhone-John 2E:73:1F:31:B0:1D locally administered wlan1 456.389Mbps
ADHE 192.168.1.200 lights-gw 00:17:88:26:0A:26 Philips Lighting BV
ADHE 192.168.1.201 tv 10:4F:A8:03:00:8C Sony Corporation
ADHE 192.168.1.212 printer 3C:2A:F4:42:24:A2 Brother Industries, LT
AD 192.168.1.228 2E:73:1F:31:B0:1D locally administered wlan1 456.389Mbps
ADHE 192.168.1.254 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 subprocess.run(['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"
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>
sys.exit(main())
File "/root/.local/lib/python3.8/site-packages/wrtview/wrtview.py", line 125, in main
ip, _, _, _, mac, *_ = whitespace.split(line)
ValueError: not enough values to unpack (expected at least 5, got 4)
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.
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.