wifimon |
Subversion Repositories: |
Rev 4 | Rev 5 | |
---|---|---|
Line 2... | Line 2... | |
# authors : Petr Simandl www.simandl.cz |
# authors : Petr Simandl www.simandl.cz | |
# : Fyzik |
# : Fyzik | |
# release date : 6/1/2003 |
# release date : 22/1/2003 | |
# name : wifimon |
# name : wifimon | |
# version : 0.2 beta 2 |
# version : 0.3 | |
# description : hostap powered wifi card monitoring |
# description : hostap powered wifi card monitoring | |
# license : GPL |
# license : GPL | |
|
| |
wl_iwccmd="/usr/local/sbin/iwconfig" |
wl_iwccmd="/usr/local/sbin/iwconfig" | |
wl_ifccmd="/sbin/ifconfig" |
wl_ifccmd="/sbin/ifconfig" | |
Line 27... | Line 27... | |
wlc_mac=$wlc_magenta # mac address color |
wlc_mac=$wlc_magenta # mac address 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 | |
|
| |
wl_webpage="/tmp/wifimon.htm" |
wl_webpage="/tmp/wifimon.htm" | |
wl_header="<html><head><meta HTTP-EQUIV=\"Refresh\" CONTENT=\"1\"><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>" |
wl_header="<html><head><meta HTTP-EQUIV=\"Refresh\" CONTENT=\"3\"><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>" | |
wl_header_static="<html><head><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>" |
wl_header_static="<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 : " | |
wlm_unknown="Nezname parametry nebo neplatne jmeno rozhrani : " | ||
#wlm_no_managed_or_master=" is not Master or Managed..." |
#wlm_no_managed_or_master=" is not Master or Managed..." | |
#wlm_number_of_clients="Number of associated clients : " |
#wlm_number_of_clients="Number of associated clients : " | |
|
| |
###################################################################### |
###################################################################### | |
w_bw() |
w_bw() | |
Line 70... | Line 71... | |
wl_quality=`echo $wl_wtxt | awk '{print $1}'` |
wl_quality=`echo $wl_wtxt | awk '{print $1}'` | |
wl_signal=`echo $wl_wtxt | awk '{print $2}'` |
wl_signal=`echo $wl_wtxt | awk '{print $2}'` | |
wl_signal=$(($wl_signal - 256)) |
wl_signal=$(($wl_signal - 256)) | |
wl_noise=`echo $wl_wtxt | awk '{print $3}'` |
wl_noise=`echo $wl_wtxt | awk '{print $3}'` | |
wl_noise=$(($wl_noise - 256)) |
wl_noise=$(($wl_noise - 256)) | |
echo "Quality:${wlc_sig}$wl_quality${wlc_std}/92 Signal level:$wl_signal Noise level:$wl_noise" |
echo "Quality:${wlc_sig}$wl_quality${wlc_std}/92 Signal level:$wl_signal Noise level:$wl_noise " | |
wl_cnt=$wl_quality |
wl_cnt=$wl_quality | |
w_bar |
w_bar | |
#wl_cnt=$(($wl_cnt + 100)) |
#wl_cnt=$(($wl_cnt + 100)) | |
#w_bar |
#w_bar | |
echo |
echo | |
} # w_managed |
} # w_managed | |
|
| |
###################################################################### |
###################################################################### | |
w_master() |
w_master() | |
{ echo $wl_iwctxt | awk '{print $1,$3,$4,$5" "}' |
{ if [ $wcm_oneline -eq 0 ] | |
echo $wl_iwctxt | awk '{print $6,$9,$11" "}' |
then | |
echo $wl_iwctxt | awk '{print $1,$3,$4,$5" "}' | ||
echo $wl_iwctxt | awk '{print $6,$9,$11" "}' | ||
else | ||
echo $wl_iwctxt | awk '{print $1,$4,$5,$6,$11" "}' | sed 's/ [^": ]*:/ /g' | ||
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)) | ||
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'` |
wl_macparam=`cat $wl_hostap$wl_iface/$wl_mac | grep -E 'last_rx|last_tx'` | |
wl_cnt=`echo $wl_macparam | awk '{print $5}' | sed 's/signal=//g'` |
wl_cnt=`echo $wl_macparam | awk '{print $5}' | sed 's/signal=//g'` | |
wl_umac=`echo $wl_mac | tr abcdef ABCDEF` |
wl_umac=`echo $wl_mac | tr abcdef ABCDEF` | |
wl_ipc=`cat $wl_arp | grep $wl_umac | awk '{print $1}'` # IP adresa peeru z arp tabulky |
wl_ipc=`cat $wl_arp | grep $wl_umac | awk '{print $1}'` # IP adresa peeru z arp tabulky | |
echo -n "${wlc_ip}$wl_ipc${wlc_std} " |
if [ $wcm_oneline -eq 0 ] | |
echo -n "${wlc_mac}$wl_umac${wlc_std} Signal ${wlc_sig}$wl_cnt${wlc_std} " |
then | |
echo $wl_macparam | awk '{print $1,$2" "}' |
echo -n "${wlc_ip}$wl_ipc${wlc_std} " | |
w_bar |
echo -n "${wlc_mac}$wl_umac${wlc_std} Signal ${wlc_sig}$wl_cnt${wlc_std} " | |
echo $wl_macparam | awk '{print $1,$2" "}' | ||
w_bar | ||
else | ||
#echo -n "${wlc_ip}$wl_ipc${wlc_std} " | ||
echo -n "${wlc_mac}$wl_umac${wlc_std} ${wlc_sig}$wl_cnt${wlc_std} " | ||
#echo -n $wl_macparam | awk '{print $1,$2" "}' | ||
w_bar | ||
fi | ||
done |
done | |
|
| |
echo |
echo | |
} # w_master |
} # w_master | |
|
| |
Line 117... | Line 132... | |
echo |
echo | |
fi |
fi | |
} |
} | |
|
| |
###################################################################### |
###################################################################### | |
###################################################################### |
w_help() | |
|
{ | |
case $1 in |
||
-help) |
||
echo Pouziti: wifimon [param] |
echo Pouziti: wifimon [param] | |
echo param: |
echo param: | |
echo -htm cyklicke generovani stranky s 1s obnonovanim |
echo -html generovani html stranky | |
echo -htm1 jedna staticka stranka |
||
echo -col barevny cyklicky vypis na obrazovku |
echo -col barevny cyklicky vypis na obrazovku | |
echo -once vypsani jen jednoho vypisu a pak program skonci | ||
echo -oneline vypsani klientu na jednu linku | ||
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 | ||
} | ||
###################################################################### | ||
###################################################################### | ||
|
| |
| ||
wl_unknown="" | ||
wl_cnt=1 | ||
wl_numcllast=0 | ||
wl_numclold=0 | ||
wcm_clear=1 | ||
wcm_once=0 | ||
wcm_col=0 | ||
wcm_oneline=0 | ||
wcm_html=0 | ||
wcm_ifc="" | ||
| ||
while [ "a$1" != "a" ] | ||
do | ||
case $1 in | ||
-help) | ||
w_help | ||
;; | ||
-once) | ||
wcm_once=1 | ||
shift | ||
;; | ||
-oneline) | ||
wcm_oneline=1 | ||
shift | ||
;; | ||
-col) | ||
wcm_col=1 | ||
shift | ||
;; | ||
-html) | ||
wcm_html=1 | ||
shift | ||
;; | ||
*) | ||
wl_flg=0 | ||
for wl_iface in `ls $wl_hostap` | ||
do | ||
if [ "a-$wl_iface" = "a$1" ] | ||
then | ||
wcm_ifc="$wcm_ifc $wl_iface" | ||
wl_flg=1 | ||
fi | ||
done | ||
if [ $wl_flg -eq 0 ] | ||
then | ||
wl_unknown="$wl_unknown$1 " | ||
fi | ||
shift | ||
esac | ||
done | ||
| ||
if [ "a$wl_unknown" != "a" ] | ||
then | ||
echo "$wlm_unknown $wl_unknown" | ||
w_help | ||
fi | ||
| ||
if [ "a$wcm_ifc" = "a" ] | ||
then | ||
wcm_ifc=`ls $wl_hostap` | ||
fi | ||
| ||
if [ $wcm_col -eq 0 ] | ||
then | ||
w_bw | ||
fi | ||
while [ 1 ] | ||
do | ||
if [ $wl_numcllast -ne $wl_numclold ] | ||
then | ||
wl_numclold=$wl_numcllast | ||
wcm_clear=1 | ||
fi | ||
if [ $wcm_clear -eq 1 ] | ||
then | ||
clear | ||
wcm_clear=0 | ||
fi | ||
tput cup 0 0 | ||
wl_numcllast=0 | ||
if [ $wcm_html -eq 1 ] | ||
then | ||
w_bw | ||
echo $wl_header | ||
for wl_iface in $wcm_ifc | ||
do | ||
w_iface | ||
done | ||
echo $wl_footer | ||
else | ||
for wl_iface in $wcm_ifc | ||
do | ||
w_iface | ||
done | ||
fi | ||
| ||
if [ $wcm_once -eq 1 ] | ||
then | ||
exit 0 | ||
fi | ||
sleep 1 | ||
done | ||
| ||
| ||
| ||
exit 0 | ||
| ||
| ||
case $1 in | ||
-help) | ||
w_help | ||
;; |
;; | |
-htm1) |
-htm1) | |
|
| |
;; |
;; | |
-htm1) |
-1) | |
echo bez parametru cyklicky vypis na obrazovku |
w_bw | |
clear | ||
tput cup 0 0 | ||
for wl_iface in `ls $wl_hostap` | ||
do | ||
w_iface | ||
done | ||
|
| |
;; |
;; | |
-htm1) |
-htm1) | |
w_bw |
w_bw | |
echo $wl_header_static > $wl_webpage |
echo $wl_header_static > $wl_webpage |