#!/bin/sh export DATE="12.4.2006";SCRIPT=${0#/rom} export TITLE="Estado: OLSR" . ${SCRIPT%/*}/cgi-bin-pre.sh WLDEV=$(awk 'sub(":","") {print $1}' /proc/net/wireless) ff_httpinfo=$(nvram get ff_httpinfo) if [ "$REQUEST_METHOD" = "POST" ]; then read QUERY_STRING fi if [ "$QUERY_STRING" != "${QUERY_STRING#*post_olsr=}" ]; then cat<Estado: OLSR
    EOF if [ "$(nvram get wl0_mode)" != "ap" ];then cat< EOF fi if [ "$ff_httpinfo" != "0" ];then cat< EOF fi cat<
 
EOF wget -O - http://127.0.0.1:8080/all|awk ' /

/, /<\/div>/ { gsub("border=0", "border=1 cellspacing=0 cellpadding=0") gsub("BORDER=0", "BORDER=1") gsub("

EOF elif [ "$QUERY_STRING" != "${QUERY_STRING#*post_route=}" ]; then cat<Estado: Rutas
" } function ip(s) { if(!/\//&&s!="default") { td(sprintf("%s", s, s)) } else { td(s) } } BEGIN { print "<""TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">" } { print "" ip($1) s="" for(i=2;i<=NF;i++) s=s" "$i td(s) print "" } END { print "<""/TABLE>" }' cat<
    EOF if [ "$(nvram get wl0_mode)" != "ap" ];then cat< EOF fi if [ "$ff_httpinfo" != "0" ];then cat< EOF fi cat<
 
EOF ip route ls|awk ' function td(s) { print ""s"
EOF elif [ "$QUERY_STRING" != "${QUERY_STRING#*post_scan=}" ]; then cat<Estado: Búsqueda WLAN
"; } /^SSID:/ { ssid=substr($2, 2, length($2) - 2); chan=" "; adhoc="no"; open="yes"; rssi="0"; titl=" "; rate=" "; bssid=" "; do { if(!(getline))break; if (/Channel:/) { chan=$NF; } if (/Mode:/) { adhoc=($2~/Managed/?"no":"yes"); } if (/RSSI:/) { rssi=int(($(4+($3~/Hoc/))-$(7+($3~/Hoc/)))/4); for(i=3; i<=8; i++) { titl=titl$(i+($3~/Hoc/))" "; } if (0 > rssi) rssi = 0; if (5 < rssi) rssi = 5; } if (/Capability:/) { for(i = 4; i <= NF; i++) { if ($i~/^WEP/) open="no"; } } if (/Supported Rates:/) { rate=$(NF - 1); } if (/BSSID:/) { bssid=$2; } } while(/\S/); print "" print "" print "" print "" print "" print "" print "" print "" print ""; } END { print "
    EOF if [ "$(nvram get wl0_mode)" != "ap" ];then cat< EOF fi if [ "$ff_httpinfo" != "0" ];then cat< EOF fi cat<
 
SSIDCanal Ad-HocOpenSignalMax.BSSID
EOF wl -i $WLDEV scan sleep 2 wl -i $WLDEV scanresults|awk ' BEGIN { print "
"ssid""chan"\""adhoc"\"\""open"\""rate""bssid"
 " }' cat<
EOF else cat<Estado: Resumen
[^>]+", "") sub("
    EOF if [ "$(nvram get wl0_mode)" != "ap" ];then cat< EOF fi if [ "$ff_httpinfo" != "0" ];then cat< EOF fi WLMASK=$(ip -f inet addr show $WLDEV label $WLDEV |awk 'sub("inet","") {print $1}') cat<
 
Dirección IP:IP: $(ip -f inet addr show $WLDEV label $WLDEV |awk 'sub("inet","") {sub("/.*","",$1);print $1}'), Máscara: $(test -n "$WLMASK" && ipcalc -m $WLMASK|cut -d'=' -f2), MAC: $(ip link show $WLDEV|awk 'sub("ether","") {print $2}')
Estado WLAN: $(wl -i $WLDEV status 2>&1)
Tiempo funcionando: $(uptime)
Información aparato :Boardtype: $(nvram get boardtype), Boardnum: $(nvram get boardnum) EOF if [ "$ff_httpinfo" != "0" ];then cat<
Información aparato: EOF wget -O - http://127.0.0.1:8080/nodes|awk ' /

/,/<\/div>/ { if ($1~/

/) { prnt=($1~/Links/) } else if (prnt) { sub("<""table[^>]+>", "<""table frame=void border=1 cellspacing=0 cellpadding=1 width=100%>") sub("

remote IP", "IP") sub("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+", "&") print } }' fi cat<
Log del Kernel: Muestra / Esconde
EOF echo -n '' if pidof syslogd>/dev/null;then cat<
Log de sistema: Muestra / Esconde
EOF echo -n '' fi cat<
IP NAT: Muestra / Esconde
EOF echo -n '' cat<
Configuración de Interfaz: Muestra / Esconde
EOF echo -n '' cat<
Configuración de NVRAM: Muestra / Esconde
EOF echo -n '' cat<
===Active Connections===: Muestra / Esconde
EOF echo -n '
EOF if [ "00:90:96:00:00:00" = "$(nvram get et0macaddr)" ] || [ "00:90:96:00:00:02" = "$(nvram get il0macaddr)" ]; then cat< ===Warning: This SE505 device does not have the correct MAC address. Read the MAC address from the bottom of the device and correct manually on the command line shell, e.g. with nvram set et0macaddr=xx:xx:xx:xx:xx:xx, nvram set il0macaddr=xx:xx:xx:xx:xx:[xx+1], nvram commit and reboot===

EOF fi fi . ${SCRIPT%/*}/cgi-bin-post.sh