Rev 2 |
|
Rev 3 |
Line 1... |
|
Line 1... |
#!/bin/bash |
|
#!/bin/bash |
# author : Petr Simandl www.simandl.cz |
|
# authors : Petr Simandl www.simandl.cz |
# release date : 29/12/2002 |
|
# |
|
|
# release date : 1/1/2003 |
# name : wifimon |
|
# name : wifimon |
# version : 0.1 initial |
|
# version : 0.2 beta |
# 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_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_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_static="<html><head><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>" |
|
|
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 : " |
Line 26... |
|
Line 35... |
} # 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" "}' |
echo $wl_iwctxt | awk '{print $6,$9,$11" "}' |
|
echo -n `$wl_ifccmd $wl_iface | grep -E "inet addr|inet adr" | awk '{print $2" "}' | sed s/ad*r://g`" " # IP adresa mastera z ifconfig |
|
|
echo $wl_iwctxt | awk '{print $9,$6,$11" "}' |
#echo $wl_iwctxt | awk '{print $27,$28,$29,$31,$32" "}' |
|
#echo $wl_iwctxt | awk '{print $27,$28,$29,$31,$32" "}' |
#cat $wl_wireless | grep $wl_iface |
|
#cat $wl_wireless | grep $wl_iface |
wl_wtxt=`cat $wl_wireless | grep $wl_iface | awk '{print $3,$4,$5}' | sed 's/\.//g'` |
|
wl_wtxt=`cat $wl_wireless | grep $wl_iface | awk '{print $3,$4,$5}' | sed 's/\.//g'` |
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}'` |
Line 50... |
|
Line 60... |
{ echo $wl_iwctxt | awk '{print $1,$3,$4,$5" "}' |
|
{ echo $wl_iwctxt | awk '{print $1,$3,$4,$5" "}' |
echo $wl_iwctxt | awk '{print $6,$9,$11" "}' |
|
echo $wl_iwctxt | awk '{print $6,$9,$11" "}' |
|
|
|
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 |
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'` |
echo $wl_mac Signal $wl_cnt $wl_macparam | awk '{print $1,$2,$3,$4,$5" "}' |
|
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 |
|
|
echo $wl_ipc $wl_umac Signal $wl_cnt $wl_macparam | awk '{print $1,$2,$3,$4,$5" "}' |
w_bar |
|
w_bar |
done |
|
done |
|
|
|
echo |
|
echo |
} # w_master |
|
} # w_master |
Line 80... |
|
Line 92... |
} |
|
} |
|
|
|
###################################################################### |
|
###################################################################### |
###################################################################### |
|
###################################################################### |
|
|
|
clear |
|
case $1 in |
|
|
-help) |
|
|
echo Pouziti: wifimon [param] |
|
|
echo param: |
|
|
echo -htm cyklicke generovani stranky s 1s obnonovanim |
|
|
echo -htm1 jedna staticka stranka |
|
|
echo bez parametru cyklicky vypis na obrazovku |
|
|
|
while [ 1 ] |
|
;; |
do |
|
-htm1) |
tput cup 0 0 |
|
echo $wl_header_static > $wl_webpage |
for wl_iface in `ls $wl_hostap` |
|
for wl_iface in `ls $wl_hostap` |
do |
|
do |
w_iface |
|
w_iface >> $wl_webpage |
|
|
done |
|
|
echo $wl_footer >> $wl_webpage |
|
|
;; |
|
|
-htm) |
|
|
while [ 1 ] |
|
|
do |
|
|
echo $wl_header > $wl_webpage.tmp |
|
|
for wl_iface in `ls $wl_hostap` |
|
|
do |
|
|
w_iface >> $wl_webpage.tmp |
|
|
done |
|
|
echo $wl_footer >> $wl_webpage.tmp |
|
|
cp $wl_webpage.tmp $wl_webpage |
|
|
sleep 1 |
|
|
done |
|
|
;; |
|
|
*) |
|
|
clear |
|
|
while [ 1 ] |
|
|
do |
|
|
tput cup 0 0 |
|
|
for wl_iface in `ls $wl_hostap` |
|
|
do |
|
|
w_iface |
|
|
done |
|
|
sleep 1 |
done |
|
done |
# tput cup 25 0 |
|
esac |
sleep 1 |
|
|
done |
|
|
|
|
|
exit 0 |
|
exit 0 |
|
|
|
|
|
|
|
|
|