jablonka.czprosek.czf

wifimon

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

 

Line No. Rev Author Line
12simandl#!/bin/bash
2# author : Petr Simandl www.simandl.cz
3# release date : 29/12/2002
4# name : wifimon
5# version : 0.1 initial
6# description : hostap powered wifi card monitoring
7# license : GPL
8 
9wl_iwccmd="/usr/local/sbin/iwconfig"
10wl_hostap="/proc/net/hostap/"
11wl_wireless="/proc/net/wireless"
12 
13wlm_no_managed_or_master=" neni ani Master ani Managed..."
14wlm_number_of_clients="Pocet asociovanych klientu : "
15#wlm_no_managed_or_master=" is not Master or Managed..."
16#wlm_number_of_clients="Number of associated clients : "
17######################################################################
18w_bar()
19{
20 until [ "$wl_cnt" -eq -1 ]
21 do
22 printf "="
23 wl_cnt=$(($wl_cnt - 1 ))
24 done
25 printf " \n"
26} # w_bar
27 
28######################################################################
29w_managed()
30{ echo $wl_iwctxt | awk '{print $1,$3,$4,$5" "}'
31 echo $wl_iwctxt | awk '{print $6,$9,$11" "}'
32 #echo $wl_iwctxt | awk '{print $27,$28,$29,$31,$32" "}'
33 #cat $wl_wireless | grep $wl_iface
34 wl_wtxt=`cat $wl_wireless | grep $wl_iface | awk '{print $3,$4,$5}' | sed 's/\.//g'`
35 wl_quality=`echo $wl_wtxt | awk '{print $1}'`
36 wl_signal=`echo $wl_wtxt | awk '{print $2}'`
37 wl_signal=$(($wl_signal - 256))
38 wl_noise=`echo $wl_wtxt | awk '{print $3}'`
39 wl_noise=$(($wl_noise - 256))
40 echo Quality:$wl_quality/92 Signal level:$wl_signal Noise level:$wl_noise
41 wl_cnt=$wl_quality
42 w_bar
43 #wl_cnt=$(($wl_cnt + 100))
44 #w_bar
45 echo
46} # w_managed
47 
48######################################################################
49w_master()
50{ echo $wl_iwctxt | awk '{print $1,$3,$4,$5" "}'
51 echo $wl_iwctxt | awk '{print $6,$9,$11" "}'
52 
53 wl_numcl=`ls $wl_hostap$wl_iface | grep -c 00`
54 echo $wlm_number_of_clients $wl_numcl
55 for wl_mac in `ls $wl_hostap$wl_iface | grep 00`
56 do
57 wl_macparam=`cat $wl_hostap$wl_iface/$wl_mac | grep -E 'last_rx|last_tx'`
58 wl_cnt=`echo $wl_macparam | awk '{print $5}' | sed 's/signal=//g'`
59 echo $wl_mac Signal $wl_cnt $wl_macparam | awk '{print $1,$2,$3,$4,$5" "}'
60 w_bar
61 done
62 
63 echo
64} # w_master
65 
66######################################################################
67w_iface()
68{ wl_iwctxt=`$wl_iwccmd $wl_iface | grep -v 'Device|Some|Extension' | sed 's/ Nick/_Nick/g'`
69 wl_mode=`echo $wl_iwctxt | awk '{print $5}' | sed 's/Mode://g'`
70 if [ "a$wl_mode" = "aManaged" ]
71 then
72 w_managed
73 elif [ "a$wl_mode" = "aMaster" ]
74 then
75 w_master
76 else
77 echo $wl_iface $wlm_no_managed_or_master
78 echo
79 fi
80}
81 
82######################################################################
83######################################################################
84 
85clear
86 
87while [ 1 ]
88do
89 tput cup 0 0
90 for wl_iface in `ls $wl_hostap`
91 do
92 w_iface
93 done
94# tput cup 25 0
95 sleep 1
96done
97 
98exit 0
99 
100 

Powered by WebSVN 2.2.1