Rev 14 |
|
Rev 15 |
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.0" |
|
wl_version="0.5.2" |
|
|
|
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_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 88... |
|
Line 90... |
else |
|
else |
echo "$wl_dhcplss not found" |
|
echo "$wl_dhcplss not found" |
wl_dhcplss="/dev/null" |
|
wl_dhcplss="/dev/null" |
fi |
|
fi |
|
|
|
wl_header_refresh="<html><head><meta HTTP-EQUIV=\"Refresh\" CONTENT=\"3\"><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>" |
|
wl_header_refresh="<html><head><meta HTTP-EQUIV=\"Refresh\" CONTENT=\"15\"><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>" |
wl_header="<html><head><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>" |
|
wl_header="<html><head><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>" |
wl_footer="</pre></body></html>" |
|
wl_footer="</pre></body></html>" |
|
|
|
wlm_no_managed_or_master=" neni ani Master ani Managed..." |
|
wlm_no_managed_or_master=" neni ani Master ani Managed..." |
wlm_number_of_clients="Pocet asociovanych klientu : " |
|
wlm_number_of_clients="Pocet asociovanych klientu : " |
Line 104... |
|
Line 106... |
wlch_noise="*" |
|
wlch_noise="*" |
|
|
|
###################################################################### |
|
###################################################################### |
w_col() |
|
w_col() |
{ |
|
{ |
wlc_red=`tput setaf 1` |
|
wlc_red=`tput setaf 1` # ruda (Red) |
wlc_green=`tput setaf 2` |
|
wlc_green=`tput setaf 2` # zelena (Lime) |
wlc_brown=`tput setaf 3` |
|
wlc_brown=`tput setaf 3` # zluta (Yellow) |
wlc_blue=`tput setaf 4` |
|
wlc_blue=`tput setaf 4` # modra (Blue) |
wlc_magenta=`tput setaf 5` |
|
wlc_magenta=`tput setaf 5` # fialova (Fuchsia) |
wlc_lblue=`tput setaf 6` |
|
wlc_lblue=`tput setaf 6` # svetle modra (Aqua) |
wlc_grey=`tput setaf 7` |
|
wlc_grey=`tput setaf 7` # bila (White) |
wlc_std=`tput sgr0` |
|
wlc_std=`tput sgr0` |
|
|
|
|
|
wlc_pkts=$wlc_red # Rx,Tx info color |
wlc_ip=$wlc_lblue # ip address color |
|
wlc_ip=$wlc_lblue # ip address color |
wlc_mac=$wlc_magenta # mac address color |
|
wlc_mac=$wlc_magenta # mac address color |
|
|
wlc_name=$wlc_magenta # host name color |
wlc_sig=$wlc_red # signal number color |
|
wlc_sig=$wlc_red # signal number color |
wlc_bar=$wlc_green # signal bar color |
|
wlc_bar=$wlc_green # signal bar color |
|
|
wlc_noise=$wlc_red # Signal noise color |
|
|
} |
|
|
###################################################################### |
|
|
w_colh() |
|
|
{ |
|
|
wlh_pkts="Olive" # signal number color html |
|
|
wlh_ip="Blue" # ip address color html |
|
|
wlh_mac="Fuchsia" # mac address color html |
|
|
wlh_name="Fuchsia" # Host name color html |
|
|
wlh_sig="Red" # signal number color html |
|
|
wlh_bar="Lime" # signal bar color html |
|
|
wlh_noise="Red" # Signal noise color html |
|
|
|
|
|
wlc_pkts="<font color=\"$wlh_pkts\">" |
|
|
wlc_ip="<font color=\"$wlh_ip\">" |
|
|
wlc_mac="<font color=\"$wlh_mac\">" |
|
|
wlc_name="<font color=\"$wlh_name\">" |
|
|
wlc_sig="<font color=\"$wlh_sig\">" |
|
|
wlc_bar="<font color=\"$wlh_bar\">" |
|
|
wlc_noise="<font color=\"$wlh_noise\">" |
|
|
wlc_std="</font>" |
} |
|
} |
###################################################################### |
|
###################################################################### |
w_bw() |
|
w_bw() |
{ |
|
{ |
|
|
wlc_pkts="" |
wlc_ip="" |
|
wlc_ip="" |
wlc_mac="" |
|
wlc_mac="" |
wlc_sig="" |
|
wlc_sig="" |
wlc_bar="" |
|
wlc_bar="" |
|
|
wlc_noise="" |
wlc_std="" |
|
wlc_std="" |
} |
|
} |
###################################################################### |
|
###################################################################### |
w_bar() |
|
w_bar() |
{ |
|
{ |
echo -n "${wlc_bar}" |
|
|
wl_neg=`expr $wl_cnt \< 0 ` |
|
wl_neg=`expr $wl_cnt \< 0 ` |
if [ "$wl_neg" -eq 1 ] |
|
if [ "$wl_neg" -eq 1 ] |
then |
|
then |
|
|
echo -n "${wlc_noise}" |
wl_cnt=$(($wl_cnt * -1 )) |
|
wl_cnt=$(($wl_cnt * -1 )) |
wl_bar=$wlch_noise |
|
wl_bar=$wlch_noise |
else |
|
else |
|
|
echo -n "${wlc_bar}" |
wl_bar=$wlch_signal |
|
wl_bar=$wlch_signal |
fi |
|
fi |
until [ "$wl_cnt" -eq -1 ] |
|
until [ "$wl_cnt" -eq -1 ] |
do |
|
do |
echo -n "$wl_bar" |
|
echo -n "$wl_bar" |
Line 223... |
|
Line 251... |
wl_nr11n="00" |
|
wl_nr11n="00" |
else |
|
else |
wl_nr11n=$(($wl_pksize * $wl_nr11 / $wl_nr + 1)) |
|
wl_nr11n=$(($wl_pksize * $wl_nr11 / $wl_nr + 1)) |
[ "$wl_nr11n" -lt 10 ] && wl_nr11n="0"$wl_nr11n |
|
[ "$wl_nr11n" -lt 10 ] && wl_nr11n="0"$wl_nr11n |
fi |
|
fi |
echo -n "Tx" $wl_nt1n $wl_nt2n $wl_nt5n $wl_nt11n "Rx" $wl_nr1n $wl_nr2n $wl_nr5n $wl_nr11n "" |
|
echo -n "Tx"${wlc_pkts} $wl_nt1n $wl_nt2n $wl_nt5n $wl_nt11n ${wlc_std}"" |
|
|
echo -n "Rx"${wlc_pkts} $wl_nr1n $wl_nr2n $wl_nr5n $wl_nr11n ${wlc_std}"" |
fi |
|
fi |
|
|
|
[ $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 |
echo $wl_iwctxt | $wl_awkcmd '{print $9,$6,$11" "}' |
|
|
|
|
if [ $wcm_macoff -eq 1 ] |
|
|
then |
|
|
echo $wl_iwctxt | $wl_awkcmd '{print $6,$11" "}' |
|
|
else |
|
|
echo $wl_iwctxt | $wl_awkcmd '{print $9,$6,$11" "}' |
|
|
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}'` |
wl_signal=$(($wl_signal - 256)) |
|
wl_signal=$(($wl_signal - 256)) |
wl_noise=`echo $wl_wtxt | $wl_awkcmd '{print $3}'` |
|
wl_noise=`echo $wl_wtxt | $wl_awkcmd '{print $3}'` |
Line 251... |
|
Line 287... |
###################################################################### |
|
###################################################################### |
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" "}' |
echo $wl_iwctxt | $wl_awkcmd '{print $6,$9,$11" "}' |
|
if [ $wcm_macoff -eq 1 ] |
|
|
then |
|
|
echo $wl_iwctxt | $wl_awkcmd '{print $6,$11" "}' |
|
|
else |
|
|
echo $wl_iwctxt | $wl_awkcmd '{print $6,$9,$11" "}' |
|
|
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" "}' | 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)) |
|
|
|
Line 286... |
|
Line 326... |
w_pkts |
|
w_pkts |
fi |
|
fi |
|
|
|
if [ $wcm_oneline -eq 0 ] |
|
if [ $wcm_oneline -eq 0 ] |
then |
|
then |
echo -n "$wl_name " |
|
echo -n "${wlc_name}$wl_name${wlc_std} " |
echo -n "${wlc_ip}$wl_ipc${wlc_std} " |
|
echo -n "${wlc_ip}$wl_ipc${wlc_std} " |
echo -n "${wlc_mac}$wl_mac${wlc_std} Signal ${wlc_sig}$wl_cnt${wlc_std} " |
|
if [ $wcm_macoff -eq 0 ] |
echo $wl_macparam | $wl_awkcmd '{print $1,$2" "}' |
|
then |
|
|
echo -n "${wlc_mac}$wl_mac${wlc_std} " |
|
|
fi |
|
|
if [ $wcm_threeline -eq 1 ] |
|
|
then |
|
|
echo "" |
|
|
echo -n " " |
|
|
fi |
|
|
echo -n "Signal ${wlc_sig}$wl_cnt${wlc_std} " |
|
|
if [ $wcm_rxtx -eq 0 ] |
|
|
then |
|
|
echo "" |
|
|
else |
|
|
echo $wl_macparam | $wl_awkcmd '{print $1,$2" "}' |
|
|
fi |
w_bar |
|
w_bar |
else |
|
else |
|
|
if [ $wcm_macoff -eq 0 ] |
|
|
then |
|
|
echo -n "${wlc_mac}$wl_mac${wlc_std} " |
|
|
fi |
|
|
echo -n "${wlc_sig}$wl_cnt${wlc_std} " |
echo -n "$wl_name " |
|
echo -n "$wl_name " |
echo -n "${wlc_mac}$wl_mac${wlc_std} ${wlc_sig}$wl_cnt${wlc_std} " |
|
|
w_bar |
|
w_bar |
fi |
|
fi |
done |
|
done |
|
|
|
echo |
|
echo |
Line 336... |
|
Line 394... |
echo -v vypise verzi |
|
echo -v vypise verzi |
echo -html generovani html stranky |
|
echo -html generovani html stranky |
echo -col barevny vypis na obrazovku |
|
echo -col barevny vypis na obrazovku |
echo -once vypsani jen jednoho vypisu a pak program skonci |
|
echo -once vypsani jen jednoho vypisu a pak program skonci |
echo -oneline vypsani klientu na jednu linku |
|
echo -oneline vypsani klientu na jednu linku |
|
|
echo -threeline vypsani klienta na trech radcich |
|
|
echo -rxtxoff vypnuti zobrazeni objemu prenesenych dat klienta |
|
|
echo -macoff vypnuti zobrazeni MAC adres |
echo -ppkts vypsani procentniho pomeru 1M, 2M, 5.5M a 11M paketu pro jednotlive klienty |
|
echo -ppkts vypsani procentniho pomeru 1M, 2M, 5.5M a 11M paketu pro jednotlive klienty |
echo -pkts vypsani poctu 1M, 2M, 5.5M a 11M paketu pro jednotlive klienty |
|
echo -pkts vypsani poctu 1M, 2M, 5.5M a 11M paketu pro jednotlive klienty |
echo -wlan0 -wlan1 -wlan2 vypise jen uvedene karty a to v danem poctu a poradi |
|
echo -wlan0 -wlan1 -wlan2 vypise jen uvedene karty a to v danem poctu a poradi |
echo bez parametru cyklicky vypis na obrazovku |
|
echo bez parametru cyklicky vypis na obrazovku |
exit 0 |
|
exit 0 |
Line 351... |
|
Line 412... |
wl_cnt=1 |
|
wl_cnt=1 |
wcm_clear=1 |
|
wcm_clear=1 |
wcm_once=0 |
|
wcm_once=0 |
wcm_col=0 |
|
wcm_col=0 |
wcm_oneline=0 |
|
wcm_oneline=0 |
|
|
wcm_threeline=0 |
wcm_html=0 |
|
wcm_html=0 |
|
|
wcm_rxtx=1 |
wcm_ppkts=0 |
|
wcm_ppkts=0 |
wcm_pkts=0 |
|
wcm_pkts=0 |
wcm_ifc="" |
|
wcm_ifc="" |
|
|
wcm_macoff=0 |
|
|
|
# parsing input parameters |
|
# parsing input parameters |
while [ "a$1" != "a" ] |
|
while [ "a$1" != "a" ] |
do |
|
do |
case $1 in |
|
case $1 in |
Line 372... |
|
Line 436... |
wcm_once=1 |
|
wcm_once=1 |
shift |
|
shift |
;; |
|
;; |
-oneline) |
|
-oneline) |
wcm_oneline=1 |
|
wcm_oneline=1 |
|
|
shift |
|
|
;; |
|
|
-threeline) |
|
|
wcm_threeline=1 |
shift |
|
shift |
;; |
|
;; |
-col) |
|
-col) |
wcm_col=1 |
|
wcm_col=1 |
shift |
|
shift |
;; |
|
;; |
-html) |
|
-html) |
wcm_html=1 |
|
wcm_html=1 |
|
|
shift |
|
|
;; |
|
|
-rxtxoff) |
|
|
wcm_rxtx=0 |
shift |
|
shift |
;; |
|
;; |
-ppkts) |
|
-ppkts) |
wcm_ppkts=1 |
|
wcm_ppkts=1 |
shift |
|
shift |
;; |
|
;; |
-pkts) |
|
-pkts) |
wcm_pkts=1 |
|
wcm_pkts=1 |
|
|
shift |
|
|
;; |
|
|
-macoff) |
|
|
wcm_macoff=1 |
shift |
|
shift |
;; |
|
;; |
*) |
|
*) |
wl_flg=0 |
|
wl_flg=0 |
for wl_iface in `ls $wl_hostap` |
|
for wl_iface in `ls $wl_hostap` |
Line 435... |
|
Line 511... |
|
|
|
if [ $wcm_col -eq 0 ] |
|
if [ $wcm_col -eq 0 ] |
then |
|
then |
w_bw |
|
w_bw |
else |
|
else |
w_col |
|
if [ $wcm_html -eq 1 ] |
|
|
then |
|
|
w_colh |
|
|
else |
|
|
w_col |
|
|
fi |
fi |
|
fi |
|
|
|
if [ $wcm_html -eq 1 ] |
|
if [ $wcm_html -eq 1 ] |
then |
|
then |
w_bw |
|
|
[ $wcm_once -eq 1 ] && echo $wl_header || echo $wl_header_refresh |
|
[ $wcm_once -eq 1 ] && echo $wl_header || echo $wl_header_refresh |
for wl_iface in $wcm_ifc |
|
for wl_iface in $wcm_ifc |
do |
|
do |
w_iface |
|
w_iface |
done |
|
done |
echo $wl_footer |
|
echo $wl_footer |
exit 0 |
|
exit 0 |
fi |
|
fi |
|
|
|
#this is main loop and it will be executer forever |
|
#this is main loop and it will be executed forever |
while [ 1 ] |
|
while [ 1 ] |
do |
|
do |
|
|
|
# when the number of associated klients has changed we will set for clear screen |
|
# when the number of associated klients has changed we will set for clear screen |
if [ $wl_numcllast -ne $wl_numclold ] |
|
if [ $wl_numcllast -ne $wl_numclold ] |