Rev 21 |
|
Rev 22 |
Line 1... |
|
Line 1... |
#!/bin/bash |
|
#!/bin/bash |
# authors : Petr Simandl www.simandl.cz |
|
# authors : Petr Simandl www.simandl.cz |
# : Fyzik, Covex, Tydyt |
|
# : Fyzik, Covex, Tydyt, Thunder.m |
# release date : 11/09/2005 |
|
# release date : 16/03/2006 |
# name : wifimon |
|
# name : wifimon |
# description : hostap and madwifi powered card monitoring |
|
# description : hostap and madwifi powered card monitoring |
# license : GPL |
|
# license : GPL |
###################################################################### |
|
###################################################################### |
|
|
|
wl_version="0.5.5pre5" |
|
wl_version="0.5.6" |
|
|
|
###################################################################### |
|
###################################################################### |
#custom settings |
|
#custom settings |
|
|
|
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 |
Line 92... |
|
Line 92... |
else |
|
else |
echo "$wl_arp not found" |
|
echo "$wl_arp not found" |
exit 1 |
|
exit 1 |
fi |
|
fi |
|
|
|
|
|
#dhcp support |
|
|
#if not found trying to set alternative location |
|
|
if [ ! -f $wl_dhcpcnf ]; then |
|
|
wl_dhcpcnf="/etc/dhcp3/dhcpd.conf" |
|
|
fi |
|
|
|
|
|
if [ ! -f $wl_dhcplss ]; then |
|
|
wl_dhcplss="/var/lib/dhcp3/dhcpd.leases" |
|
|
fi |
|
|
|
|
|
#if not found a message is printed and /dev/null is used instead |
if [ -e $wl_dhcpcnf ] |
|
if [ -e $wl_dhcpcnf ] |
then |
|
then |
wl_nop=1 |
|
wl_nop=1 |
else |
|
else |
echo "$wl_dhcpcnf not found" |
|
echo "$wl_dhcpcnf not found" |
Line 296... |
|
Line 307... |
{ 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 0 ] |
|
if [ $wcm_macoff -eq 0 ] |
then |
|
then |
wl_mac=`echo -n $wl_iwctxt | $wl_awkcmd '{print $9}'` |
|
wl_mac=`echo -n $wl_iwctxt | $wl_awkcmd '{print $8}'` |
echo -n "${wlc_mac}$wl_mac${wlc_std} " |
|
echo -n "${wlc_mac}$wl_mac${wlc_std} " |
fi |
|
fi |
echo $wl_iwctxt | $wl_awkcmd '{print $6,$10" "}' |
|
echo $wl_iwctxt | $wl_awkcmd '{print $6,$10,$11,$12" "}' |
|
|
|
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}'` |
wl_signal=$(($wl_signal - 256)) |
|
wl_signal=$(($wl_signal - 256)) |
Line 320... |
|
Line 331... |
{ 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,$11" "}' |
|
echo $wl_iwctxt | $wl_awkcmd '{print $6,$11,$12" "}' |
else |
|
else |
echo $wl_iwctxt | $wl_awkcmd '{print $6,$9,$11" "}' |
|
echo $wl_iwctxt | $wl_awkcmd '{print $6,$8,$11,$12" "}' |
fi |
|
fi |
else |
|
else |
echo $wl_iwctxt | $wl_awkcmd '{print $1,$4,$5,$6,$11" "}' | sed 's/ [^": ]*:/ /g' |
|
echo $wl_iwctxt | $wl_awkcmd '{print $1,$4,$5,$6,$11,$12" "}' | sed 's/ [^": ]*:/ /g' |
fi |
|
fi |
|
|
|
if [ -d $wl_hostap$wl_iface ] |
|
if [ -d $wl_hostap$wl_iface ] |
then |
|
then |
wl_numcl=`ls $wl_hostap$wl_iface | grep -c 00` |
|
wl_numcl=`ls $wl_hostap$wl_iface | grep -c 00` |
Line 349... |
|
Line 360... |
for wl_mac in $wl_macs |
|
for wl_mac in $wl_macs |
do |
|
do |
if [ -d $wl_hostap$wl_iface ] |
|
if [ -d $wl_hostap$wl_iface ] |
then |
|
then |
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_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'` |
fi |
|
fi |
|
|
|
if [ -d $wl_sysdev$wl_iface ] |
|
if [ -d $wl_sysdev$wl_iface ] |
then |
|
then |
wl_macparam=`$wl_iwlcmd $wl_iface peers | grep $wl_mac` |
|
wl_macparam=`$wl_iwlcmd $wl_iface peers | grep $wl_mac` |
wl_signal=`echo $wl_macparam | $wl_awkcmd '{print $5}' | sed 's/level://g'` |
|
wl_signal=`echo $wl_macparam | $wl_awkcmd '{print $5}' | sed 's/level[=|:]//g'` |
wl_silence=`echo $wl_macparam | $wl_awkcmd '{print $8}' | sed 's/level://g'` |
|
wl_silence=`echo $wl_macparam | $wl_awkcmd '{print $8}' | sed 's/level[=|:]//g'` |
fi |
|
fi |
|
|
|
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 |
|
|
|
Line 420... |
|
Line 431... |
echo |
|
echo |
} # w_master |
|
} # w_master |
|
|
|
###################################################################### |
|
###################################################################### |
w_iface() |
|
w_iface() |
{ wl_iwctxt=`$wl_iwccmd $wl_iface 2>/dev/null | grep -v 'Device|Some|Extension' | sed 's/ Nick/_Nick/' | sed 's/Access Point/Access_Point/'` |
|
{ wl_iwctxt=`$wl_iwccmd $wl_iface 2>/dev/null | grep -v 'Device|Some|Extension' | sed 's/ dBm/dBm/' | sed 's/ GHz/GHz/' | sed 's/ Mb/Mb/' | sed 's/ Nick/_Nick/' | sed 's/Access Point/Access_Point/'` |
wl_mode=`echo $wl_iwctxt | $wl_awkcmd '{print $5}' | sed 's/Mode://g'` |
|
wl_mode=`echo $wl_iwctxt | $wl_awkcmd '{print $5}' | sed 's/Mode://g'` |
if [ "a$wl_mode" = "aManaged" ] |
|
if [ "a$wl_mode" = "aManaged" ] |
then |
|
then |
w_managed |
|
w_managed |
elif [ "a$wl_mode" = "aAd-Hoc" ] |
|
elif [ "a$wl_mode" = "aAd-Hoc" ] |