Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/ash
- # hostname
- # should return ?host=hostname
- UCISYSNAME=`uci show system.@system[0].hostname | sed -e 's/.*=//'`
- echo -n "?host=$UCISYSNAME"
- # ping stats
- # should ping a host and return fping results with spaces replaced with _
- # should return &ping=
- PINGSTATS=`fping -C 5 -q cobianet.com 2>&1 | sed 's/ /_/g'`
- echo -n "&ping=$PINGSTATS"
- # wifi stations rssi
- # should return all associated stations for any athX interfaces, with MAC and DBM
- # example: &athif[ath0][00:15:6d:da:ee:11][DBM]=-82&athif[ath0][00:14:a4:61:74:21][DBM]=-90&athif[ath2][01:34:a4:15:6e:12][DBM]=-50
- ATHINTERFACES=`cat /proc/net/wireless | grep ath | cut -d: -f1`
- ATHCOUNT=`echo $ATHINTERFACES | awk -F' ' '{ print NF }'`
- c=1
- while [ $c -le $ATHCOUNT ]
- do
- CURRENTATHIF=`echo $ATHINTERFACES | awk '{ print $"'"$c"'"}'`
- CAISTA="`wlanconfig $CURRENTATHIF list sta | sed '1d' | sed ':a;N;$!ba;s/\n/;/g'`"
- CAISTACOUNT=`wlanconfig $CURRENTATHIF list sta | sed '1d' | wc -l`
- d=1
- while [ $d -le $CAISTACOUNT ]
- do
- # get mac
- CURRENTMAC=`echo $CAISTA | cut -d';' -f"$d" | cut -d' ' -f1`
- # print dbm
- echo -n "&athif[$CURRENTATHIF][$CURRENTMAC][DBM]="
- echo -n `echo $CAISTA | cut -d';' -f"$d" | cut -d' ' -f6`
- d=$(( $d + 1 ))
- done
- c=$(( $c + 1 ))
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement