jablonka.czprosek.czf

wifimon

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

 

Line No. Rev Author Line
12simandl#!/bin/bash
23simandl# authors : Petr Simandl www.simandl.cz
3#
4# release date : 1/1/2003
52simandl# name : wifimon
63simandl# version : 0.2 beta
72simandl# description : hostap powered wifi card monitoring
8# license : GPL
9 
10wl_iwccmd="/usr/local/sbin/iwconfig"
113simandlwl_ifccmd="/sbin/ifconfig"
12wl_hnmcmd="/bin/hostname"
132simandlwl_hostap="/proc/net/hostap/"
14wl_wireless="/proc/net/wireless"
153simandlwl_arp="/proc/net/arp"
162simandl 
173simandlwl_webpage="/tmp/wifimon.htm"
18wl_header="<html><head><meta HTTP-EQUIV=\"Refresh\" CONTENT=\"1\"><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>"
19wl_header_static="<html><head><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>"
20wl_footer="</pre></body></html>"
21 
222simandlwlm_no_managed_or_master=" neni ani Master ani Managed..."
23wlm_number_of_clients="Pocet asociovanych klientu : "
24#wlm_no_managed_or_master=" is not Master or Managed..."
25#wlm_number_of_clients="Number of associated clients : "
26######################################################################
27w_bar()
28{
29 until [ "$wl_cnt" -eq -1 ]
30 do
31 printf "="
32 wl_cnt=$(($wl_cnt - 1 ))
33 done
34 printf " \n"
35} # w_bar
36 
37######################################################################
38w_managed()
39{ echo $wl_iwctxt | awk '{print $1,$3,$4,$5" "}'
403simandl 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
41 echo $wl_iwctxt | awk '{print $9,$6,$11" "}'
422simandl #echo $wl_iwctxt | awk '{print $27,$28,$29,$31,$32" "}'
43 #cat $wl_wireless | grep $wl_iface
44 wl_wtxt=`cat $wl_wireless | grep $wl_iface | awk '{print $3,$4,$5}' | sed 's/\.//g'`
45 wl_quality=`echo $wl_wtxt | awk '{print $1}'`
46 wl_signal=`echo $wl_wtxt | awk '{print $2}'`
47 wl_signal=$(($wl_signal - 256))
48 wl_noise=`echo $wl_wtxt | awk '{print $3}'`
49 wl_noise=$(($wl_noise - 256))
50 echo Quality:$wl_quality/92 Signal level:$wl_signal Noise level:$wl_noise
51 wl_cnt=$wl_quality
52 w_bar
53 #wl_cnt=$(($wl_cnt + 100))
54 #w_bar
55 echo
56} # w_managed
57 
58######################################################################
59w_master()
60{ echo $wl_iwctxt | awk '{print $1,$3,$4,$5" "}'
61 echo $wl_iwctxt | awk '{print $6,$9,$11" "}'
62 
63 wl_numcl=`ls $wl_hostap$wl_iface | grep -c 00`
64 echo $wlm_number_of_clients $wl_numcl
653simandl for wl_mac in `ls $wl_hostap$wl_iface | grep 00 `
662simandl do
67 wl_macparam=`cat $wl_hostap$wl_iface/$wl_mac | grep -E 'last_rx|last_tx'`
68 wl_cnt=`echo $wl_macparam | awk '{print $5}' | sed 's/signal=//g'`
693simandl wl_umac=`echo $wl_mac | tr abcdef ABCDEF`
70 wl_ipc=`cat $wl_arp | grep $wl_umac | awk '{print $1}'` # IP adresa peeru z arp tabulky
71 echo $wl_ipc $wl_umac Signal $wl_cnt $wl_macparam | awk '{print $1,$2,$3,$4,$5" "}'
722simandl w_bar
73 done
74 
75 echo
76} # w_master
77 
78######################################################################
79w_iface()
80{ wl_iwctxt=`$wl_iwccmd $wl_iface | grep -v 'Device|Some|Extension' | sed 's/ Nick/_Nick/g'`
81 wl_mode=`echo $wl_iwctxt | awk '{print $5}' | sed 's/Mode://g'`
82 if [ "a$wl_mode" = "aManaged" ]
83 then
84 w_managed
85 elif [ "a$wl_mode" = "aMaster" ]
86 then
87 w_master
88 else
89 echo $wl_iface $wlm_no_managed_or_master
90 echo
91 fi
92}
93 
94######################################################################
95######################################################################
96 
973simandlcase $1 in
98-help)
99 echo Pouziti: wifimon [param]
100 echo param:
101 echo -htm cyklicke generovani stranky s 1s obnonovanim
102 echo -htm1 jedna staticka stranka
103 echo bez parametru cyklicky vypis na obrazovku
1042simandl 
1053simandl;;
106-htm1)
107 echo $wl_header_static > $wl_webpage
108 for wl_iface in `ls $wl_hostap`
109 do
110 w_iface >> $wl_webpage
111 done
112 echo $wl_footer >> $wl_webpage
113;;
114-htm)
115 while [ 1 ]
116 do
117 echo $wl_header > $wl_webpage.tmp
118 for wl_iface in `ls $wl_hostap`
119 do
120 w_iface >> $wl_webpage.tmp
121 done
122 echo $wl_footer >> $wl_webpage.tmp
123 cp $wl_webpage.tmp $wl_webpage
124 sleep 1
1252simandl done
1263simandl;;
127*)
128 clear
129 while [ 1 ]
130 do
131 tput cup 0 0
132 for wl_iface in `ls $wl_hostap`
133 do
134 w_iface
135 done
136 sleep 1
137 done
138esac
1392simandl 
140exit 0
141 
142 

Powered by WebSVN 2.2.1