jablonka.czprosek.czf

wifimon

Subversion Repositories:
[/] [trunk/] [wifimon] - Diff between revs 28 and 29

Show entire file Ignore whitespace

Rev 28 Rev 29
Line 2... Line 2...
# authors : Petr Simandl www.simandl.cz # authors : Petr Simandl www.simandl.cz
# : Fyzik, Covex, Tydyt, Thunder.m # : Fyzik, Covex, Tydyt, Thunder.m
# release date : 20/03/2006 # release date : 06/04/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.7pre2" wl_version="0.5.7pre4"
   
###################################################################### ######################################################################
#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
   
wl_wlancf=`which wlanconfig` wl_wlancf=`which wlanconfig`
wl_iwccmd=`which iwconfig` wl_iwccmd=`which iwconfig`
wl_iwlcmd=`which iwlist` wl_iwlcmd=`which iwlist`
wl_ifccmd=`which ifconfig` wl_ifccmd=`which ifconfig`
Line 136... Line 136...
then then
wlf_madwifi=1 wlf_madwifi=1
else else
# echo "${wl_sysdev}ath0 not found" # echo "${wl_sysdev}ath0 not found"
wlf_madwifi=0 wlf_madwifi=0
  fi
   
  wlf_wlancf=1
  if [ "$wl_wlancf x" = " x" ]
  then
  wlf_wlancf=0
  # echo "wlanconfig not found"
  # exit 1
fi fi
   
if [ "$wlf_hostap" -eq 0 ] && [ "$wlf_madwifi" -eq 0 ] if [ "$wlf_hostap" -eq 0 ] && [ "$wlf_madwifi" -eq 0 ]
then then
echo "${wl_hostap}wlan0 not found" echo "${wl_hostap}wlan0 not found"
echo "${wl_sysdev}ath0 not found" echo "${wl_sysdev}ath0 not found"
exit 1 exit 1
fi fi
   
   
###################################################################### ######################################################################
# procedures # procedures
###################################################################### ######################################################################
w_col() w_col()
Line 333... Line 342...
{ 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,$12" "}' echo $wl_iwctxt | $wl_awkcmd '{print $6,$10,$11,$12" "}'
else else
echo $wl_iwctxt | $wl_awkcmd '{print $6,$8,$11,$12" "}' echo $wl_iwctxt | $wl_awkcmd '{print $6,$8,$10,$11,$12" "}'
fi fi
else else
echo $wl_iwctxt | $wl_awkcmd '{print $1,$4,$5,$6,$11,$12" "}' | sed 's/ [^": ]*:/ /g' echo $wl_iwctxt | $wl_awkcmd '{print $1,$4,$5,$6,$11,$12" "}' | sed 's/ [^": ]*:/ /g'
fi fi
   
Line 354... Line 363...
wl_numcl=`$wl_wlancf $wl_iface list sta | grep -c ^[0..9]` wl_numcl=`$wl_wlancf $wl_iface list sta | grep -c ^[0..9]`
# wl_numcl=`cat $wl_madwifi$wl_iface/associated_sta | grep -c macaddr` # wl_numcl=`cat $wl_madwifi$wl_iface/associated_sta | grep -c macaddr`
# wl_macs=`cat $wl_madwifi$wl_iface/associated_sta | tr "<" "#" | tr ">" "#" | tr " " "#" | tr "\n" "#" | tr "m" "\n" ` # wl_macs=`cat $wl_madwifi$wl_iface/associated_sta | tr "<" "#" | tr ">" "#" | tr " " "#" | tr "\n" "#" | tr "m" "\n" `
wl_macs=`$wl_wlancf $wl_iface list sta | grep ^[0..9] | tr " " "#"` wl_macs=`$wl_wlancf $wl_iface list sta | grep ^[0..9] | tr " " "#"`
fi fi
   
  if [ -d $wl_sysdev$wl_iface ]
  then
  wl_numcl=`$wl_iwlcmd $wl_iface peers | grep -c 00`
  wl_macs=`iwlist $wl_iface peers | grep 00 | awk '{print $1}'`
  fi
   
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 $wl_macs for wl_mac in $wl_macs
Line 374... Line 390...
wl_signal=`echo $wl_mac | tr "#" " " | $wl_awkcmd '{print $5}'` wl_signal=`echo $wl_mac | tr "#" " " | $wl_awkcmd '{print $5}'`
wl_rxtx=`echo $wl_mac | tr "#" " " | $wl_awkcmd '{print "rate="$4" tx="$8" rx="$9}'` wl_rxtx=`echo $wl_mac | tr "#" " " | $wl_awkcmd '{print "rate="$4" tx="$8" rx="$9}'`
wl_silence="0" wl_silence="0"
wl_mac=`echo $wl_mac | tr "#" " " | $wl_awkcmd '{print $1}'` wl_mac=`echo $wl_mac | tr "#" " " | $wl_awkcmd '{print $1}'`
fi fi
   
  if [ -d $wl_sysdev$wl_iface ]
  then
  wl_macparam=`$wl_iwlcmd $wl_iface peers | grep $wl_mac`
  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'`
  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
   
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" = "" ]
Line 584... Line 608...
if [ "a$wl_unknown" != "a" ] if [ "a$wl_unknown" != "a" ]
then then
echo "$wlm_unknown $wl_unknown" echo "$wlm_unknown $wl_unknown"
w_help w_help
fi fi
   
# if no interface is selected then all available are choosen # if no interface is selected then all available are choosen
if [ "a$wcm_ifc" = "a" ] if [ "a$wcm_ifc" = "a" ]
then then
if [ $wlf_hostap -eq 1 ] if [ $wlf_hostap -eq 1 ]
then then
wcm_ifc=`ls $wl_hostap ` wcm_ifc=`ls $wl_hostap `
fi fi
if [ $wlf_madwifi -eq 1 ] if [ $wlf_madwifi -eq 1 ]
then then
wcm_ifc=`echo $wcm_ifc ; ls $wl_madwifi | grep "ath[0-9]"` wcm_ifc=`echo $wcm_ifc ; ls $wl_sysdev | grep "ath[0-9]" ; ls $wl_madwifi | grep "ath[0-9]"`
fi fi
fi fi
   
# setting for old and last same value to avoid double clear after start # setting for old and last same value to avoid double clear after start
wl_numcllast=0 wl_numcllast=0
Line 616... Line 641...
then then
wl_numcl=`$wl_wlancf $wl_iface list sta | grep -c ^[0..9]` wl_numcl=`$wl_wlancf $wl_iface list sta | grep -c ^[0..9]`
wl_numcllast=$(($wl_numcllast + $wl_numcl)) wl_numcllast=$(($wl_numcllast + $wl_numcl))
fi fi
fi fi
  if [ -d $wl_sysdev$wl_iface ]
  then
  wl_mode=`$wl_iwccmd $wl_iface | grep Mode | $wl_awkcmd '{print $1}' | sed 's/Mode://g'`
  if [ "a$wl_mode" = "aMaster" ]
  then
  wl_numcl=`$wl_iwlcmd $wl_iface peers | grep -c 00`
  wl_numcllast=$(($wl_numcllast + $wl_numcl))
  fi
  fi
   
done done
wl_numclold=$wl_numcllast wl_numclold=$wl_numcllast
   
if [ $wcm_col -eq 0 ] if [ $wcm_col -eq 0 ]
then then

Powered by WebSVN 2.2.1