[Cerowrt-devel] figuring out who's actually on an ap
Dave Taht
dave.taht at gmail.com
Sat Jan 26 14:00:10 EST 2013
On Sat, Jan 26, 2013 at 10:22 AM, Dave Taht <dave.taht at gmail.com> wrote:
> Once upon a time it was possible to write quick and dirty tools in shell.
> You used to just be able to open a port, write a tiny little daemon, and
> go. And we used to have handy tools like rwho and finger to figure out who
> was online, ruptime to check uptime, etc, etc.
>
> That's too insecure nowadays...
> so we have 3 different levels of snmp which you can use (if you can secure
> it), and
> run a shell command from that, remotely, then parse... or use ssh, and
> parse.
>
> And then we have dhcp, which hands out leases, but is not tied to how wifi
> goes up
> and down.
>
> This morning I had a need to figure who was actually on a couple cerowrt
> APs,
> and a few statistics as to their connected rate...
>
> I haven't got so as figuring out how to do all that via snmpd yet, but as
> this uses
> an obscure feature of the mac802.11 stack, I thought I'd document this
> much.
>
> If there is a better way, a mib, something, let me know....
>
> #!/bin/sh
> # rup: quickly see whos really on the wifi
>
> A=`ls /sys/kernel/debug/ieee80211/phy*/netdev:*/stations | \
> cut -f8 -d/ | tr '\n' '|'`
> # cut off last |
> egrep ${A%?} /tmp/dhcp.leases | awk '{print $3 " " $4 }'
>
>
>
Or, you can just stick it into /etc/xinetd.d/rup
service rup
{
disable = no
socket_type = stream
wait = no
user = nobody
only_from = my_ipv4_ip/32 my_ipv6_ip/64
port = 79
type = UNLISTED
server = /etc/rup
flags = IPv6
log_on_success += HOST USERID
log_on_failure += HOST USERID
instances = 4
}
nc 172.20.2.2 79 | awk '{print $1}' | fping -c 2 -q
and be done with it.
172.20.3.210 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 6.64/187/368
172.20.3.99 : xmt/rcv/%loss = 2/0/100%
172.20.3.180 : xmt/rcv/%loss = 2/0/100%
172.20.3.141 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 75.1/77.9/80.7
172.20.3.212 : xmt/rcv/%loss = 2/0/100%
172.20.3.128 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 23.9/122/222
172.20.3.229 : xmt/rcv/%loss = 2/0/100%
172.20.3.172 : xmt/rcv/%loss = 2/0/100%
172.20.3.34 : xmt/rcv/%loss = 2/0/100%
172.20.3.102 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0.07/0.08/0.09
172.20.3.146 : xmt/rcv/%loss = 2/0/100%
and to gather remote rate stats:
#!/bin/sh
# Gather connected speeds and minstrel error rates from remote wifi
for i in /sys/kernel/debug/ieee80211/phy*/netdev:*/stations/*
do
RATE=`grep PMCS "$i/rc_stats"`
STATION=`echo $i | cut -f9 -d/`
[ -z "$STATION" ] && exit
B=`grep ${STATION} /tmp/dhcp.leases 2> /dev/null | awk '{print $3}'`
echo "$B $RATE"
done
# and I suppose this will blow up in ipv6...
>
> --
> Dave Täht
>
> Fixing bufferbloat with cerowrt:
> http://www.teklibre.com/cerowrt/subscribe.html
--
Dave Täht
Fixing bufferbloat with cerowrt:
http://www.teklibre.com/cerowrt/subscribe.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.bufferbloat.net/pipermail/cerowrt-devel/attachments/20130126/7b9b899c/attachment-0002.html>
More information about the Cerowrt-devel
mailing list