wifimon |
Subversion Repositories: |
Rev 33 | Rev 36 | |
---|---|---|
Line 2... | Line 2... | |
# authors : Petr Simandl www.simandl.cz |
# authors : Petr Simandl www.simandl.cz | |
# : Fyzik, Covex, Tydyt, Thunder.m |
# : Fyzik, Covex, Tydyt, Thunder.m | |
# release date : 03/06/2006 |
# release date : 29/03/2009 | |
# name : wifimon |
# name : wifimon | |
# description : hostap and madwifi powered card monitoring |
# description : hostap and madwifi powered card monitoring | |
# license : GPL |
# license : GPL | |
###################################################################### |
###################################################################### | |
|
| |
wl_version="0.5.7pre8" |
wl_version="0.5.7pre9" | |
|
| |
###################################################################### |
###################################################################### | |
#custom settings |
#custom settings | |
|
| |
PATH=$PATH:$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin |
PATH=$PATH:$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin | |
Line 37... | Line 37... | |
wl_header_refresh="<html><head><meta HTTP-EQUIV=\"Refresh\" CONTENT=\"15\"><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>" |
wl_header_refresh="<html><head><meta HTTP-EQUIV=\"Refresh\" CONTENT=\"15\"><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>" | |
wl_header="<html><head><title>Wifimon @ `$wl_hnmcmd`</title></head><body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"><pre>" |
wl_header="<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_no_managed=" neni Managed takze neskenuju..." | ||
wlm_scan=" sken" | ||
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 : " | |
#wlm_no_managed_or_master=" is not Master or Managed..." |
#wlm_no_managed_or_master=" is not Master or Managed..." | |
#wlm_number_of_clients="Number of associated clients : " |
#wlm_number_of_clients="Number of associated clients : " | |
|
| |
Line 471... | Line 473... | |
then |
then | |
w_managed |
w_managed | |
elif [ "a$wl_mode" = "aMaster" ] |
elif [ "a$wl_mode" = "aMaster" ] | |
then |
then | |
w_master |
w_master | |
else | ||
echo $wl_iface $wlm_no_managed_or_master | ||
echo | ||
fi | ||
} | ||
| ||
###################################################################### | ||
w_scan() | ||
{ $wl_scancmd 2>/dev/null | awk ' | ||
BEGIN { | ||
nocompleted = 1; | ||
} | ||
| ||
/ - Address:/ { | ||
MAC = $5; | ||
Cell = $2; | ||
} | ||
| ||
/ESSID:/ { | ||
sub("ESSID:", ""); | ||
gsub("\"", ""); | ||
ESSID = $1; | ||
} | ||
| ||
/Frequency:/ { | ||
sub("Frequency:", ""); | ||
Frequency = $1; | ||
sub(")", ""); | ||
Channel = $4; | ||
} | ||
| ||
/Quality=/ { | ||
sub("Quality=", ""); | ||
sub("/", " "); | ||
Quality = $1; | ||
nocompleted = 0; | ||
} | ||
| ||
(nocompleted == 0) { | ||
printf "%s \t %s \t %s ", Channel, Quality, MAC; | ||
for (i = 1; i <= Quality; i++) | ||
printf "#" | ||
print " " ESSID; | ||
} | ||
| ||
{ nocompleted++; } | ||
' | sort -g | uniq | ||
| ||
} | ||
| ||
###################################################################### | ||
w_scaniface() | ||
{ wl_iwctxt=`$wl_iwccmd $wl_iface 2>/dev/null | grep -v 'Device|Some|Extension' | sed 's/ dBm/dBm/' | sed 's/ GHz/GHz/' | sed 's/ Mb/Mb/' | sed 's/ Nick/_Nick/' | sed 's/Access Point/Access_Point/'` | ||
wl_mode=`echo $wl_iwctxt | $wl_awkcmd '{print $5}' | sed 's/Mode://g'` | ||
if [ "a$wl_mode" = "aManaged" ] | ||
then | ||
echo $wl_iface $wlm_scan | ||
wl_scancmd="$wl_iwlcmd $wl_iface scan" | ||
w_scan | ||
elif [ "a$wl_mode" = "aAd-Hoc" ] | ||
then | ||
wl_scancmd="$wl_iwlcmd $wl_iface scan" | ||
echo $wl_iface $wlm_scan | ||
w_scan | ||
elif [ "a$wl_mode" = "aMaster" ] | ||
then | ||
echo $wl_iface $wlm_no_managed | ||
echo | ||
else |
else | |
echo $wl_iface $wlm_no_managed_or_master |
echo $wl_iface $wlm_no_managed_or_master | |
echo |
echo | |
fi |
fi | |
} |
} | |
Line 501... | Line 571... | |
echo -wlan0 -ath0 -wlan2 vypise jen uvedene karty a to v danem poctu a poradi |
echo -wlan0 -ath0 -wlan2 vypise jen uvedene karty a to v danem poctu a poradi | |
echo nasledujici parametry ovlivnuji jen karty s hostap: |
echo nasledujici parametry ovlivnuji jen karty s hostap: | |
echo -rxtxoff vypnuti zobrazeni objemu prenesenych dat klienta |
echo -rxtxoff vypnuti zobrazeni objemu prenesenych dat klienta | |
echo -ppkts vypsani procentniho pomeru 1M, 2M, 5.5M a 11M paketu pro jednotlive klienty |
echo -ppkts vypsani procentniho pomeru 1M, 2M, 5.5M a 11M paketu pro jednotlive klienty | |
echo -pkts vypsani poctu 1M, 2M, 5.5M a 11M paketu pro jednotlive klienty |
echo -pkts vypsani poctu 1M, 2M, 5.5M a 11M paketu pro jednotlive klienty | |
echo -scan vypsani naskenovanych AP | ||
echo "-scanfromfile <file_name> vypsani naskenovanych AP z textoveho souboru (vypis iwlist athX scan)" | ||
echo bez parametru cyklicky vypis na obrazovku |
echo bez parametru cyklicky vypis na obrazovku | |
exit 0 |
exit 0 | |
} |
} | |
###################################################################### |
###################################################################### | |
###################################################################### |
###################################################################### | |
Line 520... | Line 592... | |
wcm_rxtx=1 |
wcm_rxtx=1 | |
wcm_ppkts=0 |
wcm_ppkts=0 | |
wcm_pkts=0 |
wcm_pkts=0 | |
wcm_ifc="" |
wcm_ifc="" | |
wcm_macoff=0 |
wcm_macoff=0 | |
wcm_scan=0 | ||
wcm_scanff=0 | ||
|
| |
# parsing input parameters |
# parsing input parameters | |
while [ "a$1" != "a" ] |
while [ "a$1" != "a" ] | |
do |
do | |
case $1 in |
case $1 in | |
Line 565... | Line 639... | |
wcm_pkts=1 |
wcm_pkts=1 | |
shift |
shift | |
;; |
;; | |
-macoff) |
-macoff) | |
wcm_macoff=1 |
wcm_macoff=1 | |
shift | ||
;; | ||
-scan) | ||
wcm_scan=1 | ||
shift | ||
;; | ||
-scanfromfile) | ||
wcm_scanff=1 | ||
wl_scanfn=$2 | ||
shift | ||
shift |
shift | |
;; |
;; | |
*) |
*) | |
wl_flg=0 |
wl_flg=0 | |
#wlan check |
#wlan check | |
Line 628... | Line 712... | |
if [ $wlf_madwifi -eq 1 ] |
if [ $wlf_madwifi -eq 1 ] | |
then |
then | |
wcm_ifc=`echo $wcm_ifc ; ls $wl_sysdev | grep "ath[0-9]" ; ls $wl_madwifi | grep "ath[0-9]"` |
wcm_ifc=`echo $wcm_ifc ; ls $wl_sysdev | grep "ath[0-9]" ; ls $wl_madwifi | grep "ath[0-9]"` | |
fi |
fi | |
fi |
fi | |
| ||
# in case of scan request we do all scans | ||
if [ $wcm_scan -eq 1 ] | ||
then | ||
for wl_iface in $wcm_ifc | ||
do | ||
w_scaniface | ||
done | ||
exit 0 | ||
fi | ||
| ||
# in case of scan from file request we get the file and process it | ||
if [ $wcm_scanff -eq 1 ] | ||
then | ||
echo $wl_scanfn $wlm_scan | ||
wl_scancmd="cat $wl_scanfn" | ||
w_scan | ||
exit 0 | ||
fi | ||
|
| |
# setting for old and last same value to avoid double clear after start |
# setting for old and last same value to avoid double clear after start | |
wl_numcllast=0 |
wl_numcllast=0 | |
wl_numclold=0 |
wl_numclold=0 | |
for wl_iface in $wcm_ifc |
for wl_iface in $wcm_ifc | |
Line 724... | Line 827... | |
fi |
fi | |
sleep 1 |
sleep 1 | |
done |
done | |
|
| |
exit 0 |
exit 0 | |
|
||
|