#!/usr/bin/haserl <% # read from keyxchangev2data . /lib/functions/fff/evalhoodinfo # prepare if [ "$REQUEST_METHOD" = "POST" ] ; then if [ "$POST_resethood" != "" ] ; then # reset hood rm "$hoodfileref" 2> /dev/null MSG='Hood-Daten werden innerhalb von 5 Minuten neu prozessiert.' fi fi %> <%in /www/include/header %> <%in /www/include/helpers %> <% show_msg %> <% if pidof fastd >/dev/null ; then vpn_active="aktiv" else vpn_active="inaktiv" fi up="$(uptime)" load="${up##*:}" uptime="${up%%,*}" uptime="${uptime##*up}" #include OpenWrt version . /etc/openwrt_release . /etc/firmware_release addr() { local addr="$(ip -$1 address show dev $2 2>/dev/null | tr '/' ' '| awk '/inet/{ printf("%s
", $2); }')" echo "${addr:--}" } default_gw() { ip -$1 route list 0/0 dev $2 2> /dev/null | awk '{print($3); exit(0)}' } wanif=$(uci -q get network.wan.ifname) if [ -n "$(default_gw 4 $wanif)" -o -n "$(default_gw 6 $wanif)" ]; then internet_active="Ja" else internet_active="Nein" fi if ! fastd_pub=$(echo "secret \"$(uci -q get fastd.fff.secret)\";" | fastd -c - --show-key --machine-readable); then fastd_pub="-" fi %>
System
Name:<%= ${HOSTNAME} %>
Modell:<% cat /tmp/sysinfo/model 2>/dev/null %>
MAC-Adresse:<%= $(cat /sys/class/net/br-client/address) %>
Laufzeit:<%= ${uptime} %>
Auslastung:<%= ${load} %>
Uhrzeit:<% date %>
VPN <% if [ -f "$(command -v fastd)" ] ; then %> <% fi %> <% if [ -f "$(command -v wg)" ] ; then %> <% fi %>
VPN via fastd:<%= ${vpn_active} %>
fastd public key:<%= ${fastd_pub} %>
<% for f in $(wg | grep interface | cut -d ":" -f 2 | sed 's/^ //'); do endpoint="$(wg show $f | grep endpoint)" handshake="$(wg show $f | grep handshake)" transfer="$(wg show $f | grep transfer)" echo "" echo "" echo "" echo "" done %>
InterfacenameEndpointHandshakeDaten
"$f""${endpoint#*:}""${handshake#*:}""${transfer#*:}"
Routing <% if [ -f "$(command -v batctl)" ] ; then %> <% fi %> <% if birdc show status >/dev/null 2>&1 || pgrep babeld >/dev/null; then %> <% fi %>
Bekannte Knoten:<%= $(($(batctl tg -H | cut -b 40-56 | sort | uniq | wc -l 2>/dev/null)+1)) %>
Nachbarknoten:<%= $(batctl o -H | cut -b 40-56 | sort | uniq | wc -l 2>/dev/null) %>
<% if birdc show status >/dev/null 2>&1; then neighbours="$(birdc -r show babel neighbors | tail -n +5 | awk '{ printf "", $1, $2, $3 }')" fi if pgrep babeld >/dev/null; then lockfile="/tmp/fff-web-ui.babel.lock" if [ -e $lockfile ] && [ 30 -gt $(( $(date +%s) - $(date -r $lockfile +%s) )) ] ; then neighbours=$(cat /tmp/fff-web-ui.babel) else neighbours="$(echo dump | nc ::1 33123 | grep '^add neighbour' | awk '{ for (i=2; i < NF; i += 2) { vars[$i] = $(i+1) } } { printf "", vars["address"], vars["if"], vars["cost"] }')" echo "$neighbours" > /tmp/fff-web-ui.babel touch $lockfile fi fi echo -n "$neighbours" %>
IPInterfaceKosten
%s%s%s
%s%s%s
Netz: Freifunk
Nutzer:<% batctl tl -H 2> /dev/null | grep -c 'W' %>
Empfangen:<% cat /sys/class/net/br-client/statistics/rx_bytes 2> /dev/null | human_bytes %>
Gesendet:<% cat /sys/class/net/br-client/statistics/tx_bytes 2> /dev/null | human_bytes %>
IPv4 Adressen:<% addr 4 br-client %>
IPv6 Adressen:<% addr 6 br-client %>
Software <% if [ -e /sys/module/batman_adv/version ] ; then %> <% fi if [ -f "$(command -v fastd)" ] ; then %> <% fi if [ -e /lib/functions/fff/babel ]; then . /lib/functions/fff/babel babel_version=$(babel_get_version) if [ $? -eq 0 ]; then echo "" fi fi %>
Firmware Version:<%= ${FIRMWARE_VERSION} %>
OpenWrt Version:<%= ${DISTRIB_DESCRIPTION} %>
Kernel Version:<% uname -s -m -r %>
Batman-Adv Version:<% cat /sys/module/batman_adv/version 2>/dev/null %>
Fastd Version:<% fastd --version 2> /dev/null | cut -d' ' -f 2 %>
Aktivierte Babel Version"$babel_version"
<% if [ -e /usr/lib/functions/fff/hoodfile ]; then %>
Hood
Hood:<% echo "$hood" %>
Mesh-Type (2.4/5 GHz):<% echo "${mesh_type2} / ${mesh_type5}" %>
Channel (2.4/5 GHz):Gerät: <% echo "${real_chan2ghz} / ${real_chan5ghz}" %> | Hood: <% echo "${chan2ghz} / ${chan5ghz}" %>
SSID (Client-AP):Gerät: <% echo "${real_essid}" %> | Hood: <% echo "${essid}" %>
 
Beim Klicken werden die Hood-Daten innerhalb von 5 Minuten neu abgerufen und angewandt:
<% fi %>
Netz: WAN
Internet vorhanden:<%= ${internet_active} %>
Empfangen:<% cat /sys/class/net/${wanif}/statistics/rx_bytes 2> /dev/null | human_bytes %>
Gesendet:<% cat /sys/class/net/${wanif}/statistics/tx_bytes 2> /dev/null | human_bytes %>
IPv4 Adressen:<% addr 4 $wanif %>
IPv6 Adressen:<% addr 6 $wanif %>
<%in /www/include/footer %>