Make it your own
print_router_label() {
DOMAIN=$(uci get dhcp.@dnsmasq[0].domain)
HOSTNAME=$(uci get system.@system[0].hostname)
DEVICE=$(cat /tmp/sysinfo/model)
echo -n "Print login user: ";read USER
echo -n "Print login pass: ";read -s PASS
cat <<EOF
Print the following label and tape it to the router...
======= Printed with: print-router-label.sh =======
Device: $DEVICE
OpenWrt: $(. /etc/openwrt_release; echo $DISTRIB_DESCRIPTION)
Connect to: http://$HOSTNAME.$DOMAIN
or: ssh $USER@$HOSTNAME.$DOMAIN
LAN: $(uci get network.lan.ipaddr)
User: $USER
Pass: $PASS
EOF
uci show wireless | awk -F= '/wifi-iface$/{print $1}' \
| while read iface;do
[ "$(uci get $iface.disabled)" = "1" ] && continue
cat <<EOF
Wifi SSID: $(uci get $iface.ssid)
Wifi KEY: $(uci get $iface.key)
EOF
done
cat <<EOF
Configured: $(date +"%Y-%b-%d")
=== See github.com/richb-hanover/OpenWrtScripts ==="
Label for Power Brick: $DEVICE"
EOF
}
RuralRoots:
I fully agree sir. My sons, guests, and family rely solely on the QR code pasted on the refrigerator to access my network to my chagrin, but far less stress on me.
Yes. And it'd be sweet if OpenWrt could print such a label/QR code right from a LuCI page.
Anyone know how to do this? (That is, add a new tab to the Interface section of a wireless page? That way, the QR Code would be printable for any wireless interface, but you could choose only to print your Guest wifi credentials...)
slh
December 3, 2024, 2:37am
23
We're also slowly seeing devices (xiaomi ax3000t) with NFC capabilities, which can use that to transport the wifi access credentials, XINFC - Tools the NFC reader on the Xiaomi routers .
1 Like
evs
December 3, 2024, 2:46am
24
I think to start one could just do the QR code in text with 'qrencode'.
it has a utf-8 etc mode output FYI.
qrencode "WIFI:T:WPA;S:THISISNETWORK;P:ThisPasswordMustBeChanged;;" -t utf8
βββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββ
ββββ βββββ ββββ βββ ββββββ βββββ ββββ
ββββ β β ββββ ββββββββββ β β ββββ
ββββ βββββ β ββββ β β ββ βββββ ββββ
ββββββββββββ βββ βββββ β ββββββββββββ
βββββ ββββββββ β ββββ β βββ ββββββββ
ββββββ ββ βββ ββ βββββ ββ βββββ ββββ
ββββββββββββββ β βββββ βββ β βββββββ
βββββββββ ββββ ββ βββββ ββββ ββββββ
βββββ βββ ββββββ βββ βββ ββββββ βββββ
ββββββ ββββββββ βββββββ ββββββββββ
ββββββββββββ β β β βββ βββ β ββββββ
ββββ βββββ ββ ββ βββββ βββ ββββββββ
ββββ β β βββββ ββββββββ ββ ββ ββββ
ββββ βββββ ββββ β βββ ββ βββββ ββββ
βββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββ
My mentor always said, "If you can't think of three ways to misuse a tool, you don't really understand it."
You really understand qrencode
1 Like
evs
December 3, 2024, 4:59am
26
It took a little documentation reading. But most of it is stack exchange hahahaha =)
edit:
But yeah there's enough redundancy for damage to QR codes that it can work whilst doing all kinds of stuff yeah =)
You could use this thread: Poor man's virtual hosts
for some ideas on how to have your own printlabel.lan host that pulls up a customized output that displays the displayable info......
I wanted to use my router to serve a (semi-) static website on the LAN, next to the Luci interface. It is possible to start 2 instances of uhttpd on different ports, but that is not very convenient. uhttpd doesn't support virtual hosts, or at least I couldn't find any documentation for that. Instead found a way using cgi.
/www/index.html is basically a redirect to /cgi-bin/luci. I changed that to a redirect to /virtualhosts.sh.
Then I wrote a cgi script /www/virtualhosts.sh:
#!/bin/sh
# optiβ¦