Hello,
I trying to figure out how to automate a captive portal that requires java for encryption and it looks like it is impossible, in openwrt it is possible to use Lynx but it doesn't support java. I read something about a python script but don't have enough knowledge to understand how it works. Has anyone had this issue?
I tried to create my own automatic login script for travelmate using lynx browser, but when I launch the captive portal page with lynx I get a message from the page saying that a browser compatible with javascript is required. I do have credentials for this network I just need Openwrt re login when the session expires.
Do you crack/automate the http bases CP authetification with the openwrt router or a different machine? Because I saw that it is possible with Selenium but only with desktop browser.
lynx, really!? It's 2020 ...
Just kidding, I never tried such approach. I always use my Linux Notebook with firefox plus "HTTP header live" extension to build my login scripts, e.g. a typical excerpt from the HTTP header extension after hitting the "login" button on the CP landing page:
#!/bin/sh
# captive portal auto-login script for Telekom hotspots in german h+hotels
# written by Dirk Brenken (dev@brenken.org)
# This is free software, licensed under the GNU General Public License v3.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
domain="hotspot.t-mobile.net"
cmd="$(command -v curl)"
# curl check
#
if [ ! -x "${cmd}" ]
then
exit 1
fi
# initial get request to receive & extract a valid security token
#
"${cmd}" "https://${domain}/wlan/rest/freeLogin" -c "/tmp/${domain}.cookie" -s -o /dev/null
if [ -r "/tmp/${domain}.cookie" ]
then
session_id="$(awk '/JSESSIONID/{print $7}' "/tmp/${domain}.cookie")"
sec_id="$(awk '/DT_H/{print $7}' "/tmp/${domain}.cookie")"
rm -f "/tmp/${domain}.cookie"
else
exit 2
fi
# final post request/login with valid session cookie/security token
#
if [ -n "${session_id}" ] && [ -n "${sec_id}" ]
then
"${cmd}" "https://${domain}/wlan/rest/freeLogin" -H "Referer: https://${domain}/TD/hotspot/H_Hotels/en_GB/index.html" -H "Cookie: JSESSIONID=${session_id}; DT_DEV_ID=1234567890123; DT_H=${sec_id}" -H 'Connection: keep-alive' --data "rememberMe=true" -s -o /dev/null
else
exit 3
fi
That's it. Finally I copied this script to my router, reference the script in travelmate as the login script for these kind of hotspots ... try it on your own, it's really quite easy.
It also captured the firefox captive autodetect success which I didn't paste
I see that I have more data that yours so I'm confused on how to setup the script.
You need to extract the cookie with the current "NACSID" plus username and password. Username and password should be passed as parameters (see "generic-user-pass.login" as example script in /etc/travelmate.
To extract the required cookie information start with something like that ...
#!/bin/sh
# [...]
domain="<LOGIN-DOMAIN>"
cmd="$(command -v curl)"
# curl check
#
if [ ! -x "${cmd}" ]
then
exit 1
fi
# initial get request to receive & extract a valid security token
#
"${cmd}" "<LOGIN-DOMAIN><LOGIN-URL>" -c "/tmp/${domain}.cookie" -s -o /dev/null
if [ -r "/tmp/${domain}.cookie" ]
then
nacs_id="$(awk '/NACSID/{print $7}' "/tmp/${domain}.cookie")"
fi
echo "$nacs_id"
Most probably you need to change the awk to extract your cookie ... check the cookie in the tmp-directory manually and test with this snippet until you'll get the correct nacs_id. Good luck ...
I'll apologize right now if this is covered someplace, I searched and didn't find it. I'm a total noob w/ OpenWRT and am trying to configure my Netgear WNDR4300 as a travel router -- a WiFi Range Extender.
As usual, rather than read, I jumped right in and tried to install the two packages. Travelmate installed fine, but the Luci Companion package errored our with a missing dependency on "luci-compat".
I took a chance and did --force-depends but it's clear that was a bad idea. Choosing Travelmate from the Luci menu just brings up lua errors.
Does anyone have a suggestion?
Should I just find this luci-compat package and install that?
Hi! Thank you for replying! I figured it out - I'm on 19.07. But I wasn't online - the OpenWrt router wasn't connected to the internet so I was scp'ing the packages up and installing them manually.
Once I put the router online and used the Luci package manager, things went well.
It's working but I have another question - that I'm going to search for...
And that's how do I change the name of my Access Point from OpenWrt to something else?
Is that done inside of the travelmate screen? Or outside in another Luci screen?
Hi there,
I have a problem, maybe some can help me.
After a reset of the router, I installed travelmate. I set everything up, added a wlan, removed the ethernet cables and everything worked fine.
But after unplugging power and power the router on again, nothing worked. I could connect trough wlan, but there was no internet-connection and i could NOT access the luci web-interface to reconfig anything or check the problem.
That's most probably unrelated to travelmate. If I remember correctly this is a limited 4/32 MB device!? If so try a reflash of a tiny image and begin from scratch ... or (IMHO preferred) buy a solid device with at least 16/128 MB.
My apologies if this is in the thread already - I did look but no luck ... so asking here. And let me say up front - I really like Travelmate, very nicely written, works well! Just a couple minor things, that may be correct, I'm just not sure.
It seems like when the client setting (uplink) is changed, the master (AP, downlink) resets / drops out. Is that right, and intended?
Having struggles with the WiFi (downlink in particular, but it may be uplink induced) dropping out ... at a congested area (airport). It may be because of 1 above, and trying to switch around given the inteference.