1 | 2 | simandl | #!/bin/bash |
2 | 3 | simandl | # authors : Petr Simandl www.simandl.cz |
3 | 6 | simandl | # : Fyzik, Covex, Tydyt |
4 | | | # release date : 04/10/2003 |
5 | 2 | simandl | # name : wifimon |
6 | | | # description : hostap powered wifi card monitoring |
7 | | | # license : GPL |
8 | | | |
9 | 6 | simandl | wl_version="0.4.9" |
10 | | | |
11 | | | PATH=$PATH:$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:usr/local/bin:/usr/local/sbin |
12 | | | |
13 | | | wl_iwccmd=`which iwconfig` |
14 | | | wl_ifccmd=`which ifconfig` |
15 | | | wl_hnmcmd=`which hostname` |
16 | | | wl_clrcmd=`which clear` |
17 | | | wl_tptcmd=`which tput` |
18 | | | wl_awkcmd=`which awk` |
19 | | | |
20 | | | wl_clrcmde="[H[2J" |
21 | | | |
22 | 2 | simandl | wl_hostap="/proc/net/hostap/" |
23 | | | wl_wireless="/proc/net/wireless" |
24 | 3 | simandl | wl_arp="/proc/net/arp" |
25 | 6 | simandl | wl_dhcpcnf="/etc/dhcpd.conf" |
26 | | | wl_dhcplss="/var/lib/dhcp/dhcpd.leases" |
27 | 2 | simandl | |
28 | 6 | simandl | #testing all settings |
29 | | | |
30 | | | if [ "$wl_iwccmd x" = " x" ] |
31 | | | then |
32 | | | echo "iwconfig not found" |
33 | | | exit 1 |
34 | | | fi |
35 | | | |
36 | | | if [ "$wl_ifccmd x" = " x" ] |
37 | | | then |
38 | | | echo "ifconfig not found" |
39 | | | exit 1 |
40 | | | fi |
41 | | | |
42 | | | if [ "$wl_hnmcmd x" = " x" ] |
43 | | | then |
44 | | | echo "hostname not found" |
45 | | | exit 1 |
46 | | | fi |
47 | | | |
48 | | | if [ "$wl_clrcmd x" = " x" ] |
49 | | | then |
50 | | | echo "clear not found" |
51 | | | wl_clear=0 |
52 | | | else |
53 | | | wl_clear=1 |
54 | | | fi |
55 | | | |
56 | | | if [ "$wl_tptcmd x" = " x" ] |
57 | | | then |
58 | | | echo "tput not found" |
59 | | | wl_tput=0 |
60 | | | else |
61 | | | wl_tput=1 |
62 | | | fi |
63 | | | |
64 | | | if [ "$wl_awkcmd x" = " x" ] |
65 | | | then |
66 | | | echo "awk not found" |
67 | | | exit 1 |
68 | | | fi |
69 | | | |
70 | | | if [ -d $wl_hostap ] |
71 | | | then |
72 | | | wl_nop=1 |
73 | | | else |
74 | | | echo "hostap not found" |
75 | | | exit 1 |
76 | | | fi |
77 | | | |
78 | | | if [ -e $wl_wireless ] |
79 | | | then |
80 | | | wl_nop=1 |
81 | | | else |
82 | | | echo "$wl_wireless not found" |
83 | | | exit 1 |
84 | | | fi |
85 | | | |
86 | | | if [ -e $wl_arp ] |
87 | | | then |
88 | | | wl_nop=1 |
89 | | | else |
90 | | | echo "$wl_arp not found" |
91 | | | exit 1 |
92 | | | fi |
93 | | | |
94 | | | if [ -e $wl_dhcpcnf ] |
95 | | | then |
96 | | | wl_nop=1 |
97 | | | else |
98 | | | echo "$wl_dhcpcnf not found" |
99 | | | wl_dhcpcnf="/dev/null" |
100 | | | fi |
101 | | | |
102 | | | if [ -e $wl_dhcplss ] |
103 | | | then |
104 | | | wl_nop=1 |
105 | | | else |
106 | | | echo "$wl_dhcplss not found" |
107 | | | wl_dhcplss="/dev/null" |
108 | | | fi |
109 | | | |
110 | | | wl_header_refresh="<html><head><meta HTTP-EQUIV=\"Refresh\" CONTENT=\"3\"><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>" |
111 | | | wl_header="<html><head><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>" |
112 | | | wl_footer="</pre></body></html>" |
113 | | | |
114 | | | wlm_no_managed_or_master=" neni ani Master ani Managed..." |
115 | | | wlm_number_of_clients="Pocet asociovanych klientu : " |
116 | | | wlm_unknown="Nezname parametry nebo neplatne jmeno rozhrani : " |
117 | | | #wlm_no_managed_or_master=" is not Master or Managed..." |
118 | | | #wlm_number_of_clients="Number of associated clients : " |
119 | | | |
120 | | | wlch_signal="=" |
121 | | | wlch_noise="*" |
122 | | | |
123 | | | ###################################################################### |
124 | | | w_col() |
125 | | | { |
126 | 4 | simandl | wlc_red=`tput setaf 1` |
127 | | | wlc_green=`tput setaf 2` |
128 | | | wlc_brown=`tput setaf 3` |
129 | | | wlc_blue=`tput setaf 4` |
130 | | | wlc_magenta=`tput setaf 5` |
131 | | | wlc_lblue=`tput setaf 6` |
132 | | | wlc_grey=`tput setaf 7` |
133 | | | wlc_std=`tput sgr0` |
134 | | | |
135 | | | wlc_ip=$wlc_lblue # ip address color |
136 | | | wlc_mac=$wlc_magenta # mac address color |
137 | | | wlc_sig=$wlc_red # signal number color |
138 | | | wlc_bar=$wlc_green # signal bar color |
139 | 6 | simandl | } |
140 | 2 | simandl | ###################################################################### |
141 | 4 | simandl | w_bw() |
142 | | | { |
143 | 6 | simandl | wlc_ip="" |
144 | | | wlc_mac="" |
145 | | | wlc_sig="" |
146 | | | wlc_bar="" |
147 | | | wlc_std="" |
148 | 4 | simandl | } |
149 | | | ###################################################################### |
150 | 2 | simandl | w_bar() |
151 | | | { |
152 | 4 | simandl | echo -n "${wlc_bar}" |
153 | 6 | simandl | wl_neg=`expr $wl_cnt \< 0 ` |
154 | | | if [ "$wl_neg" -eq 1 ] |
155 | | | then |
156 | | | wl_cnt=$(($wl_cnt * -1 )) |
157 | | | wl_bar=$wlch_noise |
158 | | | else |
159 | | | wl_bar=$wlch_signal |
160 | | | fi |
161 | 2 | simandl | until [ "$wl_cnt" -eq -1 ] |
162 | | | do |
163 | 6 | simandl | echo -n "$wl_bar" |
164 | 2 | simandl | wl_cnt=$(($wl_cnt - 1 )) |
165 | | | done |
166 | | | printf " \n" |
167 | 6 | simandl | echo -n "${wlc_std}" |
168 | | | # tput sgr0 |
169 | 2 | simandl | } # w_bar |
170 | | | |
171 | | | ###################################################################### |
172 | 6 | simandl | w_pkts() |
173 | | | { |
174 | | | wl_macpkts=`cat $wl_hostap$wl_iface/$wl_mac | grep -E 'rx\[|tx\[' | sed 's/=/ /g'` |
175 | | | wl_nt1=`echo $wl_macpkts | $wl_awkcmd '{print $2}'` |
176 | | | wl_nt2=`echo $wl_macpkts | $wl_awkcmd '{print $4}'` |
177 | | | wl_nt5=`echo $wl_macpkts | $wl_awkcmd '{print $6}'` |
178 | | | wl_nt11=`echo $wl_macpkts | $wl_awkcmd '{print $8}'` |
179 | | | wl_nr1=`echo $wl_macpkts | $wl_awkcmd '{print $10}'` |
180 | | | wl_nr2=`echo $wl_macpkts | $wl_awkcmd '{print $12}'` |
181 | | | wl_nr5=`echo $wl_macpkts | $wl_awkcmd '{print $14}'` |
182 | | | wl_nr11=`echo $wl_macpkts | $wl_awkcmd '{print $16}'` |
183 | | | |
184 | | | if [ $wcm_ppkts -eq 1 ] |
185 | | | then |
186 | | | wl_pksize=$((98)) |
187 | | | wl_nt=$(($wl_nt1 + $wl_nt2 + wl_nt5 + wl_nt11)) |
188 | | | if [ "$wl_nt1" -eq 0 ] |
189 | | | then |
190 | | | wl_nt1n="00" |
191 | | | else |
192 | | | wl_nt1n=$(($wl_pksize * $wl_nt1 / $wl_nt + 1)) |
193 | | | [ "$wl_nt1n" -lt 10 ] && wl_nt1n="0"$wl_nt1n |
194 | | | fi |
195 | | | if [ "$wl_nt2" -eq 0 ] |
196 | | | then |
197 | | | wl_nt2n="00" |
198 | | | else |
199 | | | wl_nt2n=$(($wl_pksize * $wl_nt2 / $wl_nt + 1)) |
200 | | | [ "$wl_nt2n" -lt 10 ] && wl_nt2n="0"$wl_nt2n |
201 | | | fi |
202 | | | if [ "$wl_nt5" -eq 0 ] |
203 | | | then |
204 | | | wl_nt5n="00" |
205 | | | else |
206 | | | wl_nt5n=$(($wl_pksize * $wl_nt5 / $wl_nt + 1)) |
207 | | | [ "$wl_nt5n" -lt 10 ] && wl_nt5n="0"$wl_nt5n |
208 | | | fi |
209 | | | if [ "$wl_nt11" -eq 0 ] |
210 | | | then |
211 | | | wl_nt11n="00" |
212 | | | else |
213 | | | wl_nt11n=$(($wl_pksize * $wl_nt11 / $wl_nt + 1)) |
214 | | | [ "$wl_nt11n" -lt 10 ] && wl_nt11n="0"$wl_nt11n |
215 | | | fi |
216 | | | wl_nr=$((1 + $wl_nr1 + $wl_nr2 + wl_nr5 + wl_nr11)) |
217 | | | if [ "$wl_nr1" -eq 0 ] |
218 | | | then |
219 | | | wl_nr1n="00" |
220 | | | else |
221 | | | wl_nr1n=$(($wl_pksize * $wl_nr1 / $wl_nr + 1)) |
222 | | | [ "$wl_nr1n" -lt 10 ] && wl_nr1n="0"$wl_nr1n |
223 | | | fi |
224 | | | if [ "$wl_nr2" -eq 0 ] |
225 | | | then |
226 | | | wl_nr2n="00" |
227 | | | else |
228 | | | wl_nr2n=$(($wl_pksize * $wl_nr2 / $wl_nr + 1)) |
229 | | | [ "$wl_nr2n" -lt 10 ] && wl_nr2n="0"$wl_nr2n |
230 | | | fi |
231 | | | if [ "$wl_nr5" -eq 0 ] |
232 | | | then |
233 | | | wl_nr5n="00" |
234 | | | else |
235 | | | wl_nr5n=$(($wl_pksize * $wl_nr5 / $wl_nr + 1)) |
236 | | | [ "$wl_nr5n" -lt 10 ] && wl_nr5n="0"$wl_nr5n |
237 | | | fi |
238 | | | if [ "$wl_nr11" -eq 0 ] |
239 | | | then |
240 | | | wl_nr11n="00" |
241 | | | else |
242 | | | wl_nr11n=$(($wl_pksize * $wl_nr11 / $wl_nr + 1)) |
243 | | | [ "$wl_nr11n" -lt 10 ] && wl_nr11n="0"$wl_nr11n |
244 | | | fi |
245 | | | echo -n "Tx" $wl_nt1n $wl_nt2n $wl_nt5n $wl_nt11n "Rx" $wl_nr1n $wl_nr2n $wl_nr5n $wl_nr11n "" |
246 | | | fi |
247 | | | |
248 | | | [ $wcm_pkts -eq 1 ] && echo -n "Tx" $wl_nt1 $wl_nt2 $wl_nt5 $wl_nt11 "Rx" $wl_nr1 $wl_nr2 $wl_nr5 $wl_nr11 "" |
249 | | | |
250 | | | } # w_pkts |
251 | | | ###################################################################### |
252 | 2 | simandl | w_managed() |
253 | 6 | simandl | { echo $wl_iwctxt | $wl_awkcmd '{print $1,$3,$4,$5" "}' |
254 | | | 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 |
255 | | | echo $wl_iwctxt | $wl_awkcmd '{print $9,$6,$11" "}' |
256 | | | wl_wtxt=`cat $wl_wireless | grep $wl_iface | $wl_awkcmd '{print $3,$4,$5}' | sed 's/\.//g'` |
257 | | | wl_quality=`echo $wl_wtxt | $wl_awkcmd '{print $1}'` |
258 | | | wl_signal=`echo $wl_wtxt | $wl_awkcmd '{print $2}'` |
259 | 2 | simandl | wl_signal=$(($wl_signal - 256)) |
260 | 6 | simandl | wl_noise=`echo $wl_wtxt | $wl_awkcmd '{print $3}'` |
261 | 2 | simandl | wl_noise=$(($wl_noise - 256)) |
262 | 5 | simandl | echo "Quality:${wlc_sig}$wl_quality${wlc_std}/92 Signal level:$wl_signal Noise level:$wl_noise " |
263 | 2 | simandl | wl_cnt=$wl_quality |
264 | | | w_bar |
265 | | | echo |
266 | | | } # w_managed |
267 | | | |
268 | | | ###################################################################### |
269 | | | w_master() |
270 | 5 | simandl | { if [ $wcm_oneline -eq 0 ] |
271 | | | then |
272 | 6 | simandl | echo $wl_iwctxt | $wl_awkcmd '{print $1,$3,$4,$5" "}' |
273 | | | echo $wl_iwctxt | $wl_awkcmd '{print $6,$9,$11" "}' |
274 | 5 | simandl | else |
275 | 6 | simandl | echo $wl_iwctxt | $wl_awkcmd '{print $1,$4,$5,$6,$11" "}' | sed 's/ [^": ]*:/ /g' |
276 | 5 | simandl | fi |
277 | 2 | simandl | |
278 | | | wl_numcl=`ls $wl_hostap$wl_iface | grep -c 00` |
279 | | | echo $wlm_number_of_clients $wl_numcl |
280 | 6 | simandl | |
281 | 5 | simandl | wl_numcllast=$(($wl_numcllast + $wl_numcl)) |
282 | 6 | simandl | |
283 | 3 | simandl | for wl_mac in `ls $wl_hostap$wl_iface | grep 00 ` |
284 | 2 | simandl | do |
285 | 6 | simandl | wl_macparam=`cat $wl_hostap$wl_iface/$wl_mac | grep -E 'last_rx|last_tx' | sed 's/last_//g'` |
286 | | | wl_signal=`echo $wl_macparam | $wl_awkcmd '{print $5}' | sed 's/signal=//g'` |
287 | | | wl_silence=`echo $wl_macparam | $wl_awkcmd '{print $4}' | sed 's/silence=//g'` |
288 | | | wl_cnt=$(($wl_signal - $wl_silence)) |
289 | | | wl_ipc=`cat $wl_arp | grep -i $wl_mac | $wl_awkcmd '{print $1}'` # IP adresa peeru z arp tabulky |
290 | | | |
291 | | | wl_name=`cat $wl_dhcpcnf | grep -i $wl_mac | $wl_awkcmd '{print $2}'` |
292 | | | if [ "$wl_name" = "ethernet" ] || [ "$wl_name" = "" ] |
293 | | | then |
294 | | | 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}'` |
295 | | | if [ "$wl_name" = "" ] |
296 | | | then |
297 | | | wl_name=`cat $wl_dhcplss | grep -i $wl_mac -A 2 | $wl_awkcmd '{print$2,$3}' | grep -i $wl_mac -v | $wl_awkcmd '{print$1}'` |
298 | | | wl_name=`echo $wl_name | $wl_awkcmd '{print$1}' ` |
299 | | | fi |
300 | | | fi |
301 | | | if [ $wcm_ppkts -eq 1 ] || [ $wcm_pkts -eq 1 ] |
302 | | | then |
303 | | | w_pkts |
304 | | | fi |
305 | | | |
306 | 5 | simandl | if [ $wcm_oneline -eq 0 ] |
307 | | | then |
308 | 6 | simandl | echo -n "$wl_name " |
309 | 5 | simandl | echo -n "${wlc_ip}$wl_ipc${wlc_std} " |
310 | 6 | simandl | echo -n "${wlc_mac}$wl_mac${wlc_std} Signal ${wlc_sig}$wl_cnt${wlc_std} " |
311 | | | echo $wl_macparam | $wl_awkcmd '{print $1,$2" "}' |
312 | 5 | simandl | w_bar |
313 | | | else |
314 | 6 | simandl | echo -n "$wl_name " |
315 | | | echo -n "${wlc_mac}$wl_mac${wlc_std} ${wlc_sig}$wl_cnt${wlc_std} " |
316 | 5 | simandl | w_bar |
317 | | | fi |
318 | 4 | simandl | done |
319 | 2 | simandl | |
320 | | | echo |
321 | | | } # w_master |
322 | | | |
323 | | | ###################################################################### |
324 | | | w_iface() |
325 | 6 | simandl | { wl_iwctxt=`$wl_iwccmd $wl_iface 2>/dev/null | grep -v 'Device|Some|Extension' | sed 's/ Nick/_Nick/'` |
326 | | | wl_mode=`echo $wl_iwctxt | $wl_awkcmd '{print $5}' | sed 's/Mode://g'` |
327 | 2 | simandl | if [ "a$wl_mode" = "aManaged" ] |
328 | | | then |
329 | | | w_managed |
330 | 6 | simandl | elif [ "a$wl_mode" = "aAd-Hoc" ] |
331 | | | then |
332 | | | w_managed |
333 | 2 | simandl | elif [ "a$wl_mode" = "aMaster" ] |
334 | | | then |
335 | | | w_master |
336 | | | else |
337 | | | echo $wl_iface $wlm_no_managed_or_master |
338 | | | echo |
339 | | | fi |
340 | | | } |
341 | | | |
342 | | | ###################################################################### |
343 | 6 | simandl | w_version() |
344 | | | { |
345 | | | echo wifimon $wl_version |
346 | | | exit 0 |
347 | | | } |
348 | | | ###################################################################### |
349 | 5 | simandl | w_help() |
350 | | | { |
351 | 3 | simandl | echo Pouziti: wifimon [param] |
352 | | | echo param: |
353 | 6 | simandl | echo -v vypise verzi |
354 | 5 | simandl | echo -html generovani html stranky |
355 | 6 | simandl | echo -col barevny vypis na obrazovku |
356 | 5 | simandl | echo -once vypsani jen jednoho vypisu a pak program skonci |
357 | | | echo -oneline vypsani klientu na jednu linku |
358 | 6 | simandl | echo -ppkts vypsani procentniho pomeru 1M, 2M, 5.5M a 11M paketu pro jednotlive klienty |
359 | | | echo -pkts vypsani poctu 1M, 2M, 5.5M a 11M paketu pro jednotlive klienty |
360 | 5 | simandl | echo -wlan0 -wlan1 -wlan2 vypise jen uvedene karty a to v danem poctu a poradi |
361 | 3 | simandl | echo bez parametru cyklicky vypis na obrazovku |
362 | 5 | simandl | exit 0 |
363 | | | } |
364 | | | ###################################################################### |
365 | | | ###################################################################### |
366 | 2 | simandl | |
367 | 5 | simandl | wl_unknown="" |
368 | | | wl_cnt=1 |
369 | | | wcm_clear=1 |
370 | | | wcm_once=0 |
371 | | | wcm_col=0 |
372 | | | wcm_oneline=0 |
373 | | | wcm_html=0 |
374 | 6 | simandl | wcm_ppkts=0 |
375 | | | wcm_pkts=0 |
376 | 5 | simandl | wcm_ifc="" |
377 | | | |
378 | 6 | simandl | # parsing input parameters |
379 | 5 | simandl | while [ "a$1" != "a" ] |
380 | | | do |
381 | | | case $1 in |
382 | 6 | simandl | -v) |
383 | | | w_version |
384 | | | ;; |
385 | 5 | simandl | -help) |
386 | | | w_help |
387 | | | ;; |
388 | | | -once) |
389 | | | wcm_once=1 |
390 | | | shift |
391 | | | ;; |
392 | | | -oneline) |
393 | | | wcm_oneline=1 |
394 | | | shift |
395 | | | ;; |
396 | | | -col) |
397 | | | wcm_col=1 |
398 | | | shift |
399 | | | ;; |
400 | | | -html) |
401 | | | wcm_html=1 |
402 | | | shift |
403 | | | ;; |
404 | 6 | simandl | -ppkts) |
405 | | | wcm_ppkts=1 |
406 | | | shift |
407 | | | ;; |
408 | | | -pkts) |
409 | | | wcm_pkts=1 |
410 | | | shift |
411 | | | ;; |
412 | 5 | simandl | *) |
413 | | | wl_flg=0 |
414 | | | for wl_iface in `ls $wl_hostap` |
415 | | | do |
416 | | | if [ "a-$wl_iface" = "a$1" ] |
417 | | | then |
418 | | | wcm_ifc="$wcm_ifc $wl_iface" |
419 | | | wl_flg=1 |
420 | | | fi |
421 | | | done |
422 | | | if [ $wl_flg -eq 0 ] |
423 | | | then |
424 | | | wl_unknown="$wl_unknown$1 " |
425 | | | fi |
426 | | | shift |
427 | | | esac |
428 | | | done |
429 | | | |
430 | 6 | simandl | # printing the list of bad parameters (if there are some) |
431 | 5 | simandl | if [ "a$wl_unknown" != "a" ] |
432 | | | then |
433 | | | echo "$wlm_unknown $wl_unknown" |
434 | | | w_help |
435 | | | fi |
436 | | | |
437 | 6 | simandl | # if no interface is selected then all available are choosen |
438 | 5 | simandl | if [ "a$wcm_ifc" = "a" ] |
439 | | | then |
440 | | | wcm_ifc=`ls $wl_hostap` |
441 | | | fi |
442 | | | |
443 | 6 | simandl | # setting for old and last same value to avoid double clear after start |
444 | | | wl_numcllast=0 |
445 | | | wl_numclold=0 |
446 | | | for wl_iface in $wcm_ifc |
447 | | | do |
448 | | | wl_numcl=`ls $wl_hostap$wl_iface | grep -c 00` |
449 | | | wl_numcllast=$(($wl_numcllast + $wl_numcl)) |
450 | | | done |
451 | | | wl_numclold=$wl_numcllast |
452 | | | |
453 | | | if [ $wcm_col -eq 0 ] |
454 | | | then |
455 | | | w_bw |
456 | | | else |
457 | | | w_col |
458 | | | fi |
459 | | | |
460 | | | if [ $wcm_html -eq 1 ] |
461 | | | then |
462 | | | w_bw |
463 | | | [ $wcm_once -eq 1 ] && echo $wl_header || echo $wl_header_refresh |
464 | | | for wl_iface in $wcm_ifc |
465 | | | do |
466 | | | w_iface |
467 | | | done |
468 | | | echo $wl_footer |
469 | | | exit 0 |
470 | | | fi |
471 | | | |
472 | | | #this is main loop and it will be executer forever |
473 | | | while [ 1 ] |
474 | 5 | simandl | do |
475 | 6 | simandl | |
476 | | | # when the number of associated klients has changed we will set for clear screen |
477 | 5 | simandl | if [ $wl_numcllast -ne $wl_numclold ] |
478 | | | then |
479 | | | wl_numclold=$wl_numcllast |
480 | | | wcm_clear=1 |
481 | | | fi |
482 | 6 | simandl | |
483 | | | #if it is set for clear screen we will do it except we produce single report |
484 | | | if [ $wcm_clear -eq 1 -a $wcm_once -eq 0 ] |
485 | 5 | simandl | then |
486 | 6 | simandl | if [ $wl_clear -eq 1 ] |
487 | | | then |
488 | | | clear |
489 | | | else |
490 | | | echo -n $wl_clrcmde |
491 | | | fi |
492 | 5 | simandl | wcm_clear=0 |
493 | | | fi |
494 | | | wl_numcllast=0 |
495 | 6 | simandl | |
496 | | | #for cyclic report we are trying to set cursor to the top left screen corner |
497 | | | if [ $wcm_once -eq 0 ] |
498 | 5 | simandl | then |
499 | 6 | simandl | #when tput is not found then we use clear. It is blinking but better than nothing |
500 | | | if [ $wl_tput -eq 1 ] |
501 | | | then |
502 | | | $wl_tptcmd cup 0 0 |
503 | | | else |
504 | | | if [ $wl_clear -eq 1 ] |
505 | | | then |
506 | | | clear |
507 | | | else |
508 | | | echo -n $wl_clrcmde |
509 | | | fi |
510 | | | fi |
511 | 5 | simandl | fi |
512 | | | |
513 | 6 | simandl | #make report for all desired interfaces |
514 | | | for wl_iface in $wcm_ifc |
515 | | | do |
516 | | | w_iface |
517 | | | done |
518 | | | |
519 | | | #when a single report is needed than we are exiting |
520 | 5 | simandl | if [ $wcm_once -eq 1 ] |
521 | | | then |
522 | | | exit 0 |
523 | | | fi |
524 | | | sleep 1 |
525 | 6 | simandl | done |
526 | 5 | simandl | |
527 | | | exit 0 |
528 | | | |