PND4

/dev/notes

Peekaboo!

I know its been a long time between posts; Im not dead! To celebrate heres something you can use with your FiOS router.

devices.sh

1
2
curl -s 'http://<your router>/api/devices' ' -H 'Cookie: test; Session=<use yours>; XSRF-TOKEN=<get one>' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Connection: keep-alive' --compressed \
| sed -e '{ s/\[//g; s/{/\n/g; s/^.+//g; s/ipv6Address.+(?="mac)/\t/g};' | grep -v "rssi\":0" 

peekaboo.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash
while true
do 
    ./devices.sh | cut -d, -f 6-7,12,14,16 | egrep -i -e '<MAC or Vendor-Prefixes to look for>'
    if [ $? -eq 0 ]
    then
        echo -e "\a\n\n\nret[$?] -- DEVICES FOUND !!\n\n\n" && \
            /usr/bin/mpg123 -q $HOME/.sounds/peanutbutter-jelly-time.mp3
        break
    else
        echo "ret[$?] -- $(date +%H:%M:%S) - Devices not found.."
        sleep 3
        clear
    fi
done

I'll elaborate in the near future. Have fun!