#!/usr/bin/haserl <%in /www/include/header %>
<% htmloutput=0 devs=$(iw dev | sed -n '/^phy/,/Interface/{s/^.*Interface //p}') for dev in $devs do scanresult="$(iw dev $dev scan)" if [ $? -ne 0 ]; then continue; fi %>
Wifi Scan: <% echo -n $dev %> <% echo "$scanresult" | sed 's/^BSS/\nBSS/g' |\ awk -v RS='' '{r = gensub(/.*BSS ([0-9a-f:]*)?.*freq: ([0-9]*).*signal: (-[0-9]*\.[0-9]*) dBm.*SSID: ([^\n]*).*/, "", "g"); print r;}' | sort -n | sed 's#&#\&#' # The HTML comment contains the signal quality to allow sorting htmloutput=1 %>
Name Frequenz Signal MAC
\\4\\2 MHz\\3 dBm\\1
<% done if [ ${htmloutput} -eq 0 ]; then echo "No wireless interface available that supports scan." fi %>
<%in /www/include/footer %>