Open soakes opened 1 week ago
I've just knocked up the following script based out of the URLs you had in your script, this works fine on this router and pasting here for others in case they run into the same issue.
No extra packages are required for this to work.
Just create a file on your router, then add a cronjob pointing at it set to run every minute. At worse your line be down one minute which is acceptible I think.
This also checks to make sure your actually on EE WiFi before doing anything and also won't try and login if you already have intenet access which would mean your session hasnt expired yet.
#!/bin/sh
# Configuration Variables
SSID_TARGET="EE WiFi"
PING_IPS="1.1.1.1 8.8.8.8 9.9.9.9"
USERNAME="****************@btconnect.com"
PASSWORD="***************"
LOGIN_URL="https://btwifi.com:8443/ante?partnerNetwork=btb"
# Debug Variable (set to "true" to enable messages)
DEBUG_MODE="false"
# Status Messages
MSG_NOT_CONNECTED="Not connected to $SSID_TARGET. Exiting."
MSG_CONNECTED="Connected to $SSID_TARGET on interface %s. \nChecking internet connectivity..."
MSG_NO_INTERNET="No internet detected. Attempting to log in..."
MSG_LOGIN_SUCCESS="Login successful, internet is now available."
MSG_LOGIN_FAILED="Login attempt failed. No internet connection."
MSG_ALREADY_CONNECTED="Internet is already available."
# Function to print messages if DEBUG_MODE is true
log() {
if [ "$DEBUG_MODE" = "true" ]; then
echo -e "$1"
fi
}
# Function to check for the target SSID
get_interface() {
for interface in $(iwinfo | grep -o '^[^ ]*'); do
SSID=$(iwinfo "$interface" info | grep 'ESSID' | sed 's/.*ESSID: "\(.*\)"/\1/')
if echo "$SSID" | grep -iq "^$SSID_TARGET$"; then
echo "$interface"
return
fi
done
echo ""
}
# Function to check internet connectivity
check_internet() {
for ip in $PING_IPS; do
if ping -c 1 -W 2 "$ip" > /dev/null 2>&1; then
return 0 # Internet is up
fi
done
return 1 # No internet
}
# Main Script Logic
interface_found=$(get_interface)
if [ -z "$interface_found" ]; then
log "$MSG_NOT_CONNECTED"
exit 1
fi
log "$(printf "$MSG_CONNECTED\n" "$interface_found")"
if check_internet; then
log "$MSG_ALREADY_CONNECTED"
else
log "$MSG_NO_INTERNET"
wget -q -T 10 -O /dev/null --post-data "username=$USERNAME&password=$PASSWORD" "$LOGIN_URL"
if check_internet; then
log "$MSG_LOGIN_SUCCESS"
else
log "$MSG_LOGIN_FAILED"
fi
fi
Device: Beryl AX (GL-MT3000)
OpenWrt Version: 21.02-SNAPSHOT (r15812+900-46b6ee7ffc)
Issue Summary
I am trying to set up an autologin for EE WiFi (BT Wi-Fi) on my GL-MT3000 router. While I am able to upload the required files via Luci, the script fails to start when I attempt to run it after entering my credentials.
Steps to Reproduce
Attempt to run the init script manually:
Observed Behavior
The script produces the following error message:
Investigation
I inspected the /etc/init.d/ee-bt_wi-fi_autologin_service script and ran a grep search on the filesystem, finding the version string referenced here:
The script seems to be incompatible with the 21.02-SNAPSHOT version, though I’m unsure why. The string 21.02-SNAPSHOT appears to be the source of the "out of range" error, but it’s not clear how to adjust the script to make it compatible with this version.
Expected Behavior
The script should accept the current OpenWrt version and connect to EE WiFi without throwing an error. Request for Assistance
If anyone has insight into adjusting the script to support OpenWrt 21.02-SNAPSHOT or knows where this compatibility check might be failing, I'd appreciate any advice.