#!/bin/bash # Create file wlan.devs which is a listing of all wireless devices currently attached to my router # Added to my ~Cow PHLOG on 14 Dec 19 # The output of $ curl is unique to my router make/model. # Using a different router, $tablestart and $tableend will be different # These strings appear in the router's landing page just before and after the data I want to capture tablestart=');setWirelessTable(' tableend=');setWDSTable();setDHCPTable(' # Download a copy of my router's landing page and load it into the variable $devs curl 192.168.1.1 > wlan.temp devs=$( wlan.temp sed -i 's/\, //g' wlan.temp echo "$(tr ',' '\n' wlan.devs rm wlan.temp # Display results cat wlan.devs # The contents of wlan.devs (in my case) looks like this: # 'xx:xx:xx:xx:A9:84','ath0','0:16:09','39M','6M','LEGACY','-56','-93','37','880' # 'xx:xx:xx:xx:79:73','ath0','0:35:12','58M','6M','LEGACY','-56','-93','37','880' # 'xx:xx:xx:xx:A5:64','ath0','5 days 6:22:38','54M','2M','LEGACY','-53','-93','40','940' # I know which device is which based on the MAC address at the start of each line # If this program is put into a loop (bad form) or called every minute with a cron job, # we can detect when devices arrive or depart the WiFi's zone and can act on that info # as needed (eg logging devices or turning on the coffee pot, etc)