#!/bin/sh # INFOPAGEVERSION="0.97-(19.apr.2006)" # # # author ........: bastian bittorf / weimar.freifunk.net # contact .......: infopage.20.bastian at spamgourmet dot org # licence .......: GPL # needs .........: ash,wl,busybox (awk,cat,cut,echo,grep,ipcalc,wget) # # This script generates helpful infos about your fff-openwrt-router # Its main purpose was to avoid loading hundreds of kilobytes from # slow longrange wireless-links only to get some infos. # Output is HTML,but human AND machine-readable & ~1500 bytes. # # ToDo: # - determine exact hardware type from board values ("wrt54gs v1.1") # - determine runtime and memoryusage for each task # - reduce memoryusage / speedups # # Features: http://.../cgi-bin-info.html?OPTION ,where OPTION can be: # n -> normal mode,precalculated page # m=600 -> (not yet!) changes looping of precalculated page to 600 seconds # l -> livedata # L -> list all nodes # f -> freemem # o -> opensource of this script # g -> only gpsdata+location # m -> collect gpsdate from all nodes # M=23 -> paint SVG-map from hole network (max 23 hops away) # G -> (not yet!) collect from all nodes gps-info # k -> (not yet!) outputs SVG-map of actual mesh # s -> starts oder ends SSHd / dropbear # d=345 -> download of 345kb trash # D=567 -> downloads from you 567kb trash # a -> (not yet!) allow/disallow download # i -> lists installed software # r -> print syslog # rChild -> print syslog and grep "Child" # r-v MARK -> print syslog,except lines with "MARK" # wMESSAGE -> inject message into routers syslog # h -> much hardware info # t -> timeserver for "date -s ..." # v -> show sorted nvram-set # V -> show sorted nvram-set & summary # nothing -> help-page # # ----------------------------------------------------------------------------- # # parsing # CODE=$(echo $QUERY_STRING|awk '{print substr($0,1,1)}') # # SSHd - control # For mem-saving, we don't start SSHd at startup # on demand,you can enable/disable SSHd # if [ "$CODE" = "s" ] then echo -e "Content-type: text/plain\n" if [ "$(ps|grep dropbear|grep -v grep)" = "" ] then /usr/bin/dropbear echo "SSHd wurde gestartet!" else killall dropbear echo "Beenden von SSHd erfolgreich!" fi exit fi # # telnetd - control # on demand,you can enable/disable telnetd. # hint: end it after use, no password is needed... # if [ "$CODE" = "T" ] then echo -e "Content-type: text/plain\n" if [ "$(ps|grep telnetd|grep -v grep)" = "" ] then telnetd echo "telnet-dienst wurde gestartet - nach Gebrauch wieder beenden!" else killall telnetd echo "Beenden vom telnet-dienst erfolgreich..." fi exit fi # # Memcheck # Its better to not run the script,if router is low on memory... # if [ "$(awk '{if($1=="Mem:"){print $4;exit}}' /proc/meminfo)" -lt 1000000 ] then echo -e "Content-type: text/plain\n\nOh oh oh! - da ist mir zuwenig Speicher frei (kleiner 1Mb) .... 8-)" exit fi # # Lists IPKG-Packages # if [ "$CODE" = "i" ] then echo -e "Content-type: text/plain\n\n" ipkg status exit fi # # For speedtests i implemented a download from /dev/zero with # determinable download size by query string. # For security reasons I check the number, if its in range (1-9999kb) # if [ "$CODE" = "d" ] then BIG=$(echo $QUERY_STRING|awk '{ fs=substr($0,3) if(fs>9999)fs=9999 if(fs<1)fs=1 fs=int(fs) print fs }') echo -e "Content type: application/octet-stream\n" dd if=/dev/zero bs=1k count=$BIG exit fi if [ "$CODE" = "M" ] then #PAT soll mal maximal hops werden,doch woher nehmen? PAT=$(echo $QUERY_STRING|awk '{pattern=substr($0,3);if(length(pattern)==0)pattern="99";print pattern}') echo -e "Content-type: image/svg+xml\n";echo "" echo "" echo "Nodekarte" wget -O - http://127.0.0.1:8080/nodes|awk >/tmp/d '{c++ if(index($0,"Topology")==5){c=-9999;d=1} if(index($0,"")==1 && d==1)exit if(c<0 && c>-9998){gsub(/[<>]/," ");print $3,$6,$15}}' cat /tmp/d|awk '{print $1;print $2}'|sort|uniq|awk >/tmp/dd -F "[. ]" 'BEGIN{srand(23)}{ ip=$1"."$2"."$3"."$4 x[ip]=int(rand()*980) y[ip]=int(rand()*670) textx=x[ip]-15 texty=y[ip]+4 text=$3"-"$4 radius=16 if($4==254 || $4==1){text=$3;textx=textx+3} print ""text"" }END{ while("cat /tmp/d"|getline){ ip1=$1"."$2"."$3"."$4 ip2=$5"."$6"."$7"."$8 etx=int($9) r=192; g=192; b=192; s=0.5 if(etx==1){r=128; g=255; b=0 ; s=1} if(etx==2){r=255; g=255; b=0 ; s=1} if(etx==3){r=255; g=128; b=64 ; s=1} if(etx==4){r=255; g=128; b=128; s=1} if(etx==5){r=255; g=0 ; b=0 ; s=0.5} print ""}}' cat /tmp/dd|awk '{if($1!="" exit fi # # List of all nodes. sorted. numbered # if [ "$CODE" = "L" ] then echo -e "Content-type: text/plain\n" ip route|awk '{if(index($0,"via")>0 && index($0,"/")==0 && index($0,"default")==0){print $1}}END{system("nvram get wifi_ipaddr")}'|sort|awk '{c++;print c,$0}' exit fi # # some elementary infos on actual system. # freemem,load,tasklist # if [ "$CODE" = "f" ] then echo -e "Content-type: text/plain\n" uptime echo "---" cat /proc/meminfo echo "---" df -h echo "---" ps exit fi # # # if [ "$CODE" = "D" ] then echo -e "Content-type: text/plain\n" echo $REMOTE_ADDR|awk -v size=$QUERY_STRING '{ z=$1 size=substr(size,3) while("ip route|grep "z|getline){face=substr($0,index($0,"dev")+4,5);break} close("ip route|grep "z) while("cat /proc/net/dev|grep "face|getline){b1=substr($1,index($1,":")+1);if(length(b1)<1)b1=$2} close("cat /proc/net/dev|grep "face) getline t1<"/proc/uptime";t1=substr(t1,1,index(t1," ")-1) if (0==ERRNO) close("/proc/uptime") system("wget -qO /dev/null 2>/dev/null http://"z"/cgi-bin-info.html?d="size) getline t2<"/proc/uptime";t2=substr(t2,1,index(t2," ")-1) if (0==ERRNO) close("/proc/uptime") while("cat /proc/net/dev|grep "face|getline){b2=substr($1,index($1,":")+1);if(length(b2)<1)b2=$2} close("cat /proc/net/dev|grep "face) if((b2-b1)>(size*800)){ printf "%4.0f",size/(t2-t1) } else print "n/a)" }' exit fi # # Output NV-RAM-set # private fields are filled with "***" # Output is sorted for better diffs between routers # V gives an summary of blocks # if [ "$CODE" = "v" ] then echo -e "Content-type: text/plain\n" MAX=$(nvram show 2>/dev/null | awk '{f=index($0,"=");if(f>max)max=f}END{print max-1}') nvram show 2>/dev/null | sort | awk -v max=$MAX -F "=" '{z=$2;if(length($2)>30 && index($2,".")==0)z=substr($2,1,30)"...";printf "%-"max"s = \"%s\"\n",$1,z}' exit fi if [ "$CODE" = "V" ] then echo -e "Content-type: text/plain\n" MAX=$(nvram show 2>/dev/null | awk '{f=index($0,"=");if(f>max)max=f}END{print max-1}') nvram show 2>/dev/null | awk -v max=$MAX -F "=" '{ z=$2 b=b+length($1)+length($2)+1 if(length($2)>30 && index($2,".")==0) z=substr($2,1,30)"..." m++ if(index($1,"ff_")=="1")f++ if(index($1,"lan_")=="1")l++ if(index($1,"wan_")=="1")w++ if(index($1,"vlan")=="1")v++ if(index($1,"wifi_")=="1")w++ if(index($1,"wl0_")=="1")i++ printf "%-"max"s = \"%s\"\n",$1,z}END{ print "- "f" x ff_*" print "- "l" x lan_*" print "- "w" x wan_*" print "- "v" x vlan_*" print "- "w" x wifi_*" print "- "i" x wl0_*" print "- "m" all-in-all ("b" bytes)" m=m-i-w-v-w-l-f print "- "m" x other..." print "---------------------------------------"}'|sort exit fi # # SSHd - control # For mem-saving, we don't start SSHd at startup # on demand,you can enable/disable SSHd # if [ "$CODE" = "s" ] then echo -e "Content-type: text/plain\n" if [ "$(ps|grep dropbear|grep -v grep)" = "" ] then /usr/bin/dropbear echo "SSHd wurde gestartet!" else killall dropbear echo "Beenden von SSHd erfolgreich!" fi exit fi # # Skript source-code # if [ "$CODE" = "o" ] then echo -e "Content-type: text/plain\n" cat cgi-bin-info.html exit fi # # Introducing HTMLoutput for client-browser # Sadly we have to use text/html rather than text/plain,because # i want to use for some bold-text = better humanreadable # echo -e "Content-type: text/html\n" # # Some help # if [ "$CODE" = "" ] then echo -e "
Some help for dummies...\n"
  cat /www/cgi-bin-info.html | awk '{if($2=="author")d=1;if(length($2)>75)d=0;if(d=="1")print substr($0,3)}'
 exit
fi

#
# Hardware Info
# Much! Separeted into fix and not-so-fix values
# We generate an checksum from the fixed ones to determine exact 
# hardware type.
#

if [ "$CODE" = "h" ]
 then  
 echo "
fix"
 cat /tmp/dmesg | awk >/tmp/t -F "/" '{
  if(index($0,"CPU revision")>0)print $0
  if(index($0,"CPU:")>0)print substr($0,1,length($0)-10)
  if(index($0,"Primary")==1)print
  if(index($0,"Memory:")>0)print "Memory: "substr($2,1,7)
  if(index($0,"eth0:")==1)print substr($0,1,length($0)-17)
  if(index($0,"eth1:")==1)print
  if(index($0,"ttyS")==1)print substr($0,1,21)substr($0,length($0)-10)
  if(index($0,"Physically mapped flash:")==1 && c<1){print;c++}
  if(index($0,"diag boardtype:")==1)print
  }'
  wl >>/tmp/t revinfo
  cat /tmp/t
  echo "fix-index"
  cat /tmp/t | awk '{s=s""$0}END{print s}'|md5sum|awk '{print substr($0,1,10)}'
  rm /tmp/t
  echo "unfix"
  wl ver|grep "wl:"
  wl dump
  echo -e "phylist: "$(wl phylist)
  wl pktcnt
 exit
fi

#
# Remote-Logging
# For collecting events in big networks, you can log
# special things to central routers syslog. For example 
# I announce a special hna4-address on every 0.0.0.0/0-hna4
# For security-reasons,all redirecting-chars are removed (<,>,|)
#

if [ "$CODE" = "w" ]
 then
 echo $(echo $QUERY_STRING|awk '{gsub(/[<>|]/,"");print substr($0,2)}') | logger -p user.err -t $REMOTE_ADDR
 echo "K"
 exit
fi

#
# Deliver syslog - no need to know if circular buffer or
# syslog to file is used - this script catches all 8-)
# For security-reasons,all redirecting-chars are removed (<,>,|)
#
#

if [ "$CODE" = "r" ]
 then
  echo -e "
"
  PAT=$(echo $QUERY_STRING|awk '{gsub(/[<>|]/,"");pattern=substr($0,2);if(length(pattern)==0)pattern=":";print pattern}')
  MODE=$(ps | awk '{if($5=="syslogd"){if($6=="-O")print substr($0,index($0,"-O")+3);if($6=="-C")print "CB";exit}}')
  if [ "$MODE" = "CB" ]
   then 
   logread | grep $PAT
  fi
  if [ "$MODE" != "CB" ]
   then
   cat $MODE | grep $PAT
  fi
 exit
fi

#
# Time-String
# For easy syncronising a big network you have 3 possibilitys:
# - rdate from internet - not that good
# - rdate from internal timeserver - not that decentral/needs NTP-Server
# - date -s $(wget -O - http://$(nextneighbourip)/cgi-bin-info.html?t) 
# All 3 situations: loop till year is bigger then 2005 or something...
#

if [ "$CODE" = "t" ]
 then
 date -Isec | awk -F "-" '{print $2substr($3,1,2)substr($3,4,2)substr($3,7,2)$1"."substr($3,10,2)}'
 exit
fi

#
# Evaluating query-string
# For faster access the hole infopage will be silently generated 
# trough /etc/init.d/S97infopage every 6 hours. Only if you specify an url+"?l" 
# you get livedata, but you have to wait some seconds.  
#
#
# If query is "g",then shortinfo is delivered. (for SVG-topology)
# This means invalid HTML,only needed for machine2machine talking 8-)
# The strang awk-calculating is some sort of value-checking...
# Format: gpsx,gpsy,location
#

GPSX=$(nvram get gpsx|awk '{print $0*1000/100/10}')
GPSY=$(nvram get gpsy|awk '{print $0*1000/100/10}')
if [ "$CODE" = "g" ]
 then
  nvram get ff_adm_note|awk '{split(substr($0,index($0,"GPS:")+5),b);printf "%s %s ",b[1],b[2]}'
  nvram get ff_adm_loc
 exit
fi

#
# Delivering "precalculated" page...
#

if [ "$CODE" != "l" ]
 then 
 cat /tmp/infopage.txt
 exit
fi

#
# WIFI-scan
# Starting wifiscan. We check out the results later 
# to give the wireless-device some time for the job.
#

wl scan

#
# IPs and netmasks in HTML-Title
# For better orientation with multiple tabs i prefer to
# read the wifi/lan-IPs and "short" netmasks in title.
#

echo ""$(
 nvram get wifi_ipaddr)/$(
  ipcalc -p $(nvram get wifi_netmask)|
   awk -F= '{print $2}'),$(
 nvram get lan_ipaddr)/$(
  ipcalc -p $(nvram get lan_netmask)|
   awk -F= '{print $2}')"
"

#
# Calculating signal-noise-difference
# ash cant handle adding negative numbers,
# so i make them positve with "number*-1"
# does anyone know a simpler/faster/better way?
#

echo "WLAN"
echo "SIGNALRAUSCHABSTAND: "$(
 echo $(($((($(wl noise|awk '{print $3}'))*-1))-$(($(wl rssi|awk '{print $3}')*-1)))))

#
# SSID. 
# I never heard of associated routers with different SSID,
# so i think its enough to print the configured SSID.
#

echo "SSID/BSSID: "$(nvram get wl0_ssid) / $(
 wl assoc | awk '{if($1=="BSSID:"){print $2;exit}}')

#
# Channel und transmit/output-power.
# In fact we know the beavior of routers which
# have different real and conifgured values.
# Here we can track this.
#

echo "KANAL/_real/mW/_real: "$(
 nvram get wl0_channel)/$(
 wl assoc|grep Channel|awk '{print $11}')/$(
 nvram get ff_txpwr)/$(
 wl txpwr|awk '{print $3}')
 
#
# Used Antenna / diversity
# Here we track the configured
# transmit and receive-antennas.
# To save time we take defaults ("2").
#

g=2
if [ "$(nvram get wl0_antdiv)" = "0" ];then g=L;fi
if [ "$(nvram get wl0_antdiv)" = "1" ];then g=R;fi
h=2
if [ "$(nvram get ff_txant)" = "0" ];then h=L;fi
if [ "$(nvram get ff_txant)" = "1" ];then h=R;fi
echo "Empf/SendANT: "$g/$h

#
# Use of B-mode or G-mode (801.11b/g 11/54mbit)
# We know the beavior of broadcom-adhoc-mode.
# After some time a big ad-hoc network falls into
# B-mode and normally never raises into G.
# Here we track configured and real mode.
#

h=BG
if [ "$(nvram get wl0_gmode)" = "0" ];then h=B;fi
if [ "$(nvram get wl0_gmode)" = "2" ];then h=G;fi
echo "MODE/_real: "$h/$(
 if [ "$(wl assoc|grep "Supported"|awk '{printf $15}')" = "54" ]
  then echo G
  else echo B
 fi)                                  

#
# Baserate.
# Nothing to say.
#

echo "BASERATE: "$(
 nvram get wl0_rateset)

#
# Transmit-rate.
# Here we can see the configured max-rate
# and the real,actual rate. i.e. 0/5.5

echo "RATE/_real: "$(
 nvram get wl0_rate)/$(
 wl rate|awk '{print $3}')
 
#
# CTS & Frameburst
# Configured values.
#
 
echo "CTS/BURST: "$(
 nvram get wl0_gmode_protection)/$(
 nvram get wl0_frameburst)

#
# FragmentationHold, RTS , MTU
# Configrued values.
#

echo "FRAG/RTS/MTU/_real: "$(
 nvram get wl0_frag)/$(
 nvram get wl0_rts)/$(
 nvram get ff_mtu)/$(
 cat /proc/net/rt_cache | awk '{if($1=="eth1"){print $9;exit}}')

#
# WEP-crypto on/off
# We know the behavior of routers which
# have configured wep but running uncrypted,
# and the opposite. Here we track this.
#

echo "WEP/_real: "$(
 nvram get wl0_wep)/$(
 if [ "$(wl assoc|grep WEP|awk '{print $5}')" = "WEP" ]
  then echo on
  else echo off
 fi)

#
# Contact-infos
# Configured values. In our contact-page we
# included 2 fields for gpsdata. They can easy
# obtained through www.maporama.com
#

echo "KONTAKT"
echo "MAIL: "$(
 nvram get ff_adm_mail)
echo "FON: "$(
 nvram get ff_adm_tel)
echo "ORT/GPSX/Y: "$(
 nvram get ff_adm_loc)/$(nvram get ff_adm_note|awk '{
  split(substr($0,index($0,"GPS:")+5),b);printf "%s %s ",b[1],b[2]}')

#
# uptime
# Time since last reboot, calculated in hours.
#

echo "SYSTEM"
echo "UP: "$(
 cat /proc/uptime|awk '{printf "%1.1f",$1/3600}')h

#
# Free memory, free diskspace
# Something special. Here we add some offset-kilobytes
# to the actual value,to have the "real" amount
# when not running the script.
# The method to show diskspace is not optimal.
# Anyone knows a better way?
#

OFFSET=860
echo "FREEMEM/DISK: "$(
 cat /proc/meminfo|awk '{if($1=="Mem:"){print ($4/1024)+$OFFSET;exit}}')kb/$(
 df|awk '{if($1=="/dev/mtdblock/4"){print$4;exit}}')kb

#
# Version FFF,OLSRd, this infopage and excution time.
# Not that elegant,but the most reliable way i think.
# On another day i will make this in one loop.
#

echo "vFFF/OLSRd/INFOPAGE/TIME: "$(
 ipkg status|awk '{ 
  if(index($0,"webadmin")>1) a++
  if (a>0) {b++
   if (b==4) print $2
   break} }')/$(
 ipkg status|awk '{ 
  if(index($0,"olsrd")>1) a++
  if (a>0) {b++
   if (b==5) print $2
   break} }')"/"$INFOPAGEVERSION"/"$(
 date)

#
# CPU-infos.
# At router-startup runs an script in "/etc/init.d/S..saveklog"
# We need this to save the kernel-log, because later this log
# is filled with (for this skript) useless infos.
# CPU-load is given in percent. Its wrong but nicer 8-)
# Does anyone need bogomips? 
#

cat /tmp/dmesg|awk '{
 if($1=="CPU")a=$4
 if($1=="CPU:"){printf $0;printf " / Rev. "a
 exit}}'
cat /proc/loadavg|awk '{
 printf " /";printf "%3.0f",$3*100}'
cat /proc/cpuinfo|awk '{
 if($1=="cpu")printf "%% / "$4"-"$5
 if($1=="BogoMIPS"){print " / "$3"bmips"
 exit}}'

#
# OLSR-uptime
# Maybe interesting to know.
# Hint: for all OLSR-infos should be
# the httpinfo-plugin enabled.
# There is an bug in the olsr-httpinfo-plugin,that reports
# an incorrect uptime,when date/time is set to a new/later value
# after starting olsrd.
# 

echo "OLSR"
echo "UP/eth1-ROUTES/avgMETRIC: "$(
 wget -O - http://127.0.0.1:8080|awk -F "i>" '{
  if($1=="Olsrd uptime: <"){
   print substr($2,1,length($2)-8)
   exit}}')/$(ip route|awk -F "metric" -v c=0 '{
    if(index($0,"eth1")>0 && index($0,"/")==0 && index($0,"default")==0){
    c++;s=s+$2}}END{print " "c" / ";if(c>0)printf "%2.2f\n",s/c;else print "n/a"}')

#
# OLSR-Timing
# Does this often misunderstood expression work?
#

cat /etc/olsrd.conf|awk '{
 if($1=="LinkQualityWinSize")a=$2
 if($1=="HelloInterval")b=$2
 if($1=="HelloValidityTime"){
  c=$2;d="!="
  if (c-(a*b)==0)d="="
  print "HEIn*WSize=HEVal?:",b" x "a,d,c
  exit} }'

#
# Filter, OLSR-dhcp, HNA4, LQ
# Configured values.
# Maybe we should better parse olsrd.conf?
#

echo "FILTER: "$(
 nvram get ff_ign)
echo "DHCP: "$(
 nvram get ff_wldhcp)
echo "HNA4: "$(
 nvram get ff_hna4)
echo "LQ: "$(
 nvram get ff_lqmult)

#
# OLSRd-PlugIns
# All configured plugins from olsrd.conf
# Version information included.
#

echo "PLUGIN: "$(
 cat /etc/olsrd.conf|awk '{
  if($1=="LoadPlugin") printf $2"/" }')

#
# DNS-server
# Search-order for name-servers. Normally the router
# itself (127.0.0.1) and then the dnsmasq-entry
#

echo "CLIENTS"
cat /etc/resolv.conf|awk '{
 if($1=="nameserver")printf "DNSSERVER: "$2"/"}'
cat /etc/dnsmasq.conf|awk -F "=" '{
 if(index($0,"server=")>0){
  print $2
  exit}}'

#
# DHCP-clients
# All dhcp-leases. Maybe we should for
# private reasons delete the mac-addresses.
#

cat /var/run/dhcp.leases|awk '{
 print $2,$3,$4}'

#
# INET-gateways
# All 0.0.0.0/0-HNA4-Announced inet-gateways.
# Sorted, best ETX-values are top.
# For sparing mem, I think about an other method
# to download some data...
#

echo "ETX/INETGATE/HOPS/SPEED"
a=$(wget -O - http://127.0.0.1:8080/nodes|awk -F "<" '{
 if($0=="

MID entries

"){ print "EOF" exit} if(substr($0,1,40)=="0.0.0.00.0.0.0"){ z=substr($7,4) while("ip route|grep "z|getline){print $7}}}') echo $a|awk '{ split($0,b) while(b[c+1]!="EOF"){ c++;print "c:"c"-" while("wget -O - http://127.0.0.1:8080/routes"|getline){ split($0,r,"") z=substr(r[2],1,length(r[2])-5) if(length(z)>0) if(z==b[c]){ etx=substr(r[5],1,length(r[5])-5) if(etx>99) etx="99.99" printf "%5.2f",etx printf " - " printf b[c] printf " - " print b[c+1] break }} c++ close("wget -O - http://127.0.0.1:8080/routes") }}'| sort # # Neighbourhood # All direct neighbours, sorted. # Best ETX-values are bottom. # ETX > 99 will be "translated" to 99. # This means "senseless". # Maybe i should also filter ETX 0.00 ? # Maybe i should make hyperlinks for faster # exploring some nodes ? (more output!) # with ?d and ?D we made a download/upload # from each neighbour - regarding to etx-value # echo "ETX/NACHBAR/DL/UL" wget -O - http://127.0.0.1:8080/nodes|awk '{ if($0=="") exit a++ if(a>21){ split($0,b,"") c=substr(b[8],1,4) if(c>99) c="99.99" printf "%5.2f ",c z=b[2] printf "- " split(z,zz,".") printf("%03s%s%03s%s%03s%s%03s%s",zz[1],".",zz[2],".",zz[3],".",zz[4]) printf " - (" while("ip route|grep "z|getline){face=substr($0,index($0,"dev")+4,5);break} close("ip route|grep "z) while("cat /proc/net/dev|grep "face|getline){b1=substr($1,index($1,":")+1);if(length(b1)<1)b1=$2} close("cat /proc/net/dev|grep "face) getline t1<"/proc/uptime";t1=substr(t1,1,index(t1," ")-1) if (0==ERRNO) close("/proc/uptime") size=100;if(c!="0.00")size=3000/c system("wget -qO /dev/null 2>/dev/null http://"z"/cgi-bin-info.html?d="size) getline t2<"/proc/uptime";t2=substr(t2,1,index(t2," ")-1) if (0==ERRNO) close("/proc/uptime") while("cat /proc/net/dev|grep "face|getline){b2=substr($1,index($1,":")+1);if(length(b2)<1)b2=$2} close("cat /proc/net/dev|grep "face) if((b2-b1)>(size*800)){ printf "%4.0f%s",(size/(t2-t1))," / " system("wget -O - http://"z"/cgi-bin-info.html?D="size) print " kb/s)"} else print "n/a)" }}'|sort # # Wifi-scan # The now hopefully ready wifi-scan (see on top) # will be formatted. Its only purpose is the have # an overview of channel-density. Therefore no # crypto-infos etc. # Sorted by signal-noise-difference. # echo "SIGNALRAUSCHABSTAND/SSID/KANAL" wl scanresults|awk '{ if($1=="SSID:")d=$2;a=index($0,"RSSI:") if(a>0){b=substr($0,a+6,3);c=substr($0,a+21,3);e=b-c; if(e<0)e=0;printf"%2.0f ",e;print d,substr($0,a+38)} }'|sort # # End! Because of saving output-filesize # HTML-endtag is not needed 8-) #