Travelmate support thread

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?

Thanks,

Could you please elaborate that!? What does it mean in detail?

Edit: Usually it takes me 10 minutes to "crack"/automate a http based CP authentification. Just use a browser extension like "HTTP header live" ...:wink:

Hello dibdot,

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.

Thanks

lynx, really!? It's 2020 ... :wink:
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:

https://hotspot.t-mobile.net/wlan/rest/freeLogin
Host: hotspot.t-mobile.net
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/json;charset=utf-8
X-Lang: en_GB
Content-Length: 20
Origin: https://hotspot.t-mobile.net
DNT: 1
Connection: keep-alive
Referer: https://hotspot.t-mobile.net/TD/hotspot/H_Hotels/en_GB/index.html
Cookie: JSESSIONID=510CE7AAB95025D06B04ABE3BE3C1D96.P2; DT_DEV_ID=pM3ldO4GEUk4t; DT_H=LTU5NjAxODEy
{"rememberMe":false}
POST: HTTP/1.1 200 200
Date: Wed, 22 Jan 2020 21:32:43 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
X-CSA-JSESSIONID: 510CE7AAB95025D06B04ABE3BE3C1D96.P2
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: DT_H=LTU5NjAxODEy; Max-Age=1800; Expires=Wed, 22-Jan-2020 22:02:42 GMT; Path=/
DT_DEV_ID=pM3ldO4GEUk4t; Max-Age=2592000; Expires=Fri, 21-Feb-2020 21:32:42 GMT; Path=/wlan; Secure
Content-Type: application/json;charset=UTF-8
Strict-Transport-Security: max-age=15768000
Keep-Alive: timeout=5, max=50
Connection: Keep-Alive
Transfer-Encoding: chunked

That's enough to build your login script, e.g.:

#!/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.

Hello dibdot,

Amazing, I think I understood exactly what should be done here, I will try it on Monday and let you know the outcome.

Cheeres,

@dibdot That's a great little tutorial on writing auto-login scripts!

Unfortunately it seems that HTTP Header Live doesn't work on mobile Chrome, such as Android.

I rarely take my laptop with me and most often just have an Android device or two.

Look for "Cookies and HTTP Headers analyzer" - this add-on is available for firefox mobile too. Maybe that works as well ...

@dibdot

Here is the output of the http header live:

https://<<thedomain>>/connect/Login

Host: <<thedomain>>

User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0

Accept: */*

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate, br

Content-type: application/x-www-form-urlencoded

Content-Length: 304

Origin: https://<<thedomain>>

Connection: keep-alive

Referer: https://<<thedomain>>/connect/PortalMain

Cookie: cpnacportal_login_type=password; cpnacportal_username=<<theusername>>; NACSID=42c59c75b1282eb2554d5a0934cbf8a8

realm=passwordRealm&username=<<theusername>>&password=c64b2ec2ff70cba3bd8452e9931e47fc1c778c5c9464d0fc7328f1f6c883d79d4542cb229cc90d18cdc72ed0584ed7f41ec97a302c41d6da7c63c12c9cb68f2f3b3f632cc1bf7b38069bc21b1b7e80b4e21917f35d27ae3426bf88becd7a351bb04c789510abcf7cb3ec0e1385d26359378013d12d45a2309ace714a5a419095

POST: HTTP/1.1 200 OK

Date: Mon, 27 Jan 2020 07:57:39 GMT

Server: CPWS

Strict-Transport-Security: max-age=31536000; includeSubDomains

X-Frame-Options: DENY

Expires: Thu, 19 Nov 1981 08:52:00 GMT

Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0

Pragma: no-cache

Set-Cookie: NACSID=9e91f60bed635f12ea5b4b3b5698364d; path=/; secure; HttpOnly

Content-Length: 177

Connection: close

Content-Type: text/html; charset=UTF-8

https://<<thedomain>>/connect/GetStateAndView

Host: <<thedomain>>

User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0

Accept: */*

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate, br

Content-type: application/x-www-form-urlencoded

Content-Length: 0

Origin: https://<<thedomain>>

Connection: keep-alive

Referer: https://<<thedomain>>/connect/PortalMain

Cookie: cpnacportal_login_type=password; cpnacportal_username=<<theusername>>; NACSID=9e91f60bed635f12ea5b4b3b5698364d



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.

Can you please advise?

Thanks

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?

Thanks!

You're using Openwrt 18.06? If so, then just install the above mentioned dummy package (luci-compat).

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... :slight_smile:
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?

Again - thank you!!

In LuCI Network => Wireless => Edit

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.

You are totally right. Re-flashing solved the problem. Travelmate works so far fine and smooth for me.

Thanks for your help and your work here!

1 Like

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.

  1. It seems like when the client setting (uplink) is changed, the master (AP, downlink) resets / drops out. Is that right, and intended?
  2. 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.

Thanks!

well... lightening zapped my stuff last night...

  • droid refused to usb tether
  • regular openwrt->wireless UI had issues adding the STA

travelmate saved the day... glad i'd added it to my default packages... thanks a ton @dibdot !

1 Like

I am trying to installl luci companion but gettting the following error:

  • satisfy_dependencies_for: Cannot satisfy the following dependencies for luci-app-travelmate:
  • luci-compat
  • opkg_install_cmd: Cannot install package luci-app-travelmate.

I have luci-base installed and that does not let me install luci-compat... Any ideas?

I’m using Travelmate again. Awesome!

I have a request - does anyone have a lite interface, something that a non-tech user can go to to scan for networks and enter a passphrase?

I don’t want to give random users root access via Luci so I’m looking for a very simple and limited interface.

Thanks!