Rev 3 |
|
Rev 4 |
Line 1... |
|
Line 1... |
#!/bin/bash |
|
#!/bin/bash |
# authors : Petr Simandl www.simandl.cz |
|
# authors : Petr Simandl www.simandl.cz |
# |
|
# : Fyzik |
# release date : 1/1/2003 |
|
# release date : 6/1/2003 |
# name : wifimon |
|
# name : wifimon |
# version : 0.2 beta |
|
# version : 0.2 beta 2 |
# 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" |
wl_hnmcmd="/bin/hostname" |
|
wl_hnmcmd="/bin/hostname" |
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" |
|
|
|
|
|
wlc_red=`tput setaf 1` |
|
|
wlc_green=`tput setaf 2` |
|
|
wlc_brown=`tput setaf 3` |
|
|
wlc_blue=`tput setaf 4` |
|
|
wlc_magenta=`tput setaf 5` |
|
|
wlc_lblue=`tput setaf 6` |
|
|
wlc_grey=`tput setaf 7` |
|
|
wlc_std=`tput sgr0` |
|
|
|
|
|
wlc_ip=$wlc_lblue # ip address color |
|
|
wlc_mac=$wlc_magenta # mac address color |
|
|
wlc_sig=$wlc_red # signal number 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=\"1\"><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_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() |
|
|
{ |
|
|
wlc_ip=$wlc_std |
|
|
wlc_mac=$wlc_std |
|
|
wlc_sig=$wlc_std |
|
|
wlc_bar=$wlc_std |
|
|
} |
###################################################################### |
|
###################################################################### |
w_bar() |
|
w_bar() |
{ |
|
{ |
|
|
echo -n "${wlc_bar}" |
until [ "$wl_cnt" -eq -1 ] |
|
until [ "$wl_cnt" -eq -1 ] |
do |
|
do |
printf "=" |
|
printf "=" |
wl_cnt=$(($wl_cnt - 1 )) |
|
wl_cnt=$(($wl_cnt - 1 )) |
done |
|
done |
printf " \n" |
|
printf " \n" |
|
|
tput sgr0 |
} # w_bar |
|
} # w_bar |
|
|
|
###################################################################### |
|
###################################################################### |
w_managed() |
|
w_managed() |
{ echo $wl_iwctxt | awk '{print $1,$3,$4,$5" "}' |
|
{ echo $wl_iwctxt | awk '{print $1,$3,$4,$5" "}' |
Line 45... |
|
Line 70... |
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:$wl_quality/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 |
Line 66... |
|
Line 91... |
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 $wl_ipc $wl_umac Signal $wl_cnt $wl_macparam | awk '{print $1,$2,$3,$4,$5" "}' |
|
echo -n "${wlc_ip}$wl_ipc${wlc_std} " |
|
|
echo -n "${wlc_mac}$wl_umac${wlc_std} Signal ${wlc_sig}$wl_cnt${wlc_std} " |
|
|
echo $wl_macparam | awk '{print $1,$2" "}' |
w_bar |
|
w_bar |
done |
|
done |
|
|
|
echo |
|
echo |
} # w_master |
|
} # w_master |
|
|
|
###################################################################### |
|
###################################################################### |
Line 98... |
|
Line 125... |
-help) |
|
-help) |
echo Pouziti: wifimon [param] |
|
echo Pouziti: wifimon [param] |
echo param: |
|
echo param: |
echo -htm cyklicke generovani stranky s 1s obnonovanim |
|
echo -htm cyklicke generovani stranky s 1s obnonovanim |
echo -htm1 jedna staticka stranka |
|
echo -htm1 jedna staticka stranka |
|
|
echo -col barevny cyklicky vypis na obrazovku |
echo bez parametru cyklicky vypis na obrazovku |
|
echo bez parametru cyklicky vypis na obrazovku |
|
|
|
;; |
|
;; |
-htm1) |
|
-htm1) |
|
|
|
|
|
;; |
|
|
-htm1) |
|
|
echo bez parametru cyklicky vypis na obrazovku |
|
|
|
|
|
;; |
|
|
-htm1) |
|
|
w_bw |
echo $wl_header_static > $wl_webpage |
|
echo $wl_header_static > $wl_webpage |
for wl_iface in `ls $wl_hostap` |
|
for wl_iface in `ls $wl_hostap` |
do |
|
do |
w_iface >> $wl_webpage |
|
w_iface >> $wl_webpage |
done |
|
done |
echo $wl_footer >> $wl_webpage |
|
echo $wl_footer >> $wl_webpage |
;; |
|
;; |
-htm) |
|
-htm) |
|
|
w_bw |
while [ 1 ] |
|
while [ 1 ] |
do |
|
do |
echo $wl_header > $wl_webpage.tmp |
|
echo $wl_header > $wl_webpage.tmp |
for wl_iface in `ls $wl_hostap` |
|
for wl_iface in `ls $wl_hostap` |
do |
|
do |
w_iface >> $wl_webpage.tmp |
|
w_iface >> $wl_webpage.tmp |
done |
|
done |
echo $wl_footer >> $wl_webpage.tmp |
|
echo $wl_footer >> $wl_webpage.tmp |
cp $wl_webpage.tmp $wl_webpage |
|
cp $wl_webpage.tmp $wl_webpage |
|
|
sleep 1 |
|
|
done |
|
|
;; |
|
|
-col) |
|
|
clear |
|
|
while [ 1 ] |
|
|
do |
|
|
tput cup 0 0 |
|
|
for wl_iface in `ls $wl_hostap` |
|
|
do |
|
|
w_iface |
|
|
done |
sleep 1 |
|
sleep 1 |
done |
|
done |
;; |
|
;; |
*) |
|
*) |
|
|
w_bw |
clear |
|
clear |
while [ 1 ] |
|
while [ 1 ] |
do |
|
do |
tput cup 0 0 |
|
tput cup 0 0 |
for wl_iface in `ls $wl_hostap` |
|
for wl_iface in `ls $wl_hostap` |