wifimon |
Subversion Repositories: |
Rev 26 | Rev 27 | |
---|---|---|
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 : 21/09/2005 |
# release date : 17/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.6pre3" |
wl_version="0.5.7pre1" | |
|
| |
###################################################################### |
###################################################################### | |
#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 23... | Line 23... | |
wl_tptcmde="[1;1H" |
wl_tptcmde="[1;1H" | |
wl_clrcmde="[H[2J" |
wl_clrcmde="[H[2J" | |
|
| |
wl_sysdev="/proc/sys/dev/" |
wl_sysdev="/proc/sys/dev/" | |
wl_hostap="/proc/net/hostap/" |
wl_hostap="/proc/net/hostap/" | |
wl_madwifi="/proc/net/madwifi/" | ||
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" | |
Line 128... | Line 129... | |
else |
else | |
# echo "${wl_hostap}wlan0 not found" |
# echo "${wl_hostap}wlan0 not found" | |
wlf_hostap=0 |
wlf_hostap=0 | |
fi |
fi | |
|
| |
if [ -d ${wl_sysdev}ath0 ] |
if [ -d ${wl_sysdev}ath ] | |
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 | |
Line 345... | Line 346... | |
then |
then | |
wl_numcl=`ls $wl_hostap$wl_iface | grep -c 00` |
wl_numcl=`ls $wl_hostap$wl_iface | grep -c 00` | |
wl_macs=`ls $wl_hostap$wl_iface | grep 00` |
wl_macs=`ls $wl_hostap$wl_iface | grep 00` | |
fi |
fi | |
|
| |
if [ -d $wl_sysdev$wl_iface ] |
if [ -d $wl_madwifi$wl_iface ] | |
then |
then | |
wl_numcl=`$wl_iwlcmd $wl_iface peers | grep -c 00` |
wl_numcl=`cat $wl_madwifi$wl_iface/associated_sta | grep -c macaddr` | |
wl_macs=`iwlist $wl_iface peers | grep 00 | awk '{print $1}'` |
wl_macs=`cat $wl_madwifi$wl_iface/associated_sta | tr "<" "#" | tr ">" "#" | tr " " "#" | tr "\n" "#" | tr "m" "\n" ` | |
fi |
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)) | |
Line 364... | Line 365... | |
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_madwifi$wl_iface ] | |
then |
then | |
wl_macparam=`$wl_iwlcmd $wl_iface peers | grep $wl_mac` |
wl_signal=`echo $wl_mac | $wl_awkcmd -F "#" '{print $7}'` | |
wl_signal=`echo $wl_macparam | $wl_awkcmd '{print $5}' | sed 's/level[=|:]//g'` |
wl_silence="0" | |
wl_silence=`echo $wl_macparam | $wl_awkcmd '{print $8}' | sed 's/level[=|:]//g'` |
wl_mac=`echo $wl_mac | $wl_awkcmd -F "#" '{print $3}'` | |
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 | |
|
| |
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 555... | Line 556... | |
done |
done | |
fi |
fi | |
# ath check |
# ath check | |
if [ $wlf_madwifi -eq 1 ] |
if [ $wlf_madwifi -eq 1 ] | |
then |
then | |
for wl_iface in `ls $wl_sysdev | grep "ath[0-9]"` |
for wl_iface in `ls $wl_madwifi | grep "ath[0-9]"` | |
do |
do | |
if [ "a-$wl_iface" = "a$1" ] |
if [ "a-$wl_iface" = "a$1" ] | |
then |
then | |
wcm_ifc="$wcm_ifc $wl_iface" |
wcm_ifc="$wcm_ifc $wl_iface" | |
wl_flg=1 |
wl_flg=1 | |
Line 587... | Line 588... | |
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_sysdev | grep "ath[0-9]"` |
wcm_ifc=`echo $wcm_ifc ; 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 601... | Line 602... | |
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` | |
wl_numcllast=$(($wl_numcllast + $wl_numcl)) |
wl_numcllast=$(($wl_numcllast + $wl_numcl)) | |
fi |
fi | |
if [ -d $wl_sysdev$wl_iface ] |
if [ -d $wl_madwifi$wl_iface ] | |
then |
then | |
wl_mode=`$wl_iwccmd $wl_iface | grep Mode | $wl_awkcmd '{print $1}' | sed 's/Mode://g'` |
wl_mode=`$wl_iwccmd $wl_iface | grep Mode | $wl_awkcmd '{print $1}' | sed 's/Mode://g'` | |
if [ "a$wl_mode" = "aMaster" ] |
if [ "a$wl_mode" = "aMaster" ] | |
then |
then | |
wl_numcl=`$wl_iwlcmd $wl_iface peers | grep -c 00` |
wl_numcl=`cat $wl_madwifi$wl_iface/associated_sta | grep -c macaddr` | |
wl_numcllast=$(($wl_numcllast + $wl_numcl)) |
wl_numcllast=$(($wl_numcllast + $wl_numcl)) | |
fi |
fi | |
fi |
fi | |
done |
done | |
wl_numclold=$wl_numcllast |
wl_numclold=$wl_numcllast |