Name Mode Size
LICENSE 100644 1 kb 100644 2 kb 100755 5 kb 100755 2 kb 100755 1 kb
# ddwrt-who-is-connected A script to output who all is actively connected to your DD-WRT router This script is designed to get current active connections as well as static DHCP leases and return what devices are connected in a file, by default $HOME/client_ips.txt unless passed as the first commandline option #Prerequisites * DD-WRT router (or others that provide hosts,netstat,awk,and grep) * Correctly setup passwordless SSH connection with DD-WRT router #Configuration You *must* configure `` with the appropriate names of the computers and routers that are connected, and comment out the ones that you are not interested in. For example, if the device that is statically assigned to is "Spouse's Android" then ensure that you have this line: ``` sed -i '/ s/$/ - Spouse iPhone/' $activetemp ``` and proceed accordingly. You will also want to either edit the output file (line 14) or pass it as the first commandline option. If you want to use the output in a webpage, uncomment line 96. If you want to use a particular SSH configuration file, see the example on line 42 #Utility Aside from a fairly easy monitoring service (you can have this redirect to a local webserver, for example), you can also then use this script to trigger other things instead of relying on portable devices. For a simple example, you could have a cronjob that has the following: ``` bob=$(grep -c "Spouse iPhone" $HOME/client_ips.txt) if [ "$bob" == "1" ];then do a command that your spouse wants when they get home fi ``` (Note that you will have to use the full path of $HOME if you're really using a cron job...) You can see as a fairly robust starting point, or even full featured way to use this, if you don't mind specifying the command line variables. #Output The output file will look like this: ``` - Name of Device - Name of Device - Name of Device - Name of Device - Name of Device - Name of Device - Name of Device - Name of Device 555.555.555.555 - gateway ######### Offline Nodes * - Name of Device * - Name of Device * - Name of Device ``` Please note that additional routers may appear in the "offline" list if you have configured them to reject PING requests.