jablonka.czprosek.czf

wifimon

Subversion Repositories:
[/] [trunk/] [wifimon] - Blame information for rev 19

 

Line No. Rev Author Line
12simandl#!/bin/bash
23simandl# authors : Petr Simandl www.simandl.cz
314simandl# : Fyzik, Covex, Tydyt
419simandl# release date : 11/09/2005
52simandl# name : wifimon
619simandl# description : hostap and madwifi powered card monitoring
72simandl# license : GPL
819simandl######################################################################
92simandl 
1019simandlwl_version="0.5.5"
1111simandl 
1219simandl######################################################################
13#custom settings
14 
1513simandlPATH=$PATH:$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:usr/local/bin:/usr/local/sbin
16 
1714simandlwl_iwccmd=`which iwconfig`
1819simandlwl_iwlcmd=`which iwlist`
1914simandlwl_ifccmd=`which ifconfig`
20wl_hnmcmd=`which hostname`
21wl_awkcmd=`which awk`
22 
23wl_tptcmde=""
24wl_clrcmde=""
25 
2619simandlwl_sysdev="/proc/sys/dev/"
2714simandlwl_hostap="/proc/net/hostap/"
28wl_wireless="/proc/net/wireless"
29wl_arp="/proc/net/arp"
30wl_dhcpcnf="/etc/dhcpd.conf"
31wl_dhcplss="/var/lib/dhcp/dhcpd.leases"
3217simandl# wl_dhcpcnf="/etc/dhcp3/dhcpd.conf"
33# wl_dhcplss="/var/lib/dhcp3/dhcpd.leases"
3414simandl 
3519simandlwl_header_refresh="<html><head><meta HTTP-EQUIV=\"Refresh\" CONTENT=\"15\"><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>"
36wl_header="<html><head><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>"
37wl_footer="</pre></body></html>"
3814simandl 
3919simandlwlm_no_managed_or_master=" neni ani Master ani Managed..."
40wlm_number_of_clients="Pocet asociovanych klientu : "
41wlm_unknown="Nezname parametry nebo neplatne jmeno rozhrani : "
42#wlm_no_managed_or_master=" is not Master or Managed..."
43#wlm_number_of_clients="Number of associated clients : "
44 
45wlch_signal="="
46wlch_noise="*"
47 
48######################################################################
49#testing basic setings
50 
5112simandlif [ "$wl_iwccmd x" = " x" ]
52 then
53 echo "iwconfig not found"
54 exit 1
55fi
562simandl 
5719simandlif [ "$wl_iwlcmd x" = " x" ]
58 then
59 echo "iwlist not found"
60 exit 1
61fi
62 
6314simandlif [ "$wl_ifccmd x" = " x" ]
64 then
65 echo "ifconfig not found"
66 exit 1
67fi
684simandl 
6914simandlif [ "$wl_hnmcmd x" = " x" ]
70 then
71 echo "hostname not found"
72 exit 1
73fi
74 
75if [ "$wl_awkcmd x" = " x" ]
76 then
77 echo "awk not found"
78 exit 1
79fi
80 
81if [ -e $wl_wireless ]
82 then
83 wl_nop=1
84 else
85 echo "$wl_wireless not found"
86 exit 1
87fi
88 
89if [ -e $wl_arp ]
90 then
91 wl_nop=1
92 else
93 echo "$wl_arp not found"
94 exit 1
95fi
96 
97if [ -e $wl_dhcpcnf ]
98 then
99 wl_nop=1
100 else
101 echo "$wl_dhcpcnf not found"
102 wl_dhcpcnf="/dev/null"
103fi
104 
105if [ -e $wl_dhcplss ]
106 then
107 wl_nop=1
108 else
109 echo "$wl_dhcplss not found"
110 wl_dhcplss="/dev/null"
111fi
11219simandl######################################################################
11314simandl 
11419simandlif [ -d ${wl_hostap}wlan0 ]
115 then
116 wlf_hostap=1
117 else
118# echo "${wl_hostap}wlan0 not found"
119 wlf_hostap=0
120fi
1217simandl 
12219simandlif [ -d ${wl_sysdev}ath0 ]
123 then
124 wlf_madwifi=1
125 else
126# echo "${wl_sysdev}ath0 not found"
127 wlf_madwifi=0
128fi
1297simandl 
13019simandlif [ "$wlf_hostap" -eq 0 ] && [ "$wlf_madwifi" -eq 0 ]
131 then
132 echo "${wl_hostap}wlan0 not found"
133 echo "${wl_sysdev}ath0 not found"
134 exit 1
135fi
13611simandl 
1372simandl######################################################################
13819simandl# procedures
139######################################################################
14011simandlw_col()
14110simandl{
14215simandlwlc_red=`tput setaf 1` # ruda (Red)
143wlc_green=`tput setaf 2` # zelena (Lime)
144wlc_brown=`tput setaf 3` # zluta (Yellow)
145wlc_blue=`tput setaf 4` # modra (Blue)
146wlc_magenta=`tput setaf 5` # fialova (Fuchsia)
147wlc_lblue=`tput setaf 6` # svetle modra (Aqua)
148wlc_grey=`tput setaf 7` # bila (White)
14911simandlwlc_std=`tput sgr0`
150 
15115simandlwlc_pkts=$wlc_red # Rx,Tx info color
15211simandlwlc_ip=$wlc_lblue # ip address color
153wlc_mac=$wlc_magenta # mac address color
15415simandlwlc_name=$wlc_magenta # host name color
15511simandlwlc_sig=$wlc_red # signal number color
156wlc_bar=$wlc_green # signal bar color
15715simandlwlc_noise=$wlc_red # Signal noise color
15810simandl}
159######################################################################
16015simandlw_colh()
161{
162 wlh_pkts="Olive" # signal number color html
163 wlh_ip="Blue" # ip address color html
164 wlh_mac="Fuchsia" # mac address color html
165 wlh_name="Fuchsia" # Host name color html
166 wlh_sig="Red" # signal number color html
167 wlh_bar="Lime" # signal bar color html
168 wlh_noise="Red" # Signal noise color html
169 
170 wlc_pkts="<font color=\"$wlh_pkts\">"
171 wlc_ip="<font color=\"$wlh_ip\">"
172 wlc_mac="<font color=\"$wlh_mac\">"
173 wlc_name="<font color=\"$wlh_name\">"
174 wlc_sig="<font color=\"$wlh_sig\">"
175 wlc_bar="<font color=\"$wlh_bar\">"
176 wlc_noise="<font color=\"$wlh_noise\">"
177 wlc_std="</font>"
178}
179######################################################################
1804simandlw_bw()
181{
18215simandl wlc_pkts=""
1836simandl wlc_ip=""
184 wlc_mac=""
185 wlc_sig=""
186 wlc_bar=""
18715simandl wlc_noise=""
1886simandl wlc_std=""
1894simandl}
190######################################################################
1912simandlw_bar()
192{
19311simandl wl_neg=`expr $wl_cnt \< 0 `
194 if [ "$wl_neg" -eq 1 ]
195 then
19615simandl echo -n "${wlc_noise}"
19711simandl wl_cnt=$(($wl_cnt * -1 ))
198 wl_bar=$wlch_noise
199 else
20015simandl echo -n "${wlc_bar}"
20111simandl wl_bar=$wlch_signal
202 fi
2032simandl until [ "$wl_cnt" -eq -1 ]
204 do
20511simandl echo -n "$wl_bar"
2062simandl wl_cnt=$(($wl_cnt - 1 ))
207 done
208 printf " \n"
2096simandl echo -n "${wlc_std}"
21011simandl# tput sgr0
2112simandl} # w_bar
212 
213######################################################################
21413simandlw_pkts()
215{
216 wl_macpkts=`cat $wl_hostap$wl_iface/$wl_mac | grep -E 'rx\[|tx\[' | sed 's/=/ /g'`
21714simandl wl_nt1=`echo $wl_macpkts | $wl_awkcmd '{print $2}'`
218 wl_nt2=`echo $wl_macpkts | $wl_awkcmd '{print $4}'`
219 wl_nt5=`echo $wl_macpkts | $wl_awkcmd '{print $6}'`
220 wl_nt11=`echo $wl_macpkts | $wl_awkcmd '{print $8}'`
221 wl_nr1=`echo $wl_macpkts | $wl_awkcmd '{print $10}'`
222 wl_nr2=`echo $wl_macpkts | $wl_awkcmd '{print $12}'`
223 wl_nr5=`echo $wl_macpkts | $wl_awkcmd '{print $14}'`
224 wl_nr11=`echo $wl_macpkts | $wl_awkcmd '{print $16}'`
22513simandl 
226 if [ $wcm_ppkts -eq 1 ]
227 then
228 wl_pksize=$((98))
229 wl_nt=$(($wl_nt1 + $wl_nt2 + wl_nt5 + wl_nt11))
230 if [ "$wl_nt1" -eq 0 ]
231 then
232 wl_nt1n="00"
233 else
234 wl_nt1n=$(($wl_pksize * $wl_nt1 / $wl_nt + 1))
235 [ "$wl_nt1n" -lt 10 ] && wl_nt1n="0"$wl_nt1n
236 fi
237 if [ "$wl_nt2" -eq 0 ]
238 then
239 wl_nt2n="00"
240 else
241 wl_nt2n=$(($wl_pksize * $wl_nt2 / $wl_nt + 1))
242 [ "$wl_nt2n" -lt 10 ] && wl_nt2n="0"$wl_nt2n
243 fi
244 if [ "$wl_nt5" -eq 0 ]
245 then
246 wl_nt5n="00"
247 else
248 wl_nt5n=$(($wl_pksize * $wl_nt5 / $wl_nt + 1))
249 [ "$wl_nt5n" -lt 10 ] && wl_nt5n="0"$wl_nt5n
250 fi
251 if [ "$wl_nt11" -eq 0 ]
252 then
253 wl_nt11n="00"
254 else
255 wl_nt11n=$(($wl_pksize * $wl_nt11 / $wl_nt + 1))
256 [ "$wl_nt11n" -lt 10 ] && wl_nt11n="0"$wl_nt11n
257 fi
258 wl_nr=$((1 + $wl_nr1 + $wl_nr2 + wl_nr5 + wl_nr11))
259 if [ "$wl_nr1" -eq 0 ]
260 then
261 wl_nr1n="00"
262 else
263 wl_nr1n=$(($wl_pksize * $wl_nr1 / $wl_nr + 1))
264 [ "$wl_nr1n" -lt 10 ] && wl_nr1n="0"$wl_nr1n
265 fi
266 if [ "$wl_nr2" -eq 0 ]
267 then
268 wl_nr2n="00"
269 else
270 wl_nr2n=$(($wl_pksize * $wl_nr2 / $wl_nr + 1))
271 [ "$wl_nr2n" -lt 10 ] && wl_nr2n="0"$wl_nr2n
272 fi
273 if [ "$wl_nr5" -eq 0 ]
274 then
275 wl_nr5n="00"
276 else
277 wl_nr5n=$(($wl_pksize * $wl_nr5 / $wl_nr + 1))
278 [ "$wl_nr5n" -lt 10 ] && wl_nr5n="0"$wl_nr5n
279 fi
280 if [ "$wl_nr11" -eq 0 ]
281 then
282 wl_nr11n="00"
283 else
284 wl_nr11n=$(($wl_pksize * $wl_nr11 / $wl_nr + 1))
285 [ "$wl_nr11n" -lt 10 ] && wl_nr11n="0"$wl_nr11n
286 fi
28715simandl echo -n "Tx"${wlc_pkts} $wl_nt1n $wl_nt2n $wl_nt5n $wl_nt11n ${wlc_std}""
288 echo -n "Rx"${wlc_pkts} $wl_nr1n $wl_nr2n $wl_nr5n $wl_nr11n ${wlc_std}""
28913simandl fi
290 
291 [ $wcm_pkts -eq 1 ] && echo -n "Tx" $wl_nt1 $wl_nt2 $wl_nt5 $wl_nt11 "Rx" $wl_nr1 $wl_nr2 $wl_nr5 $wl_nr11 ""
292 
293} # w_pkts
294######################################################################
29517simandlw_managed()
296{ echo $wl_iwctxt | $wl_awkcmd '{print $1,$3,$4,$5" "}'
29718simandl 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
29815simandl 
29918simandl if [ $wcm_macoff -eq 0 ]
30015simandl then
30119simandl wl_mac=`echo -n $wl_iwctxt | $wl_awkcmd '{print $9}'`
30218simandl echo -n "${wlc_mac}$wl_mac${wlc_std} "
30315simandl fi
30418simandl echo $wl_iwctxt | $wl_awkcmd '{print $6,$10" "}'
30515simandl 
30614simandl wl_wtxt=`cat $wl_wireless | grep $wl_iface | $wl_awkcmd '{print $3,$4,$5}' | sed 's/\.//g'`
307 wl_quality=`echo $wl_wtxt | $wl_awkcmd '{print $1}'`
308 wl_signal=`echo $wl_wtxt | $wl_awkcmd '{print $2}'`
3092simandl wl_signal=$(($wl_signal - 256))
31014simandl wl_noise=`echo $wl_wtxt | $wl_awkcmd '{print $3}'`
3112simandl wl_noise=$(($wl_noise - 256))
3125simandl echo "Quality:${wlc_sig}$wl_quality${wlc_std}/92 Signal level:$wl_signal Noise level:$wl_noise "
3132simandl wl_cnt=$wl_quality
314 w_bar
315 echo
316} # w_managed
317 
318######################################################################
319w_master()
32017simandl{ if [ $wcm_oneline -eq 0 ]
32119simandl then
322 echo $wl_iwctxt | $wl_awkcmd '{print $1,$3,$4,$5" "}'
323 if [ $wcm_macoff -eq 1 ]
324 then
325 echo $wl_iwctxt | $wl_awkcmd '{print $6,$11" "}'
326 else
327 echo $wl_iwctxt | $wl_awkcmd '{print $6,$9,$11" "}'
328 fi
329 else
330 echo $wl_iwctxt | $wl_awkcmd '{print $1,$4,$5,$6,$11" "}' | sed 's/ [^": ]*:/ /g'
331 fi
332 
333 if [ -d $wl_hostap$wl_iface ]
33415simandl then
33519simandl wl_numcl=`ls $wl_hostap$wl_iface | grep -c 00`
336 wl_macs=`ls $wl_hostap$wl_iface | grep 00`
3375simandl fi
33819simandl 
339 if [ -d $wl_sysdev$wl_iface ]
340 then
341 wl_numcl=`$wl_iwlcmd $wl_iface peers | grep -c 00`
342 wl_macs=`iwlist $wl_iface peers | grep 00 | awk '{print $1}'`
343 fi
344 
3452simandl echo $wlm_number_of_clients $wl_numcl
34613simandl 
3475simandl wl_numcllast=$(($wl_numcllast + $wl_numcl))
34813simandl 
34919simandl for wl_mac in $wl_macs
3502simandl do
35119simandl if [ -d $wl_hostap$wl_iface ]
352 then
353 wl_macparam=`cat $wl_hostap$wl_iface/$wl_mac | grep -E 'last_rx|last_tx' | sed 's/last_//g'`
354 wl_signal=`echo $wl_macparam | $wl_awkcmd '{print $6}' | sed 's/signal=//g'`
355 wl_silence=`echo $wl_macparam | $wl_awkcmd '{print $4}' | sed 's/silence=//g'`
356 fi
357 
358 if [ -d $wl_sysdev$wl_iface ]
359 then
360 wl_macparam=`$wl_iwlcmd $wl_iface peers | grep $wl_mac`
361 wl_signal=`echo $wl_macparam | $wl_awkcmd '{print $5}' | sed 's/level://g'`
362 wl_silence=`echo $wl_macparam | $wl_awkcmd '{print $8}' | sed 's/level://g'`
363 fi
364 
36511simandl wl_cnt=$(($wl_signal - $wl_silence))
36614simandl wl_ipc=`cat $wl_arp | grep -i $wl_mac | $wl_awkcmd '{print $1}'` # IP adresa peeru z arp tabulky
36713simandl 
36814simandl wl_name=`cat $wl_dhcpcnf | grep -i $wl_mac | $wl_awkcmd '{print $2}'`
369 if [ "$wl_name" = "ethernet" ] || [ "$wl_name" = "" ]
370 then
371 wl_name=`cat $wl_dhcpcnf | grep -i $wl_mac -B 1 | $wl_awkcmd '{print$2,$3}' | grep -i $wl_mac -v | $wl_awkcmd '{print$1}'`
372 if [ "$wl_name" = "" ]
373 then
37417simandl wl_name=`cat $wl_dhcplss | grep -i $wl_mac -A 2 | grep -i client-hostname | $wl_awkcmd '{print$2}'`
37514simandl wl_name=`echo $wl_name | $wl_awkcmd '{print$1}' `
376 fi
377 fi
37819simandl if [ $wcm_ppkts -eq 1 ] || [ $wcm_pkts -eq 1 ] && [ -d $wl_hostap$wl_iface ]
37913simandl then
380 w_pkts
381 fi
382 
3835simandl if [ $wcm_oneline -eq 0 ]
384 then
38515simandl echo -n "${wlc_name}$wl_name${wlc_std} "
3865simandl echo -n "${wlc_ip}$wl_ipc${wlc_std} "
38715simandl if [ $wcm_macoff -eq 0 ]
388 then
389 echo -n "${wlc_mac}$wl_mac${wlc_std} "
390 fi
391 if [ $wcm_threeline -eq 1 ]
392 then
393 echo ""
394 echo -n " "
395 fi
396 echo -n "Signal ${wlc_sig}$wl_cnt${wlc_std} "
397 if [ $wcm_rxtx -eq 0 ]
398 then
399 echo ""
400 else
40119simandl if [ -d $wl_hostap$wl_iface ]
402 then
403 echo $wl_macparam | $wl_awkcmd '{print $1,$2" "}'
404 else
405 echo ""
406 fi
40715simandl fi
4085simandl w_bar
409 else
41015simandl if [ $wcm_macoff -eq 0 ]
411 then
412 echo -n "${wlc_mac}$wl_mac${wlc_std} "
413 fi
414 echo -n "${wlc_sig}$wl_cnt${wlc_std} "
41517simandl echo -n "$wl_name "
4165simandl w_bar
417 fi
4184simandl done
41911simandl 
420 echo
4212simandl} # w_master
422 
423######################################################################
424w_iface()
42518simandl{ wl_iwctxt=`$wl_iwccmd $wl_iface 2>/dev/null | grep -v 'Device|Some|Extension' | sed 's/ Nick/_Nick/' | sed 's/Access Point/Access_Point/'`
42614simandl wl_mode=`echo $wl_iwctxt | $wl_awkcmd '{print $5}' | sed 's/Mode://g'`
4272simandl if [ "a$wl_mode" = "aManaged" ]
428 then
429 w_managed
4308simandl elif [ "a$wl_mode" = "aAd-Hoc" ]
431 then
432 w_managed
4332simandl elif [ "a$wl_mode" = "aMaster" ]
434 then
435 w_master
436 else
437 echo $wl_iface $wlm_no_managed_or_master
438 echo
439 fi
440}
441 
442######################################################################
44311simandlw_version()
444{
445 echo wifimon $wl_version
446 exit 0
447}
448######################################################################
4495simandlw_help()
450{
45119simandl echo Monitorovani wifi karet pouzivajicich hostap nebo madwifi ovladace
4523simandl echo Pouziti: wifimon [param]
453 echo param:
45411simandl echo -v vypise verzi
4555simandl echo -html generovani html stranky
45613simandl echo -col barevny vypis na obrazovku
4575simandl echo -once vypsani jen jednoho vypisu a pak program skonci
458 echo -oneline vypsani klientu na jednu linku
45915simandl echo -threeline vypsani klienta na trech radcich
46019simandl echo -macoff vypnuti zobrazeni MAC adres
461 echo -wlan0 -ath0 -wlan2 vypise jen uvedene karty a to v danem poctu a poradi
462 echo nasledujici parametry ovlivnuji jen karty s hostap:
46315simandl echo -rxtxoff vypnuti zobrazeni objemu prenesenych dat klienta
46413simandl echo -ppkts vypsani procentniho pomeru 1M, 2M, 5.5M a 11M paketu pro jednotlive klienty
465 echo -pkts vypsani poctu 1M, 2M, 5.5M a 11M paketu pro jednotlive klienty
4663simandl echo bez parametru cyklicky vypis na obrazovku
4675simandl exit 0
468}
469######################################################################
470######################################################################
4712simandl 
4725simandlwl_unknown=""
473wl_cnt=1
474wcm_clear=1
475wcm_once=0
47611simandlwcm_col=0
4775simandlwcm_oneline=0
47815simandlwcm_threeline=0
4795simandlwcm_html=0
48015simandlwcm_rxtx=1
48113simandlwcm_ppkts=0
482wcm_pkts=0
4835simandlwcm_ifc=""
48415simandlwcm_macoff=0
4855simandl 
4866simandl# parsing input parameters
4875simandlwhile [ "a$1" != "a" ]
488do
489 case $1 in
49011simandl -v)
491 w_version
492 ;;
4935simandl -help)
494 w_help
495 ;;
496 -once)
497 wcm_once=1
498 shift
499 ;;
500 -oneline)
501 wcm_oneline=1
502 shift
503 ;;
50415simandl -threeline)
505 wcm_threeline=1
506 shift
507 ;;
50811simandl -col)
509 wcm_col=1
5105simandl shift
511 ;;
512 -html)
513 wcm_html=1
514 shift
515 ;;
51615simandl -rxtxoff)
517 wcm_rxtx=0
518 shift
519 ;;
52013simandl -ppkts)
521 wcm_ppkts=1
522 shift
523 ;;
524 -pkts)
525 wcm_pkts=1
526 shift
527 ;;
52815simandl -macoff)
529 wcm_macoff=1
530 shift
531 ;;
5325simandl *)
533 wl_flg=0
53419simandl#wlan check
535 if [ $wlf_hostap -eq 1 ]
5365simandl then
53719simandl for wl_iface in `ls $wl_hostap`
538 do
539 if [ "a-$wl_iface" = "a$1" ]
540 then
541 wcm_ifc="$wcm_ifc $wl_iface"
542 wl_flg=1
543 fi
544 done
545 fi
546# ath check
547 if [ $wlf_madwifi -eq 1 ]
548 then
549 for wl_iface in `ls $wl_sysdev | grep "ath[0-9]"`
550 do
551 if [ "a-$wl_iface" = "a$1" ]
552 then
553 wcm_ifc="$wcm_ifc $wl_iface"
554 wl_flg=1
555 fi
556 done
557 fi
5585simandl if [ $wl_flg -eq 0 ]
55919simandl then
560 wl_unknown="$wl_unknown$1 "
5615simandl fi
562 shift
563 esac
564done
565 
5666simandl# printing the list of bad parameters (if there are some)
5675simandlif [ "a$wl_unknown" != "a" ]
568then
569 echo "$wlm_unknown $wl_unknown"
570 w_help
571fi
5726simandl# if no interface is selected then all available are choosen
5735simandlif [ "a$wcm_ifc" = "a" ]
574then
57519simandl if [ $wlf_hostap -eq 1 ]
576 then
577 wcm_ifc=`ls $wl_hostap `
578 fi
579 if [ $wlf_madwifi -eq 1 ]
580 then
581 wcm_ifc=`echo $wcm_ifc ; ls $wl_sysdev | grep "ath[0-9]"`
582 fi
5835simandlfi
584 
5856simandl# setting for old and last same value to avoid double clear after start
586wl_numcllast=0
587wl_numclold=0
588for wl_iface in $wcm_ifc
589do
59019simandl if [ -d $wl_hostap$wl_iface ]
591 then
592 wl_numcl=`ls $wl_hostap$wl_iface | grep -c 00`
593 wl_numcllast=$(($wl_numcllast + $wl_numcl))
594 fi
595 if [ -d $wl_sysdev$wl_iface ]
596 then
597 wl_mode=`$wl_iwccmd $wl_iface | grep Mode | $wl_awkcmd '{print $1}' | sed 's/Mode://g'`
598 if [ "a$wl_mode" = "aMaster" ]
599 then
600 wl_numcl=`$wl_iwlcmd $wl_iface peers | grep -c 00`
601 wl_numcllast=$(($wl_numcllast + $wl_numcl))
602 fi
603 fi
6046simandldone
605wl_numclold=$wl_numcllast
606 
60711simandlif [ $wcm_col -eq 0 ]
6086simandlthen
609 w_bw
61011simandlelse
61115simandl if [ $wcm_html -eq 1 ]
612 then
613 w_colh
614 else
615 w_col
616 fi
6176simandlfi
618 
61913simandlif [ $wcm_html -eq 1 ]
620then
621 [ $wcm_once -eq 1 ] && echo $wl_header || echo $wl_header_refresh
622 for wl_iface in $wcm_ifc
623 do
624 w_iface
625 done
626 echo $wl_footer
627 exit 0
628fi
629 
63015simandl#this is main loop and it will be executed forever
6316simandlwhile [ 1 ]
6325simandl do
63314simandl 
634 # when the number of associated klients has changed we will set for clear screen
6355simandl if [ $wl_numcllast -ne $wl_numclold ]
636 then
637 wl_numclold=$wl_numcllast
638 wcm_clear=1
639 fi
64014simandl 
641 #if it is set for clear screen we will do it except we produce single report
642 if [ $wcm_clear -eq 1 -a $wcm_once -eq 0 ]
6435simandl then
64414simandl echo -n $wl_clrcmde
6455simandl wcm_clear=0
646 fi
647 wl_numcllast=0
64811simandl 
64914simandl #for cyclic report we are trying to set cursor to the top left screen corner
650 if [ $wcm_once -eq 0 ]
651 then
652 echo -n $wl_tptcmde
653 fi
654 
655 #make report for all desired interfaces
65613simandl for wl_iface in $wcm_ifc
657 do
658 w_iface
659 done
660 
66114simandl #when a single report is needed than we are exiting
6625simandl if [ $wcm_once -eq 1 ]
663 then
664 exit 0
665 fi
666 sleep 1
6676simandldone
6685simandl 
669exit 0
670 

Powered by WebSVN 2.2.1