wifimon |
Subversion Repositories: |
Rev 8 | Rev 9 | |
---|---|---|
Line 1... | Line 1... | |
#!/bin/bash |
#!/bin/bash | |
# authors : Petr Simandl www.simandl.cz |
# authors : Petr Simandl www.simandl.cz | |
# : Fyzik |
# : Fyzik, Covex | |
# release date : 9/3/2003 |
# release date : 16/6/2003 | |
# name : wifimon |
# name : wifimon | |
# version : 0.4beta3 |
||
# description : hostap powered wifi card monitoring |
# description : hostap powered wifi card monitoring | |
# license : GPL |
# license : GPL | |
| ||
wl_version="0.4beta4" | ||
|
| |
wl_iwccmd="/usr/local/sbin/iwconfig" |
wl_iwccmd="/usr/local/sbin/iwconfig" | |
wl_ifccmd="/sbin/ifconfig" |
wl_ifccmd="/sbin/ifconfig" | |
wl_hnmcmd="/bin/hostname" |
wl_hnmcmd="/bin/hostname" | |
wl_hostap="/proc/net/hostap/" |
wl_hostap="/proc/net/hostap/" | |
Line 28... | Line 29... | |
wlc_sig=$wlc_red # signal number color |
wlc_sig=$wlc_red # signal number color | |
wlc_bar=$wlc_green # signal bar color |
wlc_bar=$wlc_green # signal bar color | |
|
| |
wl_webpage="/tmp/wifimon.htm" |
wl_webpage="/tmp/wifimon.htm" | |
wl_header="<html><head><meta HTTP-EQUIV=\"Refresh\" CONTENT=\"3\"><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>" |
wl_header="<html><head><meta HTTP-EQUIV=\"Refresh\" CONTENT=\"3\"><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>" |
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_unknown="Nezname parametry nebo neplatne jmeno rozhrani : " |
wlm_unknown="Nezname parametry nebo neplatne jmeno rozhrani : " | |
Line 96... | Line 96... | |
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 | |
wl_numcllast=$(($wl_numcllast + $wl_numcl)) |
wl_numcllast=$(($wl_numcllast + $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' | sed 's/last_//g'` | |
wl_cnt=`echo $wl_macparam | awk '{print $5}' | sed 's/signal=//g'` |
wl_cnt=`echo $wl_macparam | awk '{print $5}' | sed 's/signal=//g'` | |
wl_ipc=`cat $wl_arp | grep -i $wl_mac | awk '{print $1}'` # IP adresa peeru z arp tabulky |
wl_ipc=`cat $wl_arp | grep -i $wl_mac | awk '{print $1}'` # IP adresa peeru z arp tabulky | |
wl_name=`cat /etc/dhcpd.conf | grep -i $wl_mac | awk '{print $2}'` |
wl_name=`cat /etc/dhcpd.conf | grep -i $wl_mac | awk '{print $2}'` | |
if [ $wcm_oneline -eq 0 ] |
if [ $wcm_oneline -eq 0 ] | |
then |
then | |
Line 121... | Line 121... | |
echo |
echo | |
} # w_master |
} # w_master | |
|
| |
###################################################################### |
###################################################################### | |
w_iface() |
w_iface() | |
{ wl_iwctxt=`$wl_iwccmd $wl_iface | grep -v 'Device|Some|Extension' | sed 's/ Nick/_Nick/g'` |
{ wl_iwctxt=`$wl_iwccmd $wl_iface 2>/dev/null | grep -v 'Device|Some|Extension' | sed 's/ Nick/_Nick/g'` | |
wl_mode=`echo $wl_iwctxt | awk '{print $5}' | sed 's/Mode://g'` |
wl_mode=`echo $wl_iwctxt | awk '{print $5}' | sed 's/Mode://g'` | |
if [ "a$wl_mode" = "aManaged" ] |
if [ "a$wl_mode" = "aManaged" ] | |
then |
then | |
w_managed |
w_managed | |
elif [ "a$wl_mode" = "aAd-Hoc" ] |
elif [ "a$wl_mode" = "aAd-Hoc" ] | |
Line 138... | Line 138... | |
echo $wl_iface $wlm_no_managed_or_master |
echo $wl_iface $wlm_no_managed_or_master | |
echo |
echo | |
fi |
fi | |
} |
} | |
|
| |
###################################################################### | ||
w_version() | ||
{ | ||
echo wifimon $wl_version | ||
exit 0 | ||
} | ||
###################################################################### |
###################################################################### | |
w_help() |
w_help() | |
{ |
{ | |
echo Pouziti: wifimon [param] |
echo Pouziti: wifimon [param] | |
echo param: |
echo param: | |
echo -v vypise verzi | ||
echo -html generovani html stranky |
echo -html generovani html stranky | |
echo -col barevny cyklicky vypis na obrazovku |
echo -col barevny cyklicky vypis na obrazovku | |
echo -once vypsani jen jednoho vypisu a pak program skonci |
echo -once vypsani jen jednoho vypisu a pak program skonci | |
echo -oneline vypsani klientu na jednu linku |
echo -oneline vypsani klientu na jednu linku | |
echo -wlan0 -wlan1 -wlan2 vypise jen uvedene karty a to v danem poctu a poradi |
echo -wlan0 -wlan1 -wlan2 vypise jen uvedene karty a to v danem poctu a poradi | |
Line 167... | Line 174... | |
|
| |
# parsing input parameters |
# parsing input parameters | |
while [ "a$1" != "a" ] |
while [ "a$1" != "a" ] | |
do |
do | |
case $1 in |
case $1 in | |
-v) | ||
w_version | ||
;; | ||
-help) |
-help) | |
w_help |
w_help | |
;; |
;; | |
-once) |
-once) | |
wcm_once=1 |
wcm_once=1 | |
Line 239... | Line 249... | |
if [ $wl_numcllast -ne $wl_numclold ] |
if [ $wl_numcllast -ne $wl_numclold ] | |
then |
then | |
wl_numclold=$wl_numcllast |
wl_numclold=$wl_numcllast | |
wcm_clear=1 |
wcm_clear=1 | |
fi |
fi | |
if [ $wcm_clear -eq 1 ] |
if [ $wcm_clear -eq 1 -a $wcm_html -ne 1 ] | |
then |
then | |
clear |
clear | |
echo ahoj | ||
wcm_clear=0 |
wcm_clear=0 | |
fi |
fi | |
wl_numcllast=0 |
wl_numcllast=0 | |
if [ $wcm_html -eq 1 ] |
if [ $wcm_html -eq 1 ] | |
then |
then |