wifimon |
Subversion Repositories: |
Rev 16 | Rev 17 | |
---|---|---|
Line 4... | Line 4... | |
# release date : 05/10/2003 |
# release date : 05/10/2003 | |
# name : wifimon |
# name : wifimon | |
# description : hostap powered wifi card monitoring |
# description : hostap powered wifi card monitoring | |
# license : GPL |
# license : GPL | |
|
| |
wl_version="0.5.2" |
wl_version="0.5.3" | |
|
| |
PATH=$PATH:$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:usr/local/bin:/usr/local/sbin |
PATH=$PATH:$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:usr/local/bin:/usr/local/sbin | |
|
| |
wl_iwccmd=`which iwconfig` |
wl_iwccmd=`which iwconfig` | |
wl_ifccmd=`which ifconfig` |
wl_ifccmd=`which ifconfig` | |
Line 21... | Line 21... | |
wl_hostap="/proc/net/hostap/" |
wl_hostap="/proc/net/hostap/" | |
wl_wireless="/proc/net/wireless" |
wl_wireless="/proc/net/wireless" | |
wl_arp="/proc/net/arp" |
wl_arp="/proc/net/arp" | |
wl_dhcpcnf="/etc/dhcpd.conf" |
wl_dhcpcnf="/etc/dhcpd.conf" | |
wl_dhcplss="/var/lib/dhcp/dhcpd.leases" |
wl_dhcplss="/var/lib/dhcp/dhcpd.leases" | |
#wl_dhcpcnf="/etc/dhcp3/dhcpd.conf" |
# wl_dhcpcnf="/etc/dhcp3/dhcpd.conf" | |
#wl_dhcplss="/var/lib/dhcp3/dhcpd.leases" |
# wl_dhcplss="/var/lib/dhcp3/dhcpd.leases" | |
|
| |
#testing all settings |
#testing all settings | |
|
| |
if [ "$wl_iwccmd x" = " x" ] |
if [ "$wl_iwccmd x" = " x" ] | |
then |
then | |
Line 259... | Line 259... | |
|
| |
[ $wcm_pkts -eq 1 ] && echo -n "Tx" $wl_nt1 $wl_nt2 $wl_nt5 $wl_nt11 "Rx" $wl_nr1 $wl_nr2 $wl_nr5 $wl_nr11 "" |
[ $wcm_pkts -eq 1 ] && echo -n "Tx" $wl_nt1 $wl_nt2 $wl_nt5 $wl_nt11 "Rx" $wl_nr1 $wl_nr2 $wl_nr5 $wl_nr11 "" | |
|
| |
} # w_pkts |
} # w_pkts | |
###################################################################### |
###################################################################### | |
w_managed() { |
w_managed() | |
echo $wl_iwctxt | $wl_awkcmd '{print $1,$3,$4,$5" "}' |
{ echo $wl_iwctxt | $wl_awkcmd '{print $1,$3,$4,$5" "}' | |
echo -n `$wl_ifccmd $wl_iface | grep -E "inet addr|inet adr" | $wl_awkcmd '{print $2" "}' | sed s/ad*r://g`" " # IP adresa mastera z ifconfig |
echo -n `$wl_ifccmd $wl_iface | grep -E "inet addr|inet adr" | $wl_awkcmd '{print $2" "}' | sed s/ad*r://g`" " # IP adresa mastera z ifconfig | |
|
| |
if [ $wcm_macoff -eq 1 ] |
if [ $wcm_macoff -eq 1 ] | |
then |
then | |
echo $wl_iwctxt | $wl_awkcmd '{print $6""$7,$12""$13" "}' |
echo $wl_iwctxt | $wl_awkcmd '{print $6,$11" "}' | |
else |
else | |
echo $wl_iwctxt | $wl_awkcmd '{print $10,$6""$7,$12""$13" "}' |
echo $wl_iwctxt | $wl_awkcmd '{print $9,$6,$11" "}' | |
fi |
fi | |
|
| |
wl_wtxt=`cat $wl_wireless | grep $wl_iface | $wl_awkcmd '{print $3,$4,$5}' | sed 's/\.//g'` |
wl_wtxt=`cat $wl_wireless | grep $wl_iface | $wl_awkcmd '{print $3,$4,$5}' | sed 's/\.//g'` | |
wl_quality=`echo $wl_wtxt | $wl_awkcmd '{print $1}'` |
wl_quality=`echo $wl_wtxt | $wl_awkcmd '{print $1}'` | |
wl_signal=`echo $wl_wtxt | $wl_awkcmd '{print $2}'` |
wl_signal=`echo $wl_wtxt | $wl_awkcmd '{print $2}'` | |
Line 284... | Line 284... | |
echo |
echo | |
} # w_managed |
} # w_managed | |
|
| |
###################################################################### |
###################################################################### | |
w_master() |
w_master() | |
{ |
{ if [ $wcm_oneline -eq 0 ] | |
if [ $wcm_oneline -eq 0 ] |
||
then |
then | |
echo $wl_iwctxt | $wl_awkcmd '{print $1,$3,$4,$5" "}' |
echo $wl_iwctxt | $wl_awkcmd '{print $1,$3,$4,$5" "}' | |
if [ $wcm_macoff -eq 1 ] |
if [ $wcm_macoff -eq 1 ] | |
then |
then | |
echo $wl_iwctxt | $wl_awkcmd '{print $6""$7,$12""$13" "}' |
echo $wl_iwctxt | $wl_awkcmd '{print $6,$11" "}' | |
else |
else | |
echo $wl_iwctxt | $wl_awkcmd '{print $6""$7,$10,$12""$13" "}' |
echo $wl_iwctxt | $wl_awkcmd '{print $6,$9,$11" "}' | |
fi |
fi | |
else |
else | |
echo $wl_iwctxt | $wl_awkcmd '{print $1,$4,$5,$6""$7,$12""$13" "}' | sed 's/ [^": ]*:/ /g' |
echo $wl_iwctxt | $wl_awkcmd '{print $1,$4,$5,$6,$11" "}' | sed 's/ [^": ]*:/ /g' | |
fi |
fi | |
wl_numcl=`ls $wl_hostap$wl_iface | grep -c 00` |
wl_numcl=`ls $wl_hostap$wl_iface | grep -c 00` | |
echo $wlm_number_of_clients $wl_numcl |
echo $wlm_number_of_clients $wl_numcl | |
|
| |
wl_numcllast=$(($wl_numcllast + $wl_numcl)) |
wl_numcllast=$(($wl_numcllast + $wl_numcl)) | |
|
| |
for wl_mac in `ls $wl_hostap$wl_iface | grep 00 ` |
for wl_mac in `ls $wl_hostap$wl_iface | grep 00 ` | |
do |
do | |
wl_macparam=`cat $wl_hostap$wl_iface/$wl_mac | grep -E 'last_rx|last_tx' | sed 's/last_//g'` |
wl_macparam=`cat $wl_hostap$wl_iface/$wl_mac | grep -E 'last_rx|last_tx' | sed 's/last_//g'` | |
wl_jiffies=`cat $wl_hostap$wl_iface/$wl_mac | grep 'jiffies'` |
||
wl_signal=`echo $wl_macparam | $wl_awkcmd '{print $6}' | sed 's/signal=//g'` |
wl_signal=`echo $wl_macparam | $wl_awkcmd '{print $6}' | sed 's/signal=//g'` | |
wl_silence=`echo $wl_macparam | $wl_awkcmd '{print $4}' | sed 's/silence=//g'` |
wl_silence=`echo $wl_macparam | $wl_awkcmd '{print $4}' | sed 's/silence=//g'` | |
wl_rate=`echo $wl_macparam | $wl_awkcmd '{print $8}'` |
||
wl_cnt=$(($wl_signal - $wl_silence)) |
wl_cnt=$(($wl_signal - $wl_silence)) | |
wl_ipc=`cat $wl_arp | grep -i $wl_mac | $wl_awkcmd '{print $1}'` # IP adresa peeru z arp tabulky |
wl_ipc=`cat $wl_arp | grep -i $wl_mac | $wl_awkcmd '{print $1}'` # IP adresa peeru z arp tabulky | |
|
| |
wl_name=`cat $wl_dhcpcnf | grep -i $wl_mac | $wl_awkcmd '{print $2}'` |
wl_name=`cat $wl_dhcpcnf | grep -i $wl_mac | $wl_awkcmd '{print $2}'` | |
if [ "$wl_name" = "ethernet" ] || [ "$wl_name" = "" ] |
if [ "$wl_name" = "ethernet" ] || [ "$wl_name" = "" ] | |
then |
then | |
wl_name=`cat $wl_dhcpcnf | grep -i $wl_mac -B 1 | $wl_awkcmd '{print$2,$3}' | grep -i $wl_mac -v | $wl_awkcmd '{print$1}'` |
wl_name=`cat $wl_dhcpcnf | grep -i $wl_mac -B 1 | $wl_awkcmd '{print$2,$3}' | grep -i $wl_mac -v | $wl_awkcmd '{print$1}'` | |
if [ "$wl_name" = "" ] |
if [ "$wl_name" = "" ] | |
then |
then | |
wl_name=`cat $wl_dhcplss | grep -i $wl_mac -A 2 | $wl_awkcmd '{print$2,$3}' | grep -i $wl_mac -v | $wl_awkcmd '{print$1}'` |
wl_name=`cat $wl_dhcplss | grep -i $wl_mac -A 2 | grep -i client-hostname | $wl_awkcmd '{print$2}'` | |
wl_name=`echo $wl_name | $wl_awkcmd '{print$1}' ` |
wl_name=`echo $wl_name | $wl_awkcmd '{print$1}' ` | |
fi |
fi | |
fi |
fi | |
if [ $wcm_ppkts -eq 1 ] || [ $wcm_pkts -eq 1 ] |
if [ $wcm_ppkts -eq 1 ] || [ $wcm_pkts -eq 1 ] | |
then |
then | |
Line 341... | Line 338... | |
then |
then | |
echo "" |
echo "" | |
echo -n " " |
echo -n " " | |
fi |
fi | |
echo -n "Signal ${wlc_sig}$wl_cnt${wlc_std} " |
echo -n "Signal ${wlc_sig}$wl_cnt${wlc_std} " | |
echo -n "$wl_rate " |
||
if [ $wcm_rxtx -eq 0 ] |
if [ $wcm_rxtx -eq 0 ] | |
then |
then | |
echo "" |
echo "" | |
else |
else | |
echo $wl_macparam | $wl_awkcmd '{printf $1,$2" "}' |
echo $wl_macparam | $wl_awkcmd '{print $1,$2" "}' | |
echo " $wl_jiffies" |
||
fi |
fi | |
w_bar |
w_bar | |
else |
else | |
if [ $wcm_macoff -eq 0 ] |
if [ $wcm_macoff -eq 0 ] | |
then |
then | |
echo -n "${wlc_mac}$wl_mac${wlc_std} " |
echo -n "${wlc_mac}$wl_mac${wlc_std} " | |
fi |
fi | |
echo -n "${wlc_sig}$wl_cnt${wlc_std} " |
echo -n "${wlc_sig}$wl_cnt${wlc_std} " | |
echo -n "$wl_name" |
echo -n "$wl_name " | |
w_bar |
w_bar | |
fi |
fi | |
done |
done | |
|
| |
echo |
echo |