http://blog.csdn.net/cupidove/article/details/45599985
查看连接Openwrt路由的无线客户端:
- iwinfo wlan0 assoclist
- iw dev wlan0 station dump
查看分配的DHCP客户端IP:
- cat /tmp/dhcp.leases
扫描无线路由器/AP:
- iwinfo wlan0 scan
查看Openwrt路由无线信息:
- iwinfo wlan0 info
- wlan0 ESSID: "OpenWrt"
- Access Point: 00:1F:A3:65:55:8E
- Mode: Master Channel: 5 (2.432 GHz)
- Tx-Power: 20 dBm Link Quality: 30/70
- Signal: -80 dBm Noise: unknown
- Bit Rate: 32.5 MBit/s
- Encryption: WPA2 PSK (CCMP)
- Type: nl80211 HW Mode(s): 802.11bg
- Hardware: unknown [Generic MAC80211]
- TX power offset: unknown
- Frequency offset: unknown
- Supports VAPs: no PHY name: phy0
- wifi down && sleep 5 && wifi
- #!/bin/bash
- echo -e "# IP address\tname\tMAC address\ttx bit\trx bit"
- for interface in `iw dev | grep Interface | cut -f 2 -s -d" "`
- do
- maclist=(`iw dev $interface station dump | grep Station | cut -f 2 -s -d" "`)
- txlist=(`iw dev wlan0 station dump|grep 'tx bitrate'|awk '{print $3$4}'`)
- rxlist=(`iw dev wlan0 station dump|grep 'rx bitrate'|awk '{print $3$4}'`)
- len=${#maclist[@]}
- for ((i=0;i<$len;i++))
- do
- mac=${maclist[$i]}
- tx=${txlist[$i]}
- rx=${rxlist[$i]}
- ip="UNKN"
- host=""
- ip=`cat /tmp/dhcp.leases | cut -f 2,3,4 -s -d" " | grep $mac | cut -f 2 -s -d" "`
- host=`cat /tmp/dhcp.leases | cut -f 2,3,4 -s -d" " | grep $mac | cut -f 3 -s -d" "`
- echo -e "$ip\t$host\t$mac\t$tx\t$rx"|awk '{printf "%-15s %-25s %-15s %-10s %-10s\n",$1,$2,$3,$4,$5}'
- done
- done