From 0bcf683058c42481fb965e44f3490ac019fb58d6 Mon Sep 17 00:00:00 2001 From: Rich Brown Date: Wed, 27 Nov 2024 14:18:04 -0500 Subject: [PATCH] Add sample label to the script --- print-router-label.sh | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/print-router-label.sh b/print-router-label.sh index 6ebfadf..fc1f871 100644 --- a/print-router-label.sh +++ b/print-router-label.sh @@ -2,21 +2,33 @@ # Print Router Label -# This script retrieves values from the OpenWrt to print a +# This script retrieves values from an OpenWrt router to print a # concise label that contains important config info. # This label can be taped to the side of the router # so the next person to encounter the router (which may be -# you) can access it. It is secure because if someone -# can read the label, they can factory-reset the router anyway. +# you) can access it. It is pretty secure because if someone +# can read the label, they can factory-reset the router +# (or steal your silverware). +# Here's an example label: -# Usage: sh print-router-label.sh [root-password] [WifiSSID] [WifiPassword] +# === Printed with: print-router-label.sh ============ +# Device: Linksys E8450 (UBI) +# OpenWrt: 'OpenWrt 23.05.5 r24106-10cc5fcd00' +# Connect to: http://Belkin-RT3200.local +# or: ssh root@Belkin-RT3200.local +# LAN: 192.168.253.1 +# User: root +# Login PW: abcdef +# Wifi SSID: OpenWrt +# Wifi PW: -open- +# Configured: 2024-Nov-27 +# === See: github.com/richb-hanover/OpenWrtScripts === -# There's no way to determine the root password (it's hashed) -# so the script leaves it as "?" unless you supply it. +# Usage: sh print-router-label.sh root-password WifiSSID WifiPassword print_router_label() { -local NEWPASSWD="${1:-"?"}" +local ROOTPASSWD="${1:-"?"}" local WIFISSID="${2:-"?"}" local WIFIPASSWD="${3:-"?"}" @@ -26,7 +38,6 @@ OPENWRTVERSION=$(grep "DISTRIB_DESCRIPTION" /etc/openwrt_release | cut -d"=" -f2 HOSTNAME=$(uci get system.@system[0].hostname) LANIPADDRESS=$(uci get network.lan.ipaddr) - echo "" echo "Print the following label and tape it to the router..." echo "" @@ -37,7 +48,7 @@ echo " Connect to: http://$HOSTNAME.local" echo " or: ssh root@$HOSTNAME.local" echo " LAN: $LANIPADDRESS" echo " User: root" -echo " Login PW: $NEWPASSWD" +echo " Login PW: $ROOTPASSWD" echo " Wifi SSID: $WIFISSID" echo " Wifi PW: $WIFIPASSWD" echo " Configured: $TODAY"