firmware/src/packages/fff/fff-web-ui/files/www/ssl/cgi-bin/wifiscan.html

42 lines
987 B
HTML
Executable File

#!/usr/bin/haserl
<%in /www/include/header %>
<table style="width: 100%">
<tr><td>
<%
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
%>
<fieldset class="wifitable">
<legend>Wifi Scan: <% echo -n $dev %></legend>
<table>
<tr>
<th>Name</th>
<th>Frequenz</th>
<th>Signal</th>
<th>MAC</th>
</tr>
<%
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]*).*/, "<!-- \\3 --><tr><td>\\4</td><td>\\2 MHz</td><td>\\3 dBm</td><td>\\1</td></tr>", "g"); print r;}' | sort -n | sed 's#&#\&amp;#'
# The HTML comment contains the signal quality to allow sorting
htmloutput=1
%>
</table>
</fieldset>
<%
done
if [ ${htmloutput} -eq 0 ]; then
echo "No wireless interface available that supports scan."
fi
%>
</td></tr>
</table>
<%in /www/include/footer %>