The show_wifi_clients.sh
shell script found here is a modified version of what I found at the OpenWRT Wireless FAQ.
My intent is to use it on a Tessel 2 along with some modifications its firmware. The firmware mods (not shown here) will exec
the script to obtain a JSON formatted list of stations that are attached to the Tessel's access point.
The differences are -
- Can optionally create output in JSON
- Includes the time stamp found in the DHCP lease file
- Minor changes made to expressions
Default Ouput Example -
> ./show_wifi_clients.sh
# All connected wifi devices, with IP address,
# hostname (if available), and MAC address.
# IP address name MAC address
192.168.1.173 ESP_DDEEFF aa:bb:cc:dd:ee:ff
192.168.1.158 android-2496ac597fe00412 00:11:22:33:44:55
JSON Formatted Output Example -
> ./show_wifi_clients.sh json
[
{"tstamp":1525747482,"ip":"192.168.1.173","host":"ESP_DDEEFF","mac":"aa:bb:cc:dd:ee:ff"},
{"tstamp":1525747710,"ip":"192.168.1.158","host":"android-2496ac597fe00412","mac":"00:11:22:33:44:55"}
]